Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
4.8 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_test_common.h
  20. *
  21. * Include file for SDL test framework.
  22. *
  23. * This code is a part of the SDL2_test library, not the main SDL library.
  24. */
  25. /* Ported from original test\common.h file. */
  26. #ifndef _SDL_test_common_h
  27. #define _SDL_test_common_h
  28. #include "SDL.h"
  29. #if defined(__PSP__)
  30. #define DEFAULT_WINDOW_WIDTH 480
  31. #define DEFAULT_WINDOW_HEIGHT 272
  32. #else
  33. #define DEFAULT_WINDOW_WIDTH 640
  34. #define DEFAULT_WINDOW_HEIGHT 480
  35. #endif
  36. #define VERBOSE_VIDEO 0x00000001
  37. #define VERBOSE_MODES 0x00000002
  38. #define VERBOSE_RENDER 0x00000004
  39. #define VERBOSE_EVENT 0x00000008
  40. #define VERBOSE_AUDIO 0x00000010
  41. typedef struct
  42. {
  43. /* SDL init flags */
  44. char **argv;
  45. Uint32 flags;
  46. Uint32 verbose;
  47. /* Video info */
  48. const char *videodriver;
  49. int display;
  50. const char *window_title;
  51. const char *window_icon;
  52. Uint32 window_flags;
  53. int window_x;
  54. int window_y;
  55. int window_w;
  56. int window_h;
  57. int window_minW;
  58. int window_minH;
  59. int window_maxW;
  60. int window_maxH;
  61. int logical_w;
  62. int logical_h;
  63. float scale;
  64. int depth;
  65. int refresh_rate;
  66. int num_windows;
  67. SDL_Window **windows;
  68. /* Renderer info */
  69. const char *renderdriver;
  70. Uint32 render_flags;
  71. SDL_bool skip_renderer;
  72. SDL_Renderer **renderers;
  73. SDL_Texture **targets;
  74. /* Audio info */
  75. const char *audiodriver;
  76. SDL_AudioSpec audiospec;
  77. /* GL settings */
  78. int gl_red_size;
  79. int gl_green_size;
  80. int gl_blue_size;
  81. int gl_alpha_size;
  82. int gl_buffer_size;
  83. int gl_depth_size;
  84. int gl_stencil_size;
  85. int gl_double_buffer;
  86. int gl_accum_red_size;
  87. int gl_accum_green_size;
  88. int gl_accum_blue_size;
  89. int gl_accum_alpha_size;
  90. int gl_stereo;
  91. int gl_multisamplebuffers;
  92. int gl_multisamplesamples;
  93. int gl_retained_backing;
  94. int gl_accelerated;
  95. int gl_major_version;
  96. int gl_minor_version;
  97. int gl_debug;
  98. int gl_profile_mask;
  99. } SDLTest_CommonState;
  100. #include "begin_code.h"
  101. /* Set up for C function definitions, even when using C++ */
  102. #ifdef __cplusplus
  103. extern "C" {
  104. #endif
  105. /* Function prototypes */
  106. /**
  107. * \brief Parse command line parameters and create common state.
  108. *
  109. * \param argv Array of command line parameters
  110. * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO)
  111. *
  112. * \returns Returns a newly allocated common state object.
  113. */
  114. SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
  115. /**
  116. * \brief Process one common argument.
  117. *
  118. * \param state The common state describing the test window to create.
  119. * \param index The index of the argument to process in argv[].
  120. *
  121. * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error.
  122. */
  123. int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
  124. /**
  125. * \brief Returns common usage information
  126. *
  127. * \param state The common state describing the test window to create.
  128. *
  129. * \returns String with usage information
  130. */
  131. const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
  132. /**
  133. * \brief Open test window.
  134. *
  135. * \param state The common state describing the test window to create.
  136. *
  137. * \returns True if initialization succeeded, false otherwise
  138. */
  139. SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
  140. /**
  141. * \brief Common event handler for test windows.
  142. *
  143. * \param state The common state used to create test window.
  144. * \param event The event to handle.
  145. * \param done Flag indicating we are done.
  146. *
  147. */
  148. void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done);
  149. /**
  150. * \brief Close test window.
  151. *
  152. * \param state The common state used to create test window.
  153. *
  154. */
  155. void SDLTest_CommonQuit(SDLTest_CommonState * state);
  156. /* Ends C function definitions when using C++ */
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160. #include "close_code.h"
  161. #endif /* _SDL_test_common_h */
  162. /* vi: set ts=4 sw=4 expandtab: */