Open Source Tomb Raider Engine
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
  2. /*================================================================
  3. *
  4. * Project : OpenRaider
  5. * Author : Terry 'Mongoose' Hendrix II
  6. * Website : http://www.westga.edu/~stu7440/
  7. * Email : stu7440@westga.edu
  8. * Object : SDLSystem
  9. * License : No use w/o permission (C) 2002 Mongoose
  10. * Comments:
  11. *
  12. *
  13. * This file was generated using Mongoose's C++
  14. * template generator script. <stu7440@westga.edu>
  15. *
  16. *-- History ------------------------------------------------
  17. *
  18. * 2002.06.06:
  19. * Mongoose - Created
  20. ================================================================*/
  21. #ifndef _SDLSYSTEM_H_
  22. #define _SDLSYSTEM_H_
  23. #ifdef SDL_INTERFACE
  24. # include <SDL/SDL.h>
  25. #else
  26. # error "SDLSystem requires -DSDL_INTERFACE"
  27. #endif
  28. #include <System.h>
  29. class SDLSystem : public System
  30. {
  31. public:
  32. ////////////////////////////////////////////////////////////
  33. // Constructors
  34. ////////////////////////////////////////////////////////////
  35. SDLSystem();
  36. /*------------------------------------------------------
  37. * Pre :
  38. * Post : Constructs an object of SDLSystem
  39. *
  40. *-- History ------------------------------------------
  41. *
  42. * 2002.06.06:
  43. * Mongoose - Created
  44. ------------------------------------------------------*/
  45. virtual ~SDLSystem();
  46. /*------------------------------------------------------
  47. * Pre : SDL object is allocated
  48. * Post : Deconstructs an object of SDLSystem
  49. *
  50. *-- History ------------------------------------------
  51. *
  52. * 2002.06.06:
  53. * Mongoose - Created
  54. ------------------------------------------------------*/
  55. ////////////////////////////////////////////////////////////
  56. // Public Accessors
  57. ////////////////////////////////////////////////////////////
  58. virtual unsigned int getTicks();
  59. /*------------------------------------------------------
  60. * Pre :
  61. * Post : Returns number of milliseconds since start of
  62. * program
  63. *
  64. *-- History ------------------------------------------
  65. *
  66. * 2002.06.06:
  67. * Mongoose - Created
  68. ------------------------------------------------------*/
  69. ////////////////////////////////////////////////////////////
  70. // Public Mutators
  71. ////////////////////////////////////////////////////////////
  72. //FIXME: void bindKeyCommand(const char *cmd, int key, int event);
  73. /*------------------------------------------------------
  74. * Pre : <Cmd> is a valid command string
  75. * <Key> is a valid keyboard code
  76. * <Event> is a valid game event Id
  77. *
  78. * Post : Sets <Event> binding <Cmd> to <Key> press
  79. *
  80. *-- History ------------------------------------------
  81. *
  82. * 2003.06.03:
  83. * Mongoose - Created
  84. ------------------------------------------------------*/
  85. void glPrintf2d(float x, float y, char *string);
  86. /*------------------------------------------------------
  87. * Pre : <X>, and <Y> are valid world coordinates
  88. * <String> is a valid string
  89. *
  90. * Requires glEnterMode2d() call before entry
  91. *
  92. * System::bufferString(..) can cache printf()
  93. * style calls for use with this method
  94. *
  95. * Post : Renders string in OpenGL ( 2d projection )
  96. *
  97. * Call glExitMode2d() after finishing calls
  98. * to this method and other 2d rendering
  99. *
  100. *-- History ------------------------------------------
  101. *
  102. * 2003.06.03:
  103. * Mongoose - Ported to SDL_TTF
  104. *
  105. * 2001.12.31:
  106. * Mongoose - Created
  107. ------------------------------------------------------*/
  108. void glPrintf3d(float x, float y, float z, char *string);
  109. /*------------------------------------------------------
  110. * Pre : <X>, <Y>, and <Z> are valid world coordinates
  111. * <String> is a valid string
  112. *
  113. * System::bufferString(..) can cache printf()
  114. * style calls for use with this method
  115. *
  116. * Post : Renders string in OpenGL ( 3d projection )
  117. *
  118. *-- History ------------------------------------------
  119. *
  120. * 2003.06.03:
  121. * Mongoose - Ported to SDL_TTF
  122. *
  123. * 2001.12.31:
  124. * Mongoose - Created
  125. ------------------------------------------------------*/
  126. void initVideo(unsigned int width, unsigned int height,
  127. bool fullscreen);
  128. /*------------------------------------------------------
  129. * Pre : Video mode request <Width> x <Height>
  130. * <Fullscreen> enables fullscreen rendering
  131. *
  132. * Post : Start up video subsystem
  133. *
  134. *-- History ------------------------------------------
  135. *
  136. * 2002.06.06:
  137. * Mongoose - Created
  138. ------------------------------------------------------*/
  139. void resize(unsigned int width, unsigned int height);
  140. /*------------------------------------------------------
  141. * Pre :
  142. * Post : Resizes game window
  143. *
  144. *-- History ------------------------------------------
  145. *
  146. * 2002.06.06:
  147. * Mongoose - Created, from old SDLUnitTest code
  148. ------------------------------------------------------*/
  149. void runGame();
  150. /*------------------------------------------------------
  151. * Pre :
  152. * Post : Start game loop
  153. *
  154. *-- History ------------------------------------------
  155. *
  156. * 2002.06.06:
  157. * Mongoose - Created
  158. ------------------------------------------------------*/
  159. void setGrabMouse(bool on);
  160. /*------------------------------------------------------
  161. * Pre :
  162. * Post :
  163. *
  164. *-- History ------------------------------------------
  165. *
  166. * 2003.01.05:
  167. * Mongoose - Created
  168. ------------------------------------------------------*/
  169. void shutdown(int i);
  170. /*------------------------------------------------------
  171. * Pre :
  172. * Post : Shutsdown the game subsystems, exits game loop
  173. *
  174. *-- History ------------------------------------------
  175. *
  176. * 2002.06.06:
  177. * Mongoose - Created
  178. ------------------------------------------------------*/
  179. void swapBuffersGL();
  180. /*------------------------------------------------------
  181. * Pre :
  182. * Post : Swaps OpenGL buufers ( call at end of frame )
  183. *
  184. *-- History ------------------------------------------
  185. *
  186. * 2002.06.06:
  187. * Mongoose - Created
  188. ------------------------------------------------------*/
  189. void toggleFullscreen();
  190. /*------------------------------------------------------
  191. * Pre :
  192. * Post : Toggle fullscreen windowing mode
  193. *
  194. *-- History ------------------------------------------
  195. *
  196. * 2002.06.06:
  197. * Mongoose - Created
  198. ------------------------------------------------------*/
  199. protected:
  200. int m_old_width;
  201. int m_old_height;
  202. bool mFirstMouseEvent; // Filter first mouse event (SDL bug)
  203. bool mFullscreen; //!< Current Fullscreen/Windowed mode
  204. private:
  205. ////////////////////////////////////////////////////////////
  206. // Private Accessors
  207. ////////////////////////////////////////////////////////////
  208. ////////////////////////////////////////////////////////////
  209. // Private Mutators
  210. ////////////////////////////////////////////////////////////
  211. SDL_Surface *mWindow; /* This is the pointer to the SDL surface */
  212. };
  213. #endif