aboutsummaryrefslogtreecommitdiffstats
path: root/yage/entity/entity.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/entity.h
parente9bd903761605c7619a235edddf07c3a0b963968 (diff)
downloadYAGE-49af8b16ae3f9e6579656ed10f815e9c465557d0.tar.gz
YAGE-49af8b16ae3f9e6579656ed10f815e9c465557d0.zip
[entity] Starting work on entity system.
Diffstat (limited to 'yage/entity/entity.h')
-rw-r--r--yage/entity/entity.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/yage/entity/entity.h b/yage/entity/entity.h
new file mode 100644
index 00000000..e6742893
--- /dev/null
+++ b/yage/entity/entity.h
@@ -0,0 +1,55 @@
+/** ---------------------------------------------------------------------------
+ * @file: entity.h
+ *
+ * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
+ * MIT License, see LICENSE file for more details.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef YAGE_ENGINE_ENTITY_H
+#define YAGE_ENGINE_ENTITY_H
+
+#include <vector>
+
+namespace yage
+{
+
+typedef unsigned EntityHandle;
+
+class Space;
+
+/**
+ * Entity convenience class. It contains handles to where the entity is in the
+ * entity manager of the space, and a pointer back to the space itself.
+ *
+ * This class cannot be instantiated outside of a Space and should only be
+ * instantiated through an entity manager, as otherwise the handle will not have
+ * a meaning.
+ */
+class Entity
+{
+public:
+ /**
+ * Creates an instance of an Entity with a handle that is associated to it.
+ * This handle refers to the position of he Entity in the list that is held
+ * by the EntityManager, and therefore the id is enough to refer to it.
+ */
+ Entity(EntityHandle handle);
+
+ /**
+ * Handle getter, as the user will only interact with the id itself. The
+ * handle is the unique identifier that the user can use to refer to the
+ * entity.
+ */
+ EntityHandle getHandle() const;
+
+private:
+ /**
+ * Entity handle for the entity manager.
+ */
+ EntityHandle handle_;
+};
+
+} // namespace yage
+
+#endif