SDL_video.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. #ifndef _SDL_video_h
  2. #define _SDL_video_h
  3. #include "SDL_stdinc.h"
  4. #include "SDL_pixels.h"
  5. #include "SDL_rect.h"
  6. #include "SDL_surface.h"
  7. #include "begin_code.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. typedef struct
  12. {
  13. Uint32 format;
  14. int w;
  15. int h;
  16. int refresh_rate;
  17. void *driverdata;
  18. } SDL_DisplayMode;
  19. typedef struct SDL_Window SDL_Window;
  20. typedef enum
  21. {
  22. SDL_WINDOW_FULLSCREEN = 0x00000001,
  23. SDL_WINDOW_OPENGL = 0x00000002,
  24. SDL_WINDOW_SHOWN = 0x00000004,
  25. SDL_WINDOW_HIDDEN = 0x00000008,
  26. SDL_WINDOW_BORDERLESS = 0x00000010,
  27. SDL_WINDOW_RESIZABLE = 0x00000020,
  28. SDL_WINDOW_MINIMIZED = 0x00000040,
  29. SDL_WINDOW_MAXIMIZED = 0x00000080,
  30. SDL_WINDOW_INPUT_GRABBED = 0x00000100,
  31. SDL_WINDOW_INPUT_FOCUS = 0x00000200,
  32. SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
  33. SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
  34. SDL_WINDOW_FOREIGN = 0x00000800
  35. } SDL_WindowFlags;
  36. #define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000
  37. #define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
  38. #define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
  39. #define SDL_WINDOWPOS_ISUNDEFINED(X) \
  40. (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
  41. #define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000
  42. #define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X))
  43. #define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
  44. #define SDL_WINDOWPOS_ISCENTERED(X) \
  45. (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
  46. typedef enum
  47. {
  48. SDL_WINDOWEVENT_NONE,
  49. SDL_WINDOWEVENT_SHOWN,
  50. SDL_WINDOWEVENT_HIDDEN,
  51. SDL_WINDOWEVENT_EXPOSED,
  52. SDL_WINDOWEVENT_MOVED,
  53. SDL_WINDOWEVENT_RESIZED,
  54. SDL_WINDOWEVENT_SIZE_CHANGED,
  55. SDL_WINDOWEVENT_MINIMIZED,
  56. SDL_WINDOWEVENT_MAXIMIZED,
  57. SDL_WINDOWEVENT_RESTORED,
  58. SDL_WINDOWEVENT_ENTER,
  59. SDL_WINDOWEVENT_LEAVE,
  60. SDL_WINDOWEVENT_FOCUS_GAINED,
  61. SDL_WINDOWEVENT_FOCUS_LOST,
  62. SDL_WINDOWEVENT_CLOSE
  63. } SDL_WindowEventID;
  64. typedef void *SDL_GLContext;
  65. typedef enum
  66. {
  67. SDL_GL_RED_SIZE,
  68. SDL_GL_GREEN_SIZE,
  69. SDL_GL_BLUE_SIZE,
  70. SDL_GL_ALPHA_SIZE,
  71. SDL_GL_BUFFER_SIZE,
  72. SDL_GL_DOUBLEBUFFER,
  73. SDL_GL_DEPTH_SIZE,
  74. SDL_GL_STENCIL_SIZE,
  75. SDL_GL_ACCUM_RED_SIZE,
  76. SDL_GL_ACCUM_GREEN_SIZE,
  77. SDL_GL_ACCUM_BLUE_SIZE,
  78. SDL_GL_ACCUM_ALPHA_SIZE,
  79. SDL_GL_STEREO,
  80. SDL_GL_MULTISAMPLEBUFFERS,
  81. SDL_GL_MULTISAMPLESAMPLES,
  82. SDL_GL_ACCELERATED_VISUAL,
  83. SDL_GL_RETAINED_BACKING,
  84. SDL_GL_CONTEXT_MAJOR_VERSION,
  85. SDL_GL_CONTEXT_MINOR_VERSION,
  86. SDL_GL_CONTEXT_EGL,
  87. SDL_GL_CONTEXT_FLAGS,
  88. SDL_GL_CONTEXT_PROFILE_MASK,
  89. SDL_GL_SHARE_WITH_CURRENT_CONTEXT
  90. } SDL_GLattr;
  91. typedef enum
  92. {
  93. SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
  94. SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
  95. SDL_GL_CONTEXT_PROFILE_ES = 0x0004
  96. } SDL_GLprofile;
  97. typedef enum
  98. {
  99. SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001,
  100. SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
  101. SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004,
  102. SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
  103. } SDL_GLcontextFlag;
  104. typedef int SDLCALL tSDL_GetNumVideoDrivers(void);
  105. typedef const char * SDLCALL tSDL_GetVideoDriver(int index);
  106. typedef int SDLCALL tSDL_VideoInit(const char *driver_name);
  107. typedef void SDLCALL tSDL_VideoQuit(void);
  108. typedef const char * SDLCALL tSDL_GetCurrentVideoDriver(void);
  109. typedef int SDLCALL tSDL_GetNumVideoDisplays(void);
  110. typedef const char * SDLCALL tSDL_GetDisplayName(int displayIndex);
  111. typedef int SDLCALL tSDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
  112. typedef int SDLCALL tSDL_GetNumDisplayModes(int displayIndex);
  113. typedef int SDLCALL tSDL_GetDisplayMode(int displayIndex, int modeIndex,
  114. SDL_DisplayMode * mode);
  115. typedef int SDLCALL tSDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
  116. typedef int SDLCALL tSDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
  117. typedef SDL_DisplayMode * SDLCALL tSDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
  118. typedef int SDLCALL tSDL_GetWindowDisplayIndex(SDL_Window * window);
  119. typedef int SDLCALL tSDL_SetWindowDisplayMode(SDL_Window * window,
  120. const SDL_DisplayMode
  121. * mode);
  122. typedef int SDLCALL tSDL_GetWindowDisplayMode(SDL_Window * window,
  123. SDL_DisplayMode * mode);
  124. typedef Uint32 SDLCALL tSDL_GetWindowPixelFormat(SDL_Window * window);
  125. typedef SDL_Window * SDLCALL tSDL_CreateWindow(const char *title,
  126. int x, int y, int w,
  127. int h, Uint32 flags);
  128. typedef SDL_Window * SDLCALL tSDL_CreateWindowFrom(const void *data);
  129. typedef Uint32 SDLCALL tSDL_GetWindowID(SDL_Window * window);
  130. typedef SDL_Window * SDLCALL tSDL_GetWindowFromID(Uint32 id);
  131. typedef Uint32 SDLCALL tSDL_GetWindowFlags(SDL_Window * window);
  132. typedef void SDLCALL tSDL_SetWindowTitle(SDL_Window * window,
  133. const char *title);
  134. typedef const char * SDLCALL tSDL_GetWindowTitle(SDL_Window * window);
  135. typedef void SDLCALL tSDL_SetWindowIcon(SDL_Window * window,
  136. SDL_Surface * icon);
  137. extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
  138. const char *name,
  139. void *userdata);
  140. typedef void * SDLCALL tSDL_GetWindowData(SDL_Window * window,
  141. const char *name);
  142. typedef void SDLCALL tSDL_SetWindowPosition(SDL_Window * window,
  143. int x, int y);
  144. typedef void SDLCALL tSDL_GetWindowPosition(SDL_Window * window,
  145. int *x, int *y);
  146. typedef void SDLCALL tSDL_SetWindowSize(SDL_Window * window, int w,
  147. int h);
  148. typedef void SDLCALL tSDL_GetWindowSize(SDL_Window * window, int *w,
  149. int *h);
  150. typedef void SDLCALL tSDL_SetWindowMinimumSize(SDL_Window * window,
  151. int min_w, int min_h);
  152. typedef void SDLCALL tSDL_GetWindowMinimumSize(SDL_Window * window,
  153. int *w, int *h);
  154. typedef void SDLCALL tSDL_SetWindowMaximumSize(SDL_Window * window,
  155. int max_w, int max_h);
  156. typedef void SDLCALL tSDL_GetWindowMaximumSize(SDL_Window * window,
  157. int *w, int *h);
  158. typedef void SDLCALL tSDL_SetWindowBordered(SDL_Window * window,
  159. SDL_bool bordered);
  160. typedef void SDLCALL tSDL_ShowWindow(SDL_Window * window);
  161. typedef void SDLCALL tSDL_HideWindow(SDL_Window * window);
  162. typedef void SDLCALL tSDL_RaiseWindow(SDL_Window * window);
  163. typedef void SDLCALL tSDL_MaximizeWindow(SDL_Window * window);
  164. typedef void SDLCALL tSDL_MinimizeWindow(SDL_Window * window);
  165. typedef void SDLCALL tSDL_RestoreWindow(SDL_Window * window);
  166. typedef int SDLCALL tSDL_SetWindowFullscreen(SDL_Window * window,
  167. Uint32 flags);
  168. typedef SDL_Surface * SDLCALL tSDL_GetWindowSurface(SDL_Window * window);
  169. typedef int SDLCALL tSDL_UpdateWindowSurface(SDL_Window * window);
  170. typedef int SDLCALL tSDL_UpdateWindowSurfaceRects(SDL_Window * window,
  171. const SDL_Rect * rects,
  172. int numrects);
  173. typedef void SDLCALL tSDL_SetWindowGrab(SDL_Window * window,
  174. SDL_bool grabbed);
  175. typedef SDL_bool SDLCALL tSDL_GetWindowGrab(SDL_Window * window);
  176. typedef int SDLCALL tSDL_SetWindowBrightness(SDL_Window * window, float brightness);
  177. typedef float SDLCALL tSDL_GetWindowBrightness(SDL_Window * window);
  178. typedef int SDLCALL tSDL_SetWindowGammaRamp(SDL_Window * window,
  179. const Uint16 * red,
  180. const Uint16 * green,
  181. const Uint16 * blue);
  182. typedef int SDLCALL tSDL_GetWindowGammaRamp(SDL_Window * window,
  183. Uint16 * red,
  184. Uint16 * green,
  185. Uint16 * blue);
  186. typedef void SDLCALL tSDL_DestroyWindow(SDL_Window * window);
  187. typedef SDL_bool SDLCALL tSDL_IsScreenSaverEnabled(void);
  188. typedef void SDLCALL tSDL_EnableScreenSaver(void);
  189. typedef void SDLCALL tSDL_DisableScreenSaver(void);
  190. typedef int SDLCALL tSDL_GL_LoadLibrary(const char *path);
  191. typedef void * SDLCALL tSDL_GL_GetProcAddress(const char *proc);
  192. typedef void SDLCALL tSDL_GL_UnloadLibrary(void);
  193. typedef SDL_bool SDLCALL tSDL_GL_ExtensionSupported(const char
  194. *extension);
  195. typedef int SDLCALL tSDL_GL_SetAttribute(SDL_GLattr attr, int value);
  196. typedef int SDLCALL tSDL_GL_GetAttribute(SDL_GLattr attr, int *value);
  197. typedef SDL_GLContext SDLCALL tSDL_GL_CreateContext(SDL_Window *
  198. window);
  199. typedef int SDLCALL tSDL_GL_MakeCurrent(SDL_Window * window,
  200. SDL_GLContext context);
  201. extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
  202. typedef SDL_GLContext SDLCALL tSDL_GL_GetCurrentContext(void);
  203. typedef int SDLCALL tSDL_GL_SetSwapInterval(int interval);
  204. typedef int SDLCALL tSDL_GL_GetSwapInterval(void);
  205. typedef void SDLCALL tSDL_GL_SwapWindow(SDL_Window * window);
  206. typedef void SDLCALL tSDL_GL_DeleteContext(SDL_GLContext context);
  207. extern tSDL_GetNumVideoDrivers *SDL_GetNumVideoDrivers;
  208. extern tSDL_GetVideoDriver *SDL_GetVideoDriver;
  209. extern tSDL_VideoInit *SDL_VideoInit;
  210. extern tSDL_VideoQuit *SDL_VideoQuit;
  211. extern tSDL_GetCurrentVideoDriver *SDL_GetCurrentVideoDriver;
  212. extern tSDL_GetNumVideoDisplays *SDL_GetNumVideoDisplays;
  213. extern tSDL_GetDisplayName *SDL_GetDisplayName;
  214. extern tSDL_GetDisplayBounds *SDL_GetDisplayBounds;
  215. extern tSDL_GetNumDisplayModes *SDL_GetNumDisplayModes;
  216. extern tSDL_GetDisplayMode *SDL_GetDisplayMode;
  217. extern tSDL_GetDesktopDisplayMode *SDL_GetDesktopDisplayMode;
  218. extern tSDL_GetCurrentDisplayMode *SDL_GetCurrentDisplayMode;
  219. extern tSDL_GetClosestDisplayMode *SDL_GetClosestDisplayMode;
  220. extern tSDL_GetWindowDisplayIndex *SDL_GetWindowDisplayIndex;
  221. extern tSDL_SetWindowDisplayMode *SDL_SetWindowDisplayMode;
  222. extern tSDL_GetWindowDisplayMode *SDL_GetWindowDisplayMode;
  223. extern tSDL_GetWindowPixelFormat *SDL_GetWindowPixelFormat;
  224. extern tSDL_CreateWindow *SDL_CreateWindow;
  225. extern tSDL_CreateWindowFrom *SDL_CreateWindowFrom;
  226. extern tSDL_GetWindowID *SDL_GetWindowID;
  227. extern tSDL_GetWindowFromID *SDL_GetWindowFromID;
  228. extern tSDL_GetWindowFlags *SDL_GetWindowFlags;
  229. extern tSDL_SetWindowTitle *SDL_SetWindowTitle;
  230. extern tSDL_GetWindowTitle *SDL_GetWindowTitle;
  231. extern tSDL_SetWindowIcon *SDL_SetWindowIcon;
  232. extern tSDL_GetWindowData *SDL_GetWindowData;
  233. extern tSDL_SetWindowPosition *SDL_SetWindowPosition;
  234. extern tSDL_GetWindowPosition *SDL_GetWindowPosition;
  235. extern tSDL_SetWindowSize *SDL_SetWindowSize;
  236. extern tSDL_GetWindowSize *SDL_GetWindowSize;
  237. extern tSDL_SetWindowMinimumSize *SDL_SetWindowMinimumSize;
  238. extern tSDL_GetWindowMinimumSize *SDL_GetWindowMinimumSize;
  239. extern tSDL_SetWindowMaximumSize *SDL_SetWindowMaximumSize;
  240. extern tSDL_GetWindowMaximumSize *SDL_GetWindowMaximumSize;
  241. extern tSDL_SetWindowBordered *SDL_SetWindowBordered;
  242. extern tSDL_ShowWindow *SDL_ShowWindow;
  243. extern tSDL_HideWindow *SDL_HideWindow;
  244. extern tSDL_RaiseWindow *SDL_RaiseWindow;
  245. extern tSDL_MaximizeWindow *SDL_MaximizeWindow;
  246. extern tSDL_MinimizeWindow *SDL_MinimizeWindow;
  247. extern tSDL_RestoreWindow *SDL_RestoreWindow;
  248. extern tSDL_SetWindowFullscreen *SDL_SetWindowFullscreen;
  249. extern tSDL_GetWindowSurface *SDL_GetWindowSurface;
  250. extern tSDL_UpdateWindowSurface *SDL_UpdateWindowSurface;
  251. extern tSDL_UpdateWindowSurfaceRects *SDL_UpdateWindowSurfaceRects;
  252. extern tSDL_SetWindowGrab *SDL_SetWindowGrab;
  253. extern tSDL_GetWindowGrab *SDL_GetWindowGrab;
  254. extern tSDL_SetWindowBrightness *SDL_SetWindowBrightness;
  255. extern tSDL_GetWindowBrightness *SDL_GetWindowBrightness;
  256. extern tSDL_SetWindowGammaRamp *SDL_SetWindowGammaRamp;
  257. extern tSDL_GetWindowGammaRamp *SDL_GetWindowGammaRamp;
  258. extern tSDL_DestroyWindow *SDL_DestroyWindow;
  259. extern tSDL_IsScreenSaverEnabled *SDL_IsScreenSaverEnabled;
  260. extern tSDL_EnableScreenSaver *SDL_EnableScreenSaver;
  261. extern tSDL_DisableScreenSaver *SDL_DisableScreenSaver;
  262. extern tSDL_GL_LoadLibrary *SDL_GL_LoadLibrary;
  263. extern tSDL_GL_GetProcAddress *SDL_GL_GetProcAddress;
  264. extern tSDL_GL_UnloadLibrary *SDL_GL_UnloadLibrary;
  265. extern tSDL_GL_ExtensionSupported *SDL_GL_ExtensionSupported;
  266. extern tSDL_GL_SetAttribute *SDL_GL_SetAttribute;
  267. extern tSDL_GL_GetAttribute *SDL_GL_GetAttribute;
  268. extern tSDL_GL_CreateContext *SDL_GL_CreateContext;
  269. extern tSDL_GL_MakeCurrent *SDL_GL_MakeCurrent;
  270. extern tSDL_GL_GetCurrentContext *SDL_GL_GetCurrentContext;
  271. extern tSDL_GL_SetSwapInterval *SDL_GL_SetSwapInterval;
  272. extern tSDL_GL_GetSwapInterval *SDL_GL_GetSwapInterval;
  273. extern tSDL_GL_SwapWindow *SDL_GL_SwapWindow;
  274. extern tSDL_GL_DeleteContext *SDL_GL_DeleteContext;
  275. #ifdef __cplusplus
  276. }
  277. #endif
  278. #include "close_code.h"
  279. #endif