diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-01-10 18:38:31 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2018-01-10 18:38:31 +0000 |
commit | 21ebdb0b3206bef69fee2b5f9b34573a516eddb4 (patch) | |
tree | 5fac3b692fecc7899f8c746e2116cdf6e2eee7b1 /yage/engine/space.h | |
parent | fe9fa3a98166718171b7687c24c289b4a2b5cf44 (diff) | |
parent | 5fe329fe40c296a4a3dce9bc5543419ac954e4b0 (diff) | |
download | YAGE-21ebdb0b3206bef69fee2b5f9b34573a516eddb4.tar.gz YAGE-21ebdb0b3206bef69fee2b5f9b34573a516eddb4.zip |
Merge branch 'develop'
Diffstat (limited to 'yage/engine/space.h')
-rw-r--r-- | yage/engine/space.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/yage/engine/space.h b/yage/engine/space.h new file mode 100644 index 00000000..e69df37a --- /dev/null +++ b/yage/engine/space.h @@ -0,0 +1,61 @@ +/** --------------------------------------------------------------------------- + * @file: space.h + * + * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com> + * MIT License, see LICENSE file for more details. + * ---------------------------------------------------------------------------- + */ + +#ifndef YAGE_ENGINE_SPACE_H +#define YAGE_ENGINE_SPACE_H + +#include <vector> + +#include "entitymanager.h" + +namespace yage +{ + +class System; + +/** + * Space that keeps track of all the entities, componenets and runs the systems + * on the data to update them. There can be multiple instances of a space, which + * can be used, for example, for different levels in the game that can be loaded + * separately, or a game menu that can be loaded above the other spaces when the + * user presses on pause. + */ +class Space +{ +public: + /** + * Default instance for a space. + */ + Space(); + + /** + * Create an entity that will belong to this space, and return the handle to + * the user. The Entity class itself should not be visible to the user, as + * the user only needs to worry about the handle when referring to the + * Entity and changing it. + */ + unsigned createEntity(); + +private: + /** + * The subspaces of the Space that act on the data and on their respective + * component. These are specific to the Space, as other spaces might have + * different Systems and not act on the same entities. + */ + std::vector<System *> systems_; + + /** + * Manages all the entities in the system, can create them for the current + * space. + */ + EntityManager em_; +}; + +} // namespace yage + +#endif |