Advertisement
Guest User

Untitled

a guest
Nov 30th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #include "SMenu.h"
  2. #include "../engine/gameengine.h"
  3. #include <SFML/Graphics.hpp>
  4. #include <assert.h>
  5. #include <iostream>
  6. SMenu SMenu::m_self;
  7. SMenu::SMenu()
  8. {
  9.  
  10. }
  11. SMenu::~SMenu()
  12. {
  13.  
  14. }
  15. void SMenu::Init()
  16. {
  17. if (!mov.openFromFile("rsc//mov//enders_game_rsc.mp4"))
  18. {
  19. exit(-33);
  20. }
  21. mov.play();
  22. }
  23. void SMenu::Cleanup()
  24. {
  25.  
  26. }
  27. void SMenu::Pause()
  28. {
  29. mov.pause();
  30. }
  31. void SMenu::Resume()
  32. {
  33. mov.play();
  34. }
  35. void SMenu::HandleEvents(CGameEngine* game)
  36. {
  37. sf::Event event;
  38. while (game->m_window->pollEvent(event))
  39. {
  40. if (event.type == sf::Event::Closed)
  41. {
  42. game->m_window->close();
  43. this->Cleanup();
  44. game->Quit();
  45. exit(0);
  46. }
  47. if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
  48. {
  49. game->m_window->close();
  50. this->Cleanup();
  51. game->Quit();
  52. exit(0);
  53. }
  54. }
  55. }
  56. void SMenu::Update(CGameEngine* game)
  57. {
  58. mov.update();
  59. }
  60. void SMenu::Draw(CGameEngine* game)
  61. {
  62. game->m_window->clear(BLACK);
  63. game->m_window->draw(mov);
  64. game->m_window->display();
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement