Open Source Tomb Raider Engine
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

SDLSystem.h 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*!
  2. * \file include/SDLSystem.h
  3. * \brief SDL System interface implementation
  4. *
  5. * \author Mongoose
  6. */
  7. #ifndef _SDLSYSTEM_H_
  8. #define _SDLSYSTEM_H_
  9. #include <SDL2/SDL.h>
  10. #include <System.h>
  11. /*!
  12. * \brief SDL System interface implementation
  13. */
  14. class SDLSystem : public System {
  15. public:
  16. /*!
  17. * \brief Constructs an object of SDLSystem
  18. */
  19. SDLSystem();
  20. /*!
  21. * \brief Deconstructs an object of SDLSystem
  22. */
  23. virtual ~SDLSystem();
  24. /*!
  25. * \brief Get ticks
  26. * \returns number of milliseconds since start of program
  27. */
  28. virtual unsigned int getTicks();
  29. /*
  30. * \brief Sets Event binding Cmd to Key press
  31. * \param cmd valid command string
  32. * \param key valid keyboard code
  33. * \param event valid game event id
  34. */
  35. //! \fixme void bindKeyCommand(const char *cmd, int key, int event);
  36. /*!
  37. * \brief Renders string in OpenGL (2D projection).
  38. *
  39. * Requires Texture::glEnterMode2d() call before entry.
  40. *
  41. * System::bufferString(..) can cache printf() style calls
  42. * for use with this method.
  43. *
  44. * Call Texture::glExitMode2d after finishing calls to this method
  45. * and other 2D rendering.
  46. *
  47. * \param x valid X world coordinate
  48. * \param y valid Y world coordinate
  49. * \param string valid string
  50. *
  51. * \sa System::bufferString()
  52. * \sa Texture::glEnterMode2d()
  53. * \sa Texture::glExitMode2d()
  54. */
  55. void glPrintf2d(float x, float y, char *string);
  56. /*!
  57. * \brief Renders string in OpenGL (3D projection).
  58. *
  59. * System::bufferString(..) can cache printf() style calls
  60. * for use with this method.
  61. *
  62. * \param x valid X world coordinate
  63. * \param y valid Y world coordinate
  64. * \param z valid Z world coordinate
  65. * \param string valid string
  66. *
  67. * \sa System::bufferString()
  68. */
  69. void glPrintf3d(float x, float y, float z, char *string);
  70. /*!
  71. * \brief Start up video subsystem
  72. * \param width valid video mode width
  73. * \param height valid video mode height
  74. * \param fullscreen enables fullscreen rendering
  75. */
  76. void initVideo(unsigned int width, unsigned int height, bool fullscreen);
  77. /*!
  78. * \brief Resizes game window
  79. * \param width new width
  80. * \param height new height
  81. */
  82. void resize(unsigned int width, unsigned int height);
  83. /*!
  84. * \brief Start game loop
  85. */
  86. void runGame();
  87. void setGrabMouse(bool on);
  88. /*!
  89. * \brief Shuts down the game subsystems, exits game loop
  90. * \param i exit code
  91. */
  92. void shutdown(int i);
  93. /*!
  94. * \brief Swaps OpenGL buffers.
  95. * Call at end of frame.
  96. */
  97. void swapBuffersGL();
  98. /*!
  99. * \brief Toggle fullscreen windowing mode
  100. */
  101. void toggleFullscreen();
  102. protected:
  103. bool mFullscreen; //!< Current Fullscreen/Windowed mode
  104. private:
  105. SDL_Window *mWindow; //!< This is the pointer to the SDL surface
  106. SDL_GLContext mGLContext; //!< The OpenGL Context
  107. };
  108. #endif