coeng

view 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
line source
1 #ifndef GOBJECT_H_
2 #define GOBJECT_H_
4 #include <vector>
5 #include <map>
6 #include <string>
7 #include "comp.h"
9 class GObject {
10 private:
11 std::vector<Component*> comp;
12 std::map<std::string, Component*> comp_by_name;
14 bool sorted;
16 void sort_components();
18 public:
19 GObject();
20 ~GObject();
22 bool add_component(Component *c); // takes ownership
23 bool remove_component(Component *c); // whoever calls this, now has ownership
24 bool delete_component(Component *c);
26 Component *get_component(const char *name) const;
28 void update(float dt = 0.0f);
29 void draw() const;
30 };
32 #endif // GOBJECT_H_