/+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.c

  • Committer: Gustav Hartvigsson
  • Date: 2014-09-03 11:46:19 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140903114619-dhevqw0pmfdbbkvn
* Removed code that is not needed
* created a way te determin if a object is visible or not
* Started to document undocumented code

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 * Author Gustav Hartvigsson <gustav.hartvigsson _at_ gmail.com> 2014
13
13
 */
14
14
 
 
15
void _game_object_private_set_visible (GameObject * self , bool visible);
 
16
bool _game_object_private_get_visible (GameObject * self);
 
17
 
15
18
void game_object_class_initialize (GameObjectClass *    klass,
16
19
                             NewFunc                    new_func,
17
20
                             FreeFunc                   free_func,
26
29
                             GameObjectGetBoundingBoxFunc
27
30
                                                        get_bounding_box_func,
28
31
                             GameObjectGetIsAliveFunc   get_is_alive_func,
29
 
                             GameObjectGetIsCollideFunc get_is_collide_func) {
 
32
                             GameObjectGetIsCollideFunc get_is_collide_func,
 
33
                             GameObjectSetVisibleFunc   set_visible_func,
 
34
                             GameObjectGetVisibleFunc   get_visible_func) {
30
35
  
31
36
  /* First things first, we need to initialise the Object base class. */
32
37
  ObjectClass * objkls = (ObjectClass *) klass;
42
47
  klass->get_is_alive_func = get_is_alive_func;
43
48
  klass->get_is_collide_func = get_is_collide_func;
44
49
  
 
50
  if (set_visible_func == NULL) {
 
51
    klass->set_visible_func =  _game_object_private_set_visible;
 
52
  } else {
 
53
    klass->set_visible_func = set_visible_func;
 
54
  }
 
55
  
 
56
  if (get_visible_func == NULL) {
 
57
    klass->get_visible_func =  _game_object_private_get_visible;
 
58
  } else {
 
59
    klass->get_visible_func = get_visible_func;
 
60
  }
 
61
  
45
62
  /* We are done. */
46
63
}
47
64
 
93
110
  return ret;
94
111
}
95
112
 
96
 
 
 
113
void game_object_set_visible (GameObject * self, bool visible) {
 
114
  Object * obj = (Object *) self;
 
115
  GameObjectClass * klass = (GameObjectClass *) obj->klass;
 
116
  GameObjectSetVisibleFunc set_visible_func = klass->set_visible_func;
 
117
  set_visible_func (self, visible);
 
118
}
 
119
 
 
120
bool game_object_get_visible (GameObject * self) {
 
121
  Object * obj = (Object *) self;
 
122
  GameObjectClass * klass = (GameObjectClass *) obj->klass;
 
123
  GameObjectGetVisibleFunc get_visible_func = klass->get_visible_func;
 
124
  return get_visible_func (self);
 
125
}
 
126
 
 
127
#if 0
97
128
/******************************************************************************/
98
129
 
99
130
 
152
183
  GameObjectClass * klass = (GameObjectClass *) obj->klass;
153
184
  klass->get_is_collide_func = get_is_collide_func;
154
185
}
 
186
#endif
 
187
 
 
188
/* ****************************************************************************/
 
189
void _game_object_private_set_visible (GameObject * self , bool visible) {
 
190
  self->visible = visible;
 
191
}
 
192
 
 
193
bool _game_object_private_get_visible (GameObject * self) {
 
194
  return self->visible;
 
195
}
155
196
 
156
197
/**  MOOOOO!  **/