您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

78 行
1.5 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 HAVE_GLES_2X
  18. # include "eglapp.h"
  19. #else
  20. # include "platform/sdl/sdlapp.h"
  21. # include "platform/sdl/sdlinput.h"
  22. #endif
  23. using namespace std;
  24. namespace lol
  25. {
  26. class ApplicationData
  27. {
  28. friend class Application;
  29. ApplicationData(char const *name, ivec2 resolution, float framerate)
  30. : app(name, resolution, framerate)
  31. { }
  32. #if defined __CELLOS_LV2__
  33. Ps3App app;
  34. #elif defined HAVE_GLES_2X
  35. /* FIXME: this macro is only deactivated if we include "lolgl.h" */
  36. EglApp app;
  37. #elif defined HAVE_SDL_H
  38. SdlApp app;
  39. #else
  40. # error No application class available on this platform
  41. #endif
  42. };
  43. /*
  44. * Public Application class
  45. */
  46. Application::Application(char const *name, ivec2 resolution, float framerate)
  47. {
  48. data = new ApplicationData(name, resolution, framerate);
  49. }
  50. void Application::ShowPointer(bool show)
  51. {
  52. data->app.ShowPointer(show);
  53. }
  54. void Application::Run()
  55. {
  56. data->app.Run();
  57. }
  58. Application::~Application()
  59. {
  60. delete data;
  61. }
  62. } /* namespace lol */