43
43
* Function pointer declarations.
44
44
*****************************************************************************/
46
typedef void (* GameObjectCallbackFunc)(GameObject * self, void * data);
46
typedef void (* GameObjectCallbackFunc)(GameObject * self, _pointer data);
48
48
typedef void (* GameObjectDrawFunc)(GameObject * self, SDL_Renderer * renderer);
52
52
typedef void (* GameObjectSetCallbackFunc)(GameObject * self, char * name,\
53
53
GameObjectCallbackFunc callback_func,
56
56
typedef void (* GameObjectMoveFunc)(GameObject * self);
79
79
GameObjectCallbackHandlerFunc callback_handler_func;
80
80
/** Method used to set a callback on a GameObject */
81
81
GameObjectSetCallbackFunc set_callback_func;
82
/** The method that is used to draw a GameObject */
83
GameObjectDrawFunc draw_func;
82
84
/** The method to be run when <tt>game_object_move ()</tt> is run. */
83
85
GameObjectMoveFunc move_func;
84
86
/** The method that handles how objects move over time */
107
109
*****************************************************************************/
110
* Initialises a GameObject.
112
* This should be run on every "sub instance" of a GameObject before the
112
* Initialises a GameObject
114
* This function should be run on every "sub instance" of a GameObject.
116
* @warning It is important to note that like object_initialize, this one does
117
* not allocate any memory. This is left up to the caller.
119
void game_object_initialize (GameObject * self, char * name, _pointer klass);
122
* Initialises a GameObjectClass.
124
* This should be run on every "sub class" of a GameObjectClass before the
113
125
* sub instance has its own methods and data set.
127
* @warning Like <tt>object_class_initialize</tt> this does not allocate any
128
* memory for the objects, that is left to the caller.
115
void game_object_initialize (GameObject * self,
130
void game_object_class_initialize (GameObjectClass * klass,
116
132
FreeFunc free_func,
117
133
ToStringFunc to_string_func,
118
GameObjectCallbackFunc callback_handler_func,
134
GameObjectCallbackHandlerFunc
135
callback_handler_func,
119
136
GameObjectSetCallbackFunc set_callback_func,
120
137
GameObjectMoveFunc move_func,
121
138
GameObjectSetMovementDeltaFunc
126
143
GameObjectGetIsCollideFunc get_is_collide_func
129
void game_object_set_class (GameObject * self, GameObjectClass * klass);
131
146
void game_object_draw (GameObject * self, SDL_Renderer * renderer);
133
148
void game_object_move (GameObject * self);
140
155
void game_object_set_callback (GameObject * self, char * name,
141
156
GameObjectCallbackFunc callback_func,
144
159
void game_object_do_callback (GameObject * self, char * name);