merge master into develop

This commit is contained in:
Clément Le Bihan
2021-05-23 22:15:37 +02:00
20 changed files with 181 additions and 101 deletions
+20 -1
View File
@@ -6,6 +6,7 @@
#pragma once
#include <vector>
#include <functional>
#include "Entity/Entity.hpp"
namespace WAL
@@ -15,9 +16,27 @@ namespace WAL
{
private:
//! @brief The list of registered entities
std::vector<Entity> _entities;
std::vector<Entity> _entities = {};
public:
//! @brief Get the list of entities.
std::vector<Entity> &getEntities();
//! @brief Add a new entity to the scene, you can use this method with the same arguments as the entity's constructor.
//! @return The current scene is returned to allow you to chain call.
template <class ...Params>
Scene &addEntity(Params ...params)
{
this->_entities.emplace_back(params...);
return *this;
}
//! @brief A default constructor
Scene() = default;
//! @brief A scene is copy constructable
Scene(const Scene &) = default;
//! @brief A default destructor
~Scene() = default;
//! @brief A scene is assignable
Scene &operator=(const Scene &) = default;
};
}
-33
View File
@@ -1,33 +0,0 @@
//
// Created by Zoe Roux on 2021-05-14.
//
#include "SceneManager.hpp"
namespace WAL
{
SceneManager &WAL::SceneManager::addScene(WAL::Scene &&scene)
{
this->_scenes.push_front(scene);
return *this;
}
SceneManager &SceneManager::addBackScene(Scene &&scene)
{
this->_scenes.insert(++this->_scenes.begin(), scene);
return *this;
}
Scene &SceneManager::getCurrent()
{
if (this->_scenes.empty())
throw NotFoundError("No scene exists.");
return this->_scenes.front();
}
SceneManager &SceneManager::closeCurrent()
{
this->_scenes.pop_front();
return *this;
}
}