diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-06-15 20:01:05 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2018-06-15 20:01:05 +0100 |
commit | 40d48773a393edadea97e501a4a47cd1746dadbe (patch) | |
tree | f8351645e913f5fa432e5dcf1d0ed3c41c7f4112 /yage | |
parent | 65c75747db540be33dab64b23059de1387daf220 (diff) | |
download | YAGE-40d48773a393edadea97e501a4a47cd1746dadbe.tar.gz YAGE-40d48773a393edadea97e501a4a47cd1746dadbe.zip |
Adding components with test
Diffstat (limited to 'yage')
-rw-r--r-- | yage/entity/component.cpp | 6 | ||||
-rw-r--r-- | yage/entity/component.h | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/yage/entity/component.cpp b/yage/entity/component.cpp new file mode 100644 index 00000000..83fe4424 --- /dev/null +++ b/yage/entity/component.cpp @@ -0,0 +1,6 @@ +#include "component.h" + +GroupId BaseComponent::getGroup() { + static GroupId group_id = group_id_counter_++; + return group_id; +} diff --git a/yage/entity/component.h b/yage/entity/component.h new file mode 100644 index 00000000..84eb8b54 --- /dev/null +++ b/yage/entity/component.h @@ -0,0 +1,17 @@ +typedef unsigned int GroupId; + +class BaseComponent +{ +protected: + GroupId getGroup(); + +private: + friend class EntityManager; + + static GroupId group_id_counter_; +}; + +template <typename T> +class Component : public BaseComponent +{ +}; |