GridVisualizer::~GridVisualizer() { al_destroy_font(mpFont); }
void finaliza_placar(Placar* placar) { al_destroy_font(placar->fonte); }
HUD::~HUD() { al_destroy_font(mpFont); }
void destroy_bouncing_name(struct bouncing_name *name) { al_destroy_font(name->font18); }
void Animation::UnloadContent() { al_destroy_font(font); alpha = NULL; position = std::pair<float, float>(0,0); }
int main(int argc, char **argv) { ALLEGRO_DISPLAY *display; ALLEGRO_TIMER *timer; ALLEGRO_EVENT_QUEUE *queue; int redraw = 0; double t = 0; if (!al_init()) { abort_example("Could not init Allegro.\n"); } open_log_monospace(); al_init_primitives_addon(); al_install_mouse(); al_init_font_addon(); al_init_ttf_addon(); al_init_image_addon(); init_platform_specific(); #ifdef ALLEGRO_IPHONE al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW); #endif display = al_create_display(640, 480); if (!display) { abort_example("Could not create display.\n"); } al_install_keyboard(); if (argc >= 2) { font_file = argv[1]; } ex.f1 = al_load_font(font_file, 48, 0); ex.f2 = al_load_font(font_file, 48, ALLEGRO_TTF_NO_KERNING); ex.f3 = al_load_font(font_file, 12, 0); /* Specifying negative values means we specify the glyph height * in pixels, not the usual font size. */ ex.f4 = al_load_font(font_file, -140, 0); ex.f5 = al_load_font(font_file, 12, ALLEGRO_TTF_MONOCHROME); { int ranges[] = {0x1F40A, 0x1F40A}; ALLEGRO_BITMAP *icon = al_load_bitmap("data/icon.png"); ALLEGRO_BITMAP *glyph = al_create_bitmap(50, 50); al_set_target_bitmap(glyph); al_clear_to_color(al_map_rgba_f(0, 0, 0, 0)); al_draw_rectangle(0.5, 0.5, 49.5, 49.5, al_map_rgb_f(1, 1, 0), 1); al_draw_bitmap(icon, 1, 1, 0); al_set_target_backbuffer(display); ex.f_alex = al_grab_font_from_bitmap(glyph, 1, ranges); } if (!ex.f1 || !ex.f2 || !ex.f3 || !ex.f4 || !ex.f_alex) { abort_example("Could not load font: %s\n", font_file); } al_set_fallback_font(ex.f3, ex.f_alex); ex.ranges_count = al_get_font_ranges(ex.f1, 0, NULL); print_ranges(ex.f1); ex.config = al_load_config_file("data/ex_ttf.ini"); if (!ex.config) { abort_example("Could not data/ex_ttf.ini\n"); } timer = al_create_timer(1.0 / 60); queue = al_create_event_queue(); al_register_event_source(queue, al_get_keyboard_event_source()); al_register_event_source(queue, al_get_display_event_source(display)); al_register_event_source(queue, al_get_timer_event_source(timer)); al_start_timer(timer); while (true) { ALLEGRO_EVENT event; al_wait_for_event(queue, &event); if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) break; if (event.type == ALLEGRO_EVENT_KEY_DOWN && event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { break; } if (event.type == ALLEGRO_EVENT_TIMER) redraw++; while (redraw > 0 && al_is_event_queue_empty(queue)) { double dt; redraw--; dt = al_get_time(); render(); dt = al_get_time() - dt; t = 0.99 * t + 0.01 * dt; ex.fps = 1.0 / t; al_flip_display(); } } al_destroy_font(ex.f1); al_destroy_font(ex.f2); al_destroy_font(ex.f3); al_destroy_font(ex.f4); al_destroy_font(ex.f5); al_destroy_config(ex.config); close_log(false); return 0; }