/+junk/c_sdl_joypad_ducktape

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/c_sdl_joypad_ducktape

« back to all changes in this revision

Viewing changes to src/GameObject.h

  • Committer: Gustav Hartvigsson
  • Date: 2014-09-02 20:15:48 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140902201548-h1kss1wdocqhs8df
* Fixed Makefile
* Changed all void * to _pointer in DynamicArray.[h,c].
* Fixed GameObject to work with the new base-type.
* Made the Object stuffs...
* added string_new_printf utility function in utils.[h,c]

* Derp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 * Function pointer declarations.
44
44
 *****************************************************************************/
45
45
 
46
 
typedef void (* GameObjectCallbackFunc)(GameObject * self, void * data);
 
46
typedef void (* GameObjectCallbackFunc)(GameObject * self, _pointer data);
47
47
 
48
48
typedef void (* GameObjectDrawFunc)(GameObject * self, SDL_Renderer * renderer);
49
49
 
51
51
 
52
52
typedef void (* GameObjectSetCallbackFunc)(GameObject * self, char * name,\
53
53
                                      GameObjectCallbackFunc callback_func,
54
 
                                      void * data);
 
54
                                      _pointer data);
55
55
 
56
56
typedef void (* GameObjectMoveFunc)(GameObject * self);
57
57
 
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
 *****************************************************************************/
108
110
 
109
111
/**
110
 
 * Initialises a GameObject.
111
 
 *
112
 
 * This should be run on every "sub instance" of a GameObject before the
 
112
 * Initialises a GameObject
 
113
 *
 
114
 * This function should be run on every "sub instance" of a GameObject.
 
115
 *
 
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.
 
118
 */
 
119
void game_object_initialize (GameObject * self, char * name, _pointer klass);
 
120
 
 
121
/**
 
122
 * Initialises a GameObjectClass.
 
123
 *
 
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.
 
126
 *
 
127
 * @warning Like <tt>object_class_initialize</tt> this does not allocate any
 
128
 * memory for the objects, that is left to the caller.
114
129
 */
115
 
void game_object_initialize (GameObject *               self,
 
130
void game_object_class_initialize (GameObjectClass *    klass,
 
131
                             NewFunc                    new_func,
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
127
144
                             );
128
145
 
129
 
void game_object_set_class (GameObject * self, GameObjectClass * klass);
130
 
 
131
146
void game_object_draw (GameObject * self, SDL_Renderer * renderer);
132
147
 
133
148
void game_object_move (GameObject * self);
139
154
 
140
155
void game_object_set_callback (GameObject * self, char * name,
141
156
                               GameObjectCallbackFunc callback_func,
142
 
                               void * data);
 
157
                               _pointer data);
143
158
 
144
159
void game_object_do_callback (GameObject * self, char * name);
145
160