|
|
| trying to move font.... |
|
PCwizard200
Member #16,127
December 2015
|
Hy everybody, instead of doing the typical bitmap moving experiment, I am trying to move a font phrase. I am simply doing this for training, but I am stuck and although it would be easier for me to just move a bitmap, I figure It would be more educational if I learn how to do more unique things with fonts, like move it. I even tried putting my font_x and font_y variables in the parenthasies of my al_draw_text statement. Any help would be very good and thank you in advance. #define ALLEGRO_STATICLINK enum KEYS{UP, DOWN, LEFT, RIGHT}; int main(void){ ALLEGRO_DISPLAY *display = NULL; al_init(); ALLEGRO_FONT *font10 = al_load_font("ARDESTINE.ttf", 24, 0); al_get_display_mode(al_get_num_display_modes() - 1, &disp_data); if (ev.type == ALLEGRO_EVENT_KEY_DOWN){ case ALLEGRO_KEY_UP: case ALLEGRO_KEY_DOWN: case ALLEGRO_KEY_LEFT: case ALLEGRO_KEY_RIGHT: case ALLEGRO_KEY_ESCAPE: case ALLEGRO_KEY_UP: case ALLEGRO_KEY_DOWN: case ALLEGRO_KEY_LEFT: case ALLEGRO_KEY_RIGHT: case ALLEGRO_KEY_ESCAPE: } if (keys[UP]){ if (keys[LEFT]){ if (keys[RIGHT]){ al_draw_text(font10, al_map_rgb(233,100,90),50,50,0,"Hy! Move me around please!"); al_clear_to_color(al_map_rgb(0,0,0)); al_rest(15);
|
|
Mark Oates
Member #1,146
March 2001
|
Awe man, you're so close! Right now you have: al_draw_text(font10, al_map_rgb(233,100,90),50,50,0,"Hy! Move me around please!"); al_clear_to_color(al_map_rgb(0,0,0)); al_flip_display(); So you are 1) drawing the text, then 2) completely clearing the screen, then 3) flipping the cleared screen to the display. Fix that and I think you'll be able to solve the rest no problem. -- |
|
PCwizard200
Member #16,127
December 2015
|
Thanks! Sorry for the late reply I was very busy, any way I shall now fix my code in a jiff.
|
|
|