/+junk/c_sdl_joypad

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/c_sdl_joypad
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
1
#ifndef __H_GAME_OBJECT__
2
#define __H_GAME_OBJECT__
3
4
#include <SDL2/SDL.h>
5
#include <stdbool.h>
6
7
typedef struct _GameObject GameObject;
8
9
typedef struct _GameObjectClass GameObjectClass;
10
11
typedef struct _GameObjectPriv GameObjectPriv;
12
13
14
/******************************************************************************
15
 * Function pointer declarations.
16
 *****************************************************************************/
17
 
18
typedef void (* GameObjectCallbackFunc)(GameObject * self, void * data);
19
20
typedef void (* GameObjectFreeFunc)(GameObject * self);
21
22
typedef void (* GameObjectDrawFunc)(GameObject * self, SDL_Renderer * renderer);
23
24
typedef void (* GameObjectCallbackHandlerFunc)(GameObject * self, char * name);
25
26
typedef void (* GameObjectSetCallbackFunc)(GameObject * self, char * name,\
4 by Gustav Hartvigsson
What I have done:
27
                                      GameObjectCallbackFunc callback_func,
5 by Gustav Hartvigsson
fixed the callback stuff..
28
                                      void * data);
29
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
30
typedef void (* GameObjectDoCallbackFunc)(GameObject * self, char * name);
4 by Gustav Hartvigsson
What I have done:
31
32
typedef void (* GameObjectMoveFunc)(GameObject * self);
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
33
34
typedef void (* GameObjectSetMovementDeltaFunc)(GameObject * self, int delta_x,\
35
                                      int delta_y, Uint32 time_delta);
36
37
typedef SDL_Rect (* GameObjectGetBoundingBoxFunc)(GameObject * self);
38
39
typedef bool (* GameObjectGetIsAliveFunc)(GameObject * self);
40
41
typedef bool (* GameObjectGetIsCollideFunc)(GameObject * self,
4 by Gustav Hartvigsson
What I have done:
42
                                            GameObject * other);
43
44
/******************************************************************************
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
45
 * Object declaration.
46
 *****************************************************************************/
47
48
struct _GameObjectClass {
49
  GameObjectFreeFunc                     free_func;
50
  GameObjectDrawFunc                     draw_func;
51
  GameObjectCallbackHandlerFunc          callback_handler_func;
52
  GameObjectSetCallbackFunc              set_callback_func;
4 by Gustav Hartvigsson
What I have done:
53
  GameObjectMoveFunc                     move_func;
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
54
  GameObjectSetMovementDeltaFunc         set_movement_delta_func;
55
  GameObjectGetBoundingBoxFunc           get_bounding_box_func;
56
  GameObjectGetIsAliveFunc               get_is_alive_func;
57
  GameObjectGetIsCollideFunc             get_is_collide_func;
4 by Gustav Hartvigsson
What I have done:
58
};
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
59
60
struct _GameObjectPriv {}; /**< prototype for the private data */
61
62
struct _GameObject {
63
  GameObjectClass *      klass; /**< the class that holds all the virtual
64
                                  * functions. */
65
  GameObjectPriv *       priv; /**< The private data. */
66
};
67
68
/******************************************************************************
69
 * Game Object base functions.
70
 *****************************************************************************/
71
void game_object_free (GameObject * self);
72
73
GameObjectClass * game_object_get_class (GameObject * self);
74
75
void game_object_set_class (GameObject * self, GameObjectClass * klass);
76
77
void game_object_draw (GameObject * self, SDL_Renderer * renderer);
78
79
void game_object_move (GameObject * self);
80
81
void game_object_set_movement_delta (GameObject * self, int delta_x,
4 by Gustav Hartvigsson
What I have done:
82
                                                     int delta_y, uint32_t d_t);
83
84
bool game_object_get_is_alive (GameObject * self);
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
85
86
void game_object_set_callback (GameObject * self, char * name,
4 by Gustav Hartvigsson
What I have done:
87
                               GameObjectCallbackFunc callback_func,
5 by Gustav Hartvigsson
fixed the callback stuff..
88
                               void * data);
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
89
90
void game_object_do_callback (GameObject * self, char * name);
4 by Gustav Hartvigsson
What I have done:
91
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
92
93
/******************************************************************************
94
 * Game Object set virtual function functions.
95
 *****************************************************************************/
96
97
void game_object_set_free_func (GameObject * self,
98
                                GameObjectFreeFunc free_func);
99
100
void game_object_set_draw_func (GameObject * self,
101
                                GameObjectDrawFunc draw_func);
102
103
void game_object_set_callback_handler_func (GameObject * self,
104
                           GameObjectCallbackHandlerFunc callback_handler_func);
105
106
void game_object_set_add_callback_func (GameObject * self,
107
                                   GameObjectSetCallbackFunc add_callback_func);
4 by Gustav Hartvigsson
What I have done:
108
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
109
void game_object_set_move_func (GameObject * self,
110
                                GameObjectMoveFunc move_func);
111
112
void game_object_set_set_move_delta_func (GameObject * self,
113
                          GameObjectSetMovementDeltaFunc set_movent_delta_func);
114
115
void game_object_set_get_bounding_box_func (GameObject * self,
116
                            GameObjectGetBoundingBoxFunc get_bounding_box_func);
117
118
void game_object_set_movment_delta (GameObject * self, int delta_x,
119
                                    int delta_y, uint32_t delta_time);
4 by Gustav Hartvigsson
What I have done:
120
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
121
void game_object_set_get_is_alive_func (GameObject * self,
122
                                    GameObjectGetIsAliveFunc get_is_alive_func);
123
124
void game_object_set_is_collide_func (GameObject * self,
4 by Gustav Hartvigsson
What I have done:
125
                                   GameObjectGetIsCollideFunc is_collide_func);
126
#endif /* __H_GAME_OBJECT__ */
3 by Gustav Hartvigsson
Added the skeliton for game objects that. They can be used as a basis for a
127