coeng
annotate src/gobj.h @ 7:af24cfbdf9b6
adding collision detection
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 14 Feb 2015 10:08:00 +0200 |
parents | 0e5da17d589c |
children |
rev | line source |
---|---|
nuclear@6 | 1 #ifndef GOBJECT_H_ |
nuclear@6 | 2 #define GOBJECT_H_ |
nuclear@1 | 3 |
nuclear@1 | 4 #include <vector> |
nuclear@1 | 5 #include <map> |
nuclear@1 | 6 #include <string> |
nuclear@1 | 7 #include "comp.h" |
nuclear@1 | 8 |
nuclear@6 | 9 class GObject { |
nuclear@1 | 10 private: |
nuclear@1 | 11 std::vector<Component*> comp; |
nuclear@1 | 12 std::map<std::string, Component*> comp_by_name; |
nuclear@1 | 13 |
nuclear@1 | 14 bool sorted; |
nuclear@1 | 15 |
nuclear@6 | 16 void sort_components(); |
nuclear@6 | 17 |
nuclear@1 | 18 public: |
nuclear@6 | 19 GObject(); |
nuclear@6 | 20 ~GObject(); |
nuclear@1 | 21 |
nuclear@6 | 22 bool add_component(Component *c); // takes ownership |
nuclear@6 | 23 bool remove_component(Component *c); // whoever calls this, now has ownership |
nuclear@1 | 24 bool delete_component(Component *c); |
nuclear@1 | 25 |
nuclear@1 | 26 Component *get_component(const char *name) const; |
nuclear@1 | 27 |
nuclear@6 | 28 void update(float dt = 0.0f); |
nuclear@6 | 29 void draw() const; |
nuclear@1 | 30 }; |
nuclear@1 | 31 |
nuclear@6 | 32 #endif // GOBJECT_H_ |