50 righe
1.0 KiB

  1. // Test stuff
  2. #include <SDL.h>
  3. #include <stdio.h>
  4. #include <math.h>
  5. #include "sdlvideo.h"
  6. #include "game.h"
  7. int main(int argc, char **argv)
  8. {
  9. Video *video = new SdlVideo("Deus Hax", 640, 480);
  10. Game *game = new Game("maps/testmap.tmx");
  11. for (int done = 0; !done; )
  12. {
  13. video->PreRender();
  14. /* Test stuff */
  15. int mx, my;
  16. SDL_GetMouseState(&mx, &my);
  17. game->SetMouse(mx * (640 - 32) / 640, my * (480 - 32) / 480);
  18. game->Render();
  19. video->PostRender(33.33333f);
  20. /* This could go in a separate function */
  21. SDL_Event event;
  22. while (SDL_PollEvent(&event))
  23. {
  24. if (event.type == SDL_QUIT)
  25. done = 1;
  26. if (event.type == SDL_KEYDOWN)
  27. {
  28. if (event.key.keysym.sym == SDLK_RETURN)
  29. video->FullScreen();
  30. else if (event.key.keysym.sym == SDLK_ESCAPE)
  31. done = 1;
  32. }
  33. }
  34. }
  35. delete game;
  36. delete video;
  37. return EXIT_SUCCESS;
  38. }