Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

SDLSystem.h 3.0KB

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