Revision 294
trying to isolate game
proj/src/proj.c | ||
---|---|---|
29 | 29 |
#include "bullet.h" |
30 | 30 |
#include "map1.h" |
31 | 31 |
|
32 |
#include "errors.h" |
|
33 |
|
|
32 | 34 |
#include "list.h" |
33 | 35 |
|
34 | 36 |
int main(int argc, char* argv[]) { |
... | ... | |
46 | 48 |
return 0; |
47 | 49 |
} |
48 | 50 |
|
51 |
font_t *consolas = NULL; |
|
52 |
basic_sprite_t *bsp_crosshair = NULL; |
|
53 |
basic_sprite_t *bsp_shooter = NULL; |
|
54 |
basic_sprite_t *bsp_pistol = NULL; |
|
55 |
basic_sprite_t *bsp_nothing = NULL; |
|
56 |
basic_sprite_t *bsp_bullet = NULL; |
|
57 |
map_t *map1 = NULL; |
|
58 |
sprite_t *sp_crosshair = NULL; |
|
59 |
|
|
60 |
static int (game)(void); |
|
61 |
|
|
49 | 62 |
int(proj_main_loop)(int argc, char *argv[]) { |
50 | 63 |
|
51 | 64 |
int r; |
52 | 65 |
|
53 |
font_t *consolas = font_ctor("/home/lcom/labs/proj/media/font/Consolas/xpm2");
|
|
66 |
consolas = font_ctor("/home/lcom/labs/proj/media/font/Consolas/xpm2"); |
|
54 | 67 |
if(consolas == NULL){ printf("Failed to load consolas\n"); return 1; } |
55 | 68 |
|
56 | 69 |
/// subscribe interrupts |
... | ... | |
66 | 79 |
#endif |
67 | 80 |
|
68 | 81 |
/// Load stuff |
69 |
basic_sprite_t *bsp_crosshair = NULL; |
|
70 |
basic_sprite_t *bsp_shooter = NULL; |
|
71 |
basic_sprite_t *bsp_pistol = NULL; |
|
72 |
basic_sprite_t *bsp_nothing = NULL; |
|
73 |
basic_sprite_t *bsp_bullet = NULL; |
|
74 |
map_t *map1 = NULL; |
|
75 |
sprite_t *sp_crosshair = NULL; |
|
76 | 82 |
{ |
77 | 83 |
#ifndef DIOGO |
78 | 84 |
graph_clear_screen(); |
... | ... | |
120 | 126 |
|
121 | 127 |
#ifndef DIOGO |
122 | 128 |
//uint32_t refresh_count_value = sys_hz() / REFRESH_RATE; |
123 |
double angle; // mouse angle |
|
124 |
int32_t *mouse_x = get_mouse_X(), *mouse_y = get_mouse_Y(); |
|
125 | 129 |
uint8_t last_lb = 0; |
126 | 130 |
struct packet pp; |
127 | 131 |
keys_t *keys = get_key_presses(); |
... | ... | |
163 | 167 |
graph_clear_screen(); |
164 | 168 |
switch(menu_update_state(main_menu, click)){ |
165 | 169 |
case -1: game_state = MENU; break; |
166 |
case 0: game_state = GAME; break; |
|
170 |
case 0: game_state = GAME; game(); break;
|
|
167 | 171 |
case 1: game_state = TEST; break; |
168 | 172 |
case 2: game_state = EXIT; break; |
169 | 173 |
} |
... | ... | |
171 | 175 |
|
172 | 176 |
click = 0; |
173 | 177 |
|
174 |
sprite_set_pos(sp_crosshair, *mouse_x, *mouse_y);
|
|
178 |
sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
|
|
175 | 179 |
sprite_draw(sp_crosshair); |
176 | 180 |
graph_draw(); |
177 | 181 |
break; |
... | ... | |
182 | 186 |
update_game_state(map1, shooter_list, bullet_list); |
183 | 187 |
|
184 | 188 |
//update_scale(); |
185 |
angle = get_mouse_angle(shooter1); |
|
189 |
double angle = get_mouse_angle(shooter1);
|
|
186 | 190 |
gunner_set_angle(shooter1, angle - M_PI_2); |
187 | 191 |
|
188 | 192 |
ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0, |
... | ... | |
195 | 199 |
|
196 | 200 |
text_draw(in_game_timer->text); |
197 | 201 |
|
198 |
sprite_set_pos(sp_crosshair, *mouse_x, *mouse_y);
|
|
202 |
sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
|
|
199 | 203 |
sprite_draw(sp_crosshair); |
200 | 204 |
graph_draw(); |
201 | 205 |
break; |
... | ... | |
321 | 325 |
|
322 | 326 |
return 0; |
323 | 327 |
} |
328 |
|
|
329 |
static int (game)(void){ |
|
330 |
return SUCCESS; |
|
331 |
} |
Also available in: Unified diff