Advertisement
Guest User

Code Fail

a guest
Mar 3rd, 2016
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. #include <allegro.h>
  2. #include <string>
  3. #define ScreenWidth 1025
  4. #define ScreenHeight 555
  5.  
  6. volatile long timer = 0;
  7. void Increment(){timer++;}
  8. END_OF_FUNCTION(Increment);
  9.  
  10. volatile bool closeWindow = false;
  11. void CloseButtonCallback(){closeWindow = true;}
  12. END_OF_FUNCTION(CloseButtonCallBack);
  13.  
  14.  
  15. int main(void)
  16. {
  17. allegro_init(); //Allegro initialise funtions
  18. install_keyboard();
  19. install_mouse();
  20. install_timer();
  21. install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, "A");
  22. set_color_depth(32);
  23. set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1025, 555, 0, 0);
  24. set_window_title("Game");
  25. clear_to_color(screen, makecol(255,0,255));
  26.  
  27. LOCK_FUNCTION(Increment);
  28. LOCK_VARIABLE(timer);
  29. LOCK_FUNCTION(closeButtonCallBack);
  30. LOCK_VARIABLE(closeWindow);
  31.  
  32. install_int_ex(Increment, BPS_TO_TIMER(100));
  33. set_close_button_callback(CloseButtonCallback);
  34.  
  35. int Position[2] = {ScreenWidth/2, ScreenHeight/2};
  36. int moveSpeed = 5;
  37.  
  38. std::string Word = "lol";
  39.  
  40.  
  41.  
  42. // BITMAP *Buffer = create_bitmap (ScreenWidth, ScreenHeight);
  43.  
  44.  
  45. while(!closeWindow){
  46.  
  47. while(timer > 0){
  48.  
  49. if(key[KEY_ESC])
  50. closeWindow = true;
  51.  
  52. textout_centre_ex(screen, font, Word.c_str(), Position[0], Position[1], 255, -1);
  53. // blit(Buffer, screen, 0, 0, 0, 0, ScreenWidth, ScreenHeight);
  54. rest(20);
  55. clear_bitmap(screen);
  56. }
  57. timer--;
  58. }
  59. // destroy_bitmap(Buffer);
  60. allegro_exit();
  61. return 0;
  62.  
  63. }
  64. END_OF_MAIN()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement