aboutsummaryrefslogtreecommitdiffstats
path: root/yage/entity/entitymanager.h
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-02-13 19:14:33 +0000
committerYann Herklotz <ymherklotz@gmail.com>2018-02-13 19:14:33 +0000
commit49af8b16ae3f9e6579656ed10f815e9c465557d0 (patch)
tree1dff4aea6a59c466ea6a6f15ad7f5e2ac69f5b37 /yage/entity/entitymanager.h
parente9bd903761605c7619a235edddf07c3a0b963968 (diff)
downloadYAGE-49af8b16ae3f9e6579656ed10f815e9c465557d0.tar.gz
YAGE-49af8b16ae3f9e6579656ed10f815e9c465557d0.zip
[entity] Starting work on entity system.
Diffstat (limited to 'yage/entity/entitymanager.h')
-rw-r--r--yage/entity/entitymanager.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/yage/entity/entitymanager.h b/yage/entity/entitymanager.h
new file mode 100644
index 00000000..da125d94
--- /dev/null
+++ b/yage/entity/entitymanager.h
@@ -0,0 +1,83 @@
+/** ---------------------------------------------------------------------------
+ * @file: entitymanager.h
+ *
+ * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
+ * MIT License, see LICENSE file for more details.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef YAGE_ENGINE_ENTITYMANAGER_H
+#define YAGE_ENGINE_ENTITYMANAGER_H
+
+#include "entity.h"
+
+#include <vector>
+
+namespace yage
+{
+
+class Space;
+
+/**
+ * Manages entities in a space.
+ */
+class EntityManager
+{
+public:
+ /**
+ * Default instance of an EntityManager.
+ */
+ EntityManager() = default;
+
+ /**
+ * Creates an instance of the entity manager, which refers back to the space
+ * it was created in and belongs to.
+ *
+ * @param space Current space that the EntityManager belongs to.
+ */
+ EntityManager(Space *space);
+
+ /**
+ * Creates an instance of the entitiy manager with an initial size.
+ *
+ * @param space Current space that the EntityManager belongs to.
+ * @param n Initial size of the EntityManager.
+ */
+ EntityManager(Space *space, std::size_t n);
+
+ /**
+ * Creates an Entity and returns the handle to the entity, which can then be
+ * used by the user to do operations on it.
+ *
+ * @return The handle to the entity that was created in the space.
+ */
+ unsigned createEntity();
+
+ /**
+ * Creates an Entity and returns it.
+ *
+ * @return The entity that was created by the entity manager in the current
+ * space.
+ */
+ Entity createEntityInstance();
+
+private:
+ /**
+ * The next available handle to give to the user.
+ */
+ unsigned next_handle_;
+
+ /**
+ * The space that the entity manager belongs to.
+ */
+ Space *space_;
+
+ /**
+ * The entities in the current space.
+ */
+ std::vector<Entity> entities_;
+};
+
+} // namespace yage
+
+#endif