alalalallalalllala

This commit is contained in:
Zoe Roux
2021-05-27 16:37:22 +02:00
parent d69a4f8ee2
commit a26725f5a5
22 changed files with 467 additions and 133 deletions
+3 -3
View File
@@ -38,7 +38,7 @@ namespace WAL
//! @return True if all dependencies are met, false otherwise.
static bool _hasDependencies(const Entity &entity, const System &system);
public:
//! @brief The scene manager that allow multiple scene to work together.
//! @brief The scene that contains entities.
Scene scene;
//! @brief The time between each fixed update.
static std::chrono::nanoseconds timestep;
@@ -46,7 +46,7 @@ namespace WAL
//! @brief Create a new system in place.
//! @return The wal instance used to call this function is returned. This allow method chaining.
template<typename T, class ...Types>
Wal &addSystem(Types ...params)
Wal &addSystem(Types &&...params)
{
const std::type_info &type = typeid(T);
auto existing = std::find_if(this->_systems.begin(), this->_systems.end(), [&type] (auto &sys) {
@@ -54,7 +54,7 @@ namespace WAL
});
if (existing != this->_systems.end())
throw DuplicateError("A system of the type \"" + std::string(type.name()) + "\" already exists.");
this->_systems.push_back(std::make_unique<T>(params...));
this->_systems.push_back(std::make_unique<T>(std::forward<Types>(params)...));
return *this;
}