82 line
1.6 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://sam.zoy.org/projects/COPYING.WTFPL for more details.
  9. //
  10. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include "core.h"
  14. #include "lolgl.h"
  15. #if defined __CELLOS_LV2__
  16. # include "platform/ps3/ps3app.h"
  17. #elif defined __native_client__
  18. # include "platform/nacl/naclapp.h"
  19. #elif defined HAVE_GLES_2X
  20. # include "eglapp.h"
  21. #else
  22. # include "platform/sdl/sdlapp.h"
  23. # include "platform/sdl/sdlinput.h"
  24. #endif
  25. using namespace std;
  26. namespace lol
  27. {
  28. class ApplicationData
  29. {
  30. friend class Application;
  31. ApplicationData(char const *name, ivec2 resolution, float framerate)
  32. : app(name, resolution, framerate)
  33. { }
  34. #if defined __CELLOS_LV2__
  35. Ps3App app;
  36. #elif defined __native_client__
  37. NaClApp app;
  38. #elif defined HAVE_GLES_2X
  39. /* FIXME: this macro is only deactivated if we include "lolgl.h" */
  40. EglApp app;
  41. #elif defined HAVE_SDL_H
  42. SdlApp app;
  43. #else
  44. # error No application class available on this platform
  45. #endif
  46. };
  47. /*
  48. * Public Application class
  49. */
  50. Application::Application(char const *name, ivec2 resolution, float framerate)
  51. {
  52. data = new ApplicationData(name, resolution, framerate);
  53. }
  54. void Application::ShowPointer(bool show)
  55. {
  56. data->app.ShowPointer(show);
  57. }
  58. void Application::Run()
  59. {
  60. data->app.Run();
  61. }
  62. Application::~Application()
  63. {
  64. delete data;
  65. }
  66. } /* namespace lol */