1 #ifndef ROGUELIKE_BASE_GAMEOBJECT_H_
2 #define ROGUELIKE_BASE_GAMEOBJECT_H_
5 #include <ugdk/action/entity.h>
10 #include <ugdk/portable/tr1.h>
11 #include FROM_TR1(functional)
13 #include <ugdk/math/vector2D.h>
23 #define FORALL_UPDATEABLE_COMPONENTS(action) \
24 action( graphic, Graphic)
26 #define FORALL_COMPONENTS(action) \
27 action( controller, Controller) \
28 action( vision, Vision) \
29 action( damageable, Damageable) \
30 action( energy, Energy) \
31 action( shape, Shape) \
32 action( graphic, Graphic) \
36 #define FULL_TYPE(type) component::type*
38 #define INI_FULLTYPE_ARG_DECLARATION(compo,type) FULL_TYPE(type) compo##_component,
40 #define GETTER_DECLARATION(compo,type) \
41 FULL_TYPE(type) compo##_component() { return compo##_component_; } \
42 const FULL_TYPE(type) compo##_component() const { return compo##_component_; }
44 #define SETTER_DECLARATION(compo,type) \
45 void set_##compo##_component(FULL_TYPE(type) compo##_component) { compo##_component_ = compo##_component; }
47 #define ATTRIBUTES_DECLARATION(compo,type) FULL_TYPE(type) compo##_component_;
54 typedef ugdk::action::Entity super;
61 const std::tr1::function<
void (
void)>& die = std::tr1::function<
void (
void)>()
70 bool dead()
const {
return to_be_removed_; }
77 std::tr1::function<
void (
void)> die_;
83 #endif // ROGUELIKE_BASE_GAMEOBJECT_H_
void Initialize(FORALL_COMPONENTS(INI_FULLTYPE_ARG_DECLARATION) const std::tr1::function< void(void)> &die=std::tr1::function< void(void)>())
Definition: gameobject.h:53
#define GETTER_DECLARATION(compo, type)
Definition: gameobject.h:40
#define SETTER_DECLARATION(compo, type)
Definition: gameobject.h:44
void OnSceneAdd(ugdk::action::Scene *scene)
#define INI_FULLTYPE_ARG_DECLARATION(compo, type)
Definition: gameobject.h:38
#define ATTRIBUTES_DECLARATION(compo, type)
Definition: gameobject.h:47
bool dead() const
Definition: gameobject.h:70
FORALL_COMPONENTS(GETTER_DECLARATION) FORALL_COMPONENTS(SETTER_DECLARATION) void Die()