coeng

view src/gobj.h @ 6:2f872a179914

first component test: - prs, xform, physics components with dependencies - topological sort of components to update them in the correct order - debug visualization component todo: remove draw() from components, doesn't make sense
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 14 Feb 2015 07:27:12 +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_