Id: | To index | |
Original: | Legend | |
Status: | ||
Mutant: | Show |
Testcases to display
Filter by kind
Filter by status
1: # ifndef entity_hpp |
2: # define entity_hpp |
3: |
4: # include "util.h" |
5: |
6: # include < array > |
7: |
8: enum class ComponentType { |
9: Mob , |
10: Sprite , |
11: Physics , |
12: |
13: Count |
14: } ; |
15: |
16: class Component { |
17: public : |
18: ident entity { invalid_id } ; |
19: ident id { invalid_id } ; |
20: |
21: operator bool ( ) const { return id != invalid_id ; } |
22: } ; |
23: |
24: // buffered_container<Entity> |
25: class Entity { |
26: public : |
27: ident id { invalid_id } ; |
28: |
29: operator bool ( ) const { return id != invalid_id ; } |
30: |
31: // hierarchy |
32: ident parent { invalid_id } ; |
33: std : : vector < ident > children ; |
34: |
35: void addChild ( Entity & child ) { |
36: child . parent = id ; |
37: children . push_back ( child . id ) ; |
38: } |
39: |
40: // common |
41: int age = 0 ; |
42: int life = - 1 ; // if >= 0 determines a finite life |
43: |
44: // components |
45: ident sprite { invalid_id } ; |
46: ident mob { invalid_id } ; |
47: ident physics { invalid_id } ; |
48: |
49: // private: |
50: // static buffered_container<Entity>* container_ {nullptr}; |
51: } ; |
52: |
53: # endif /* entity_hpp */ |