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 2.9KB

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