Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <allegro.h>
- #include <string>
- #define ScreenWidth 1025
- #define ScreenHeight 555
- volatile long timer = 0;
- void Increment(){timer++;}
- END_OF_FUNCTION(Increment);
- volatile bool closeWindow = false;
- void CloseButtonCallback(){closeWindow = true;}
- END_OF_FUNCTION(CloseButtonCallBack);
- int main(void)
- {
- allegro_init(); //Allegro initialise funtions
- install_keyboard();
- install_mouse();
- install_timer();
- install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, "A");
- set_color_depth(32);
- set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1025, 555, 0, 0);
- set_window_title("Game");
- clear_to_color(screen, makecol(255,0,255));
- LOCK_FUNCTION(Increment);
- LOCK_VARIABLE(timer);
- LOCK_FUNCTION(closeButtonCallBack);
- LOCK_VARIABLE(closeWindow);
- install_int_ex(Increment, BPS_TO_TIMER(100));
- set_close_button_callback(CloseButtonCallback);
- int Position[2] = {ScreenWidth/2, ScreenHeight/2};
- int moveSpeed = 5;
- std::string Word = "lol";
- // BITMAP *Buffer = create_bitmap (ScreenWidth, ScreenHeight);
- while(!closeWindow){
- while(timer > 0){
- if(key[KEY_ESC])
- closeWindow = true;
- textout_centre_ex(screen, font, Word.c_str(), Position[0], Position[1], 255, -1);
- // blit(Buffer, screen, 0, 0, 0, 0, ScreenWidth, ScreenHeight);
- rest(20);
- clear_bitmap(screen);
- }
- timer--;
- }
- // destroy_bitmap(Buffer);
- allegro_exit();
- return 0;
- }
- END_OF_MAIN()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement