Advertisement
Guest User

Untitled

a guest
Sep 5th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include "CApp.h"
  2.  
  3. CApp::CApp()
  4. {
  5. gameWindow = NULL;
  6. gameRenderer = NULL;
  7. testSurface = NULL;
  8. testImg = NULL;
  9.  
  10. Running = true;
  11. }
  12.  
  13. int CApp::OnExecute()
  14. {
  15. if(OnInit() == false)
  16. {
  17. return -1;
  18. }
  19.  
  20. //Image Details
  21. testSurface = SDL_LoadBMP("myimage.bmp");
  22. testImg = SDL_CreateTextureFromSurface(gameRenderer, testSurface);
  23. SDL_FreeSurface(testSurface);
  24.  
  25. testRect.x = 640/2; testRect.y = 480/2; testRect.w = 50; testRect.h = 50;
  26.  
  27. //Events
  28. SDL_Event Event;
  29.  
  30. while(Running)
  31. {
  32. while(SDL_PollEvent(&Event))
  33. {
  34. OnEvent(&Event);
  35. }
  36.  
  37. OnLoop();
  38. OnRender();
  39. }
  40.  
  41. OnCleanup();
  42.  
  43. return 0;
  44. }
  45.  
  46. int main(int argc, char* argv[])
  47. {
  48. CApp theApp;
  49.  
  50. return theApp.OnExecute();
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement