Revision 313
organizing fonts
proj.c | ||
---|---|---|
49 | 49 |
return 0; |
50 | 50 |
} |
51 | 51 |
|
52 |
font_t *consolas = NULL; |
|
53 | 52 |
basic_sprite_t *bsp_crosshair = NULL; |
54 | 53 |
basic_sprite_t *bsp_shooter = NULL; |
55 | 54 |
basic_sprite_t *bsp_zombie = NULL; |
... | ... | |
66 | 65 |
|
67 | 66 |
int r; |
68 | 67 |
|
69 |
consolas = font_ctor("/home/lcom/labs/proj/media/font/Consolas/xpm2"); |
|
70 |
if(consolas == NULL){ printf("Failed to load consolas\n"); return 1; } |
|
68 |
if(font_init()){ printf("Failed to initialize fonts\n"); return 1; } |
|
71 | 69 |
|
72 | 70 |
/// subscribe interrupts |
73 | 71 |
if (subscribe_all()) { return 1; } |
... | ... | |
82 | 80 |
/// Load stuff |
83 | 81 |
{ |
84 | 82 |
graph_clear_screen(); |
85 |
text_t *txt = text_ctor(consolas, "Loading...");
|
|
83 |
text_t *txt = text_ctor(default_font, "Loading...");
|
|
86 | 84 |
text_set_pos(txt, graph_get_XRes()/2, graph_get_YRes()/2); |
87 | 85 |
text_set_valign(txt, text_valign_center); |
88 | 86 |
text_set_halign(txt, text_halign_center); |
... | ... | |
102 | 100 |
sp_crosshair = sprite_ctor(bsp_crosshair); if(sp_crosshair == NULL) printf("Failed to get crosshair sprite\n"); |
103 | 101 |
} |
104 | 102 |
|
105 |
menu_t *main_menu = menu_ctor(consolas);
|
|
103 |
menu_t *main_menu = menu_ctor(default_font);
|
|
106 | 104 |
menu_add_item(main_menu, "Single player"); |
107 | 105 |
menu_add_item(main_menu, "Multiplayer"); |
108 | 106 |
menu_add_item(main_menu, "Chat"); |
... | ... | |
167 | 165 |
basic_sprite_dtor (bsp_pistol ); bsp_pistol = NULL; |
168 | 166 |
basic_sprite_dtor (bsp_nothing ); bsp_nothing = NULL; |
169 | 167 |
map_dtor (map1 ); map1 = NULL; |
170 |
font_dtor (consolas ); consolas = NULL;
|
|
168 |
if(font_free()){ printf("Failed to free fonts\n"); return 1; }
|
|
171 | 169 |
|
172 | 170 |
// Unsubscribe interrupts |
173 | 171 |
if (unsubscribe_all()) { |
... | ... | |
207 | 205 |
static int (multiplayer)(void) { |
208 | 206 |
int r; |
209 | 207 |
|
210 |
menu_t *main_menu = menu_ctor(consolas);
|
|
208 |
menu_t *main_menu = menu_ctor(default_font);
|
|
211 | 209 |
menu_add_item(main_menu, "Create"); |
212 | 210 |
menu_add_item(main_menu, "Connect"); |
213 | 211 |
menu_add_item(main_menu, "Back"); |
... | ... | |
272 | 270 |
nctp_set_processor(multiplayer_process);/* |
273 | 271 |
|
274 | 272 |
ent_set_scale(DEFAULT_SCALE); |
275 |
text_timer_t *in_game_timer = timer_ctor(consolas);
|
|
273 |
text_timer_t *in_game_timer = timer_ctor(default_font);
|
|
276 | 274 |
|
277 | 275 |
list_t *shooter_list = list_ctor(); |
278 | 276 |
|
... | ... | |
336 | 334 |
nctp_set_processor(multiplayer_process); |
337 | 335 |
|
338 | 336 |
ent_set_scale(DEFAULT_SCALE); |
339 |
text_timer_t *in_game_timer = timer_ctor(consolas);
|
|
337 |
text_timer_t *in_game_timer = timer_ctor(default_font);
|
|
340 | 338 |
|
341 | 339 |
list_t *shooter_list = list_ctor(); |
342 | 340 |
|
... | ... | |
400 | 398 |
|
401 | 399 |
int r; |
402 | 400 |
|
403 |
menu_t *main_menu = menu_ctor(consolas);
|
|
401 |
menu_t *main_menu = menu_ctor(default_font);
|
|
404 | 402 |
menu_add_item(main_menu, "Campaign"); |
405 | 403 |
menu_add_item(main_menu, "Zombies"); |
406 | 404 |
menu_add_item(main_menu, "Back"); |
... | ... | |
464 | 462 |
int r; |
465 | 463 |
|
466 | 464 |
ent_set_scale(DEFAULT_SCALE); |
467 |
text_timer_t *in_game_timer = timer_ctor(consolas);
|
|
465 |
text_timer_t *in_game_timer = timer_ctor(default_font);
|
|
468 | 466 |
|
469 | 467 |
list_t *shooter_list = list_ctor(); |
470 | 468 |
|
... | ... | |
572 | 570 |
int r; |
573 | 571 |
|
574 | 572 |
ent_set_scale(DEFAULT_SCALE); |
575 |
text_timer_t *in_game_timer = timer_ctor(consolas);
|
|
573 |
text_timer_t *in_game_timer = timer_ctor(default_font);
|
|
576 | 574 |
|
577 | 575 |
list_t *shooter_list = list_ctor(); |
578 | 576 |
|
... | ... | |
751 | 749 |
rectangle_set_fill_trans(r_buffer, GRAPH_TRANSPARENT); |
752 | 750 |
} |
753 | 751 |
text_t *t_buffer = NULL; { |
754 |
t_buffer = text_ctor(consolas, "");
|
|
752 |
t_buffer = text_ctor(default_font, "");
|
|
755 | 753 |
text_set_pos(t_buffer, rectangle_get_x(r_buffer)+50, |
756 | 754 |
rectangle_get_y(r_buffer)+rectangle_get_h(r_buffer)/2); |
757 | 755 |
text_set_halign(t_buffer, text_halign_left); |
... | ... | |
759 | 757 |
text_set_color (t_buffer, TEXT_COLOR); |
760 | 758 |
} |
761 | 759 |
text_t *t_size = NULL; { |
762 |
t_size = text_ctor(consolas, "");
|
|
760 |
t_size = text_ctor(default_font, "");
|
|
763 | 761 |
text_set_pos(t_size, rectangle_get_x(r_buffer)+rectangle_get_w(r_buffer)-5, |
764 | 762 |
rectangle_get_y(r_buffer)+rectangle_get_h(r_buffer)-5); |
765 | 763 |
text_set_halign(t_size, text_halign_right); |
... | ... | |
782 | 780 |
} |
783 | 781 |
/** t_text */ { |
784 | 782 |
for(size_t i = 0; i < CHAT_MAX_NUM; ++i){ |
785 |
t_text[i] = text_ctor(consolas, " ");
|
|
783 |
t_text[i] = text_ctor(default_font, " ");
|
|
786 | 784 |
text_set_pos(t_text[i], rectangle_get_x(r_text)+50, |
787 | 785 |
rectangle_get_y(r_text)+rectangle_get_h(r_text)-30-25*i); |
788 | 786 |
text_set_halign(t_text[i], text_halign_left); |
Also available in: Unified diff