coeng
diff src/comp.cc @ 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 | 49a2e70ac455 |
children | 8cce82794f90 |
line diff
1.1 --- a/src/comp.cc Sat Feb 14 01:35:42 2015 +0200 1.2 +++ b/src/comp.cc Sat Feb 14 07:27:12 2015 +0200 1.3 @@ -10,28 +10,41 @@ 1.4 { 1.5 name = "unknown"; 1.6 gobj = 0; 1.7 - upd_prio = 0; 1.8 } 1.9 1.10 Component::~Component() 1.11 { 1.12 } 1.13 1.14 +void Component::attach(GObject *gobj) 1.15 +{ 1.16 + this->gobj = gobj; 1.17 +} 1.18 + 1.19 +void Component::detach() 1.20 +{ 1.21 + gobj = 0; 1.22 +} 1.23 + 1.24 +const char **Component::update_before() const 1.25 +{ 1.26 + static const char *before[] = { 0 }; 1.27 + return before; 1.28 +} 1.29 + 1.30 const char *Component::get_name() const 1.31 { 1.32 return name; 1.33 } 1.34 1.35 -void Component::update() 1.36 +void Component::update(float dt) 1.37 { 1.38 } 1.39 1.40 -bool Component::operator <(const Component &c) const 1.41 +void Component::draw() const 1.42 { 1.43 - return upd_prio < c.upd_prio; 1.44 } 1.45 1.46 - 1.47 void register_component(const char *name, Component *(*cons_func)()) 1.48 { 1.49 if(!early_comp_cons) {