Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include "display.h"
  2.  
  3. namespace Display
  4. {
  5. sf::RenderWindow window;
  6. void init()
  7. {
  8. window.create(sf::VideoMode(WIDTH,HEIGHT), "SFML window");
  9. }
  10.  
  11. void clear()
  12. {
  13. window.clear();
  14. }
  15.  
  16. void drawObject(sf::Drawable* obj)
  17. {
  18. window.draw(*obj);
  19. }
  20.  
  21. void display()
  22. {
  23. window.display();
  24. }
  25.  
  26. void checkWindowEvents()
  27. {
  28. sf::Event e;
  29.  
  30. while(window.pollEvent(e))
  31. {
  32. if(e.type == sf::Event::Closed)
  33. {
  34. window.close();
  35. }
  36. }
  37. }
  38.  
  39. void setFPSCap(int fps)
  40. {
  41. window.setFramerateLimit(fps);
  42. }
  43.  
  44. bool isOpen()
  45. {
  46. return window.isOpen();
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement