SDL_compat.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. /*
  2. SDL - Simple DirectMedia Layer
  3. Copyright (C) 1997-2011 Sam Lantinga
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. Sam Lantinga
  16. [email protected]
  17. */
  18. /**
  19. * \defgroup Compatibility SDL 1.2 Compatibility API
  20. */
  21. /*@{*/
  22. /**
  23. * \file SDL_compat.h
  24. *
  25. * This file contains functions for backwards compatibility with SDL 1.2.
  26. */
  27. /**
  28. * \def SDL_NO_COMPAT
  29. *
  30. * #define SDL_NO_COMPAT to prevent SDL_compat.h from being included.
  31. * SDL_NO_COMPAT is intended to make it easier to covert SDL 1.2 code to
  32. * SDL 1.3/2.0.
  33. */
  34. /*@}*/
  35. #ifdef SDL_NO_COMPAT
  36. #define _SDL_compat_h
  37. #endif
  38. #ifndef _SDL_compat_h
  39. #define _SDL_compat_h
  40. #include "SDL_video.h"
  41. #include "SDL_version.h"
  42. #include "begin_code.h"
  43. /* Set up for C function definitions, even when using C++ */
  44. #ifdef __cplusplus
  45. /* *INDENT-OFF* */
  46. extern "C" {
  47. /* *INDENT-ON* */
  48. #endif
  49. /**
  50. * \addtogroup Compatibility
  51. */
  52. /*@{*/
  53. /* Platform */
  54. #ifdef __WIN32__
  55. #undef __WIN32__
  56. #define __WIN32__ 1
  57. #endif
  58. /**
  59. * \name Surface flags
  60. */
  61. /*@{*/
  62. #define SDL_SWSURFACE 0x00000000 /**< \note Not used */
  63. #define SDL_SRCALPHA 0x00010000
  64. #define SDL_SRCCOLORKEY 0x00020000
  65. #define SDL_ANYFORMAT 0x00100000
  66. #define SDL_HWPALETTE 0x00200000
  67. #define SDL_DOUBLEBUF 0x00400000
  68. #define SDL_FULLSCREEN 0x00800000
  69. #define SDL_RESIZABLE 0x01000000
  70. #define SDL_NOFRAME 0x02000000
  71. #define SDL_OPENGL 0x04000000
  72. #define SDL_HWSURFACE 0x08000001 /**< \note Not used */
  73. #define SDL_ASYNCBLIT 0x08000000 /**< \note Not used */
  74. #define SDL_RLEACCELOK 0x08000000 /**< \note Not used */
  75. #define SDL_HWACCEL 0x08000000 /**< \note Not used */
  76. /*@}*//*Surface flags*/
  77. #define SDL_APPMOUSEFOCUS 0x01
  78. #define SDL_APPINPUTFOCUS 0x02
  79. #define SDL_APPACTIVE 0x04
  80. #define SDL_LOGPAL 0x01
  81. #define SDL_PHYSPAL 0x02
  82. #define SDL_ACTIVEEVENT SDL_EVENT_COMPAT1
  83. #define SDL_VIDEORESIZE SDL_EVENT_COMPAT2
  84. #define SDL_VIDEOEXPOSE SDL_EVENT_COMPAT3
  85. #define SDL_ACTIVEEVENTMASK SDL_ACTIVEEVENT, SDL_ACTIVEEVENT
  86. #define SDL_VIDEORESIZEMASK SDL_VIDEORESIZE, SDL_VIDEORESIZE
  87. #define SDL_VIDEOEXPOSEMASK SDL_VIDEOEXPOSE, SDL_VIDEOEXPOSE
  88. #define SDL_WINDOWEVENTMASK SDL_WINDOWEVENT, SDL_WINDOWEVENT
  89. #define SDL_KEYDOWNMASK SDL_KEYDOWN, SDL_KEYDOWN
  90. #define SDL_KEYUPMASK SDL_KEYUP, SDL_KEYUP
  91. #define SDL_KEYEVENTMASK SDL_KEYDOWN, SDL_KEYUP
  92. #define SDL_TEXTEDITINGMASK SDL_TEXTEDITING, SDL_TEXTEDITING
  93. #define SDL_TEXTINPUTMASK SDL_TEXTINPUT, SDL_TEXTINPUT
  94. #define SDL_MOUSEMOTIONMASK SDL_MOUSEMOTION, SDL_MOUSEMOTION
  95. #define SDL_MOUSEBUTTONDOWNMASK SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONDOWN
  96. #define SDL_MOUSEBUTTONUPMASK SDL_MOUSEBUTTONUP, SDL_MOUSEBUTTONUP
  97. #define SDL_MOUSEWHEELMASK SDL_MOUSEWHEEL, SDL_MOUSEWHEEL
  98. #define SDL_MOUSEEVENTMASK SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP
  99. #define SDL_JOYAXISMOTIONMASK SDL_JOYAXISMOTION, SDL_JOYAXISMOTION
  100. #define SDL_JOYBALLMOTIONMASK SDL_JOYBALLMOTION, SDL_JOYBALLMOTION
  101. #define SDL_JOYHATMOTIONMASK SDL_JOYHATMOTION, SDL_JOYHATMOTION
  102. #define SDL_JOYBUTTONDOWNMASK SDL_JOYBUTTONDOWN, SDL_JOYBUTTONDOWN
  103. #define SDL_JOYBUTTONUPMASK SDL_JOYBUTTONUP, SDL_JOYBUTTONUP
  104. #define SDL_JOYEVENTMASK SDL_JOYAXISMOTION, SDL_JOYBUTTONUP
  105. #define SDL_QUITMASK SDL_QUIT, SDL_QUIT
  106. #define SDL_SYSWMEVENTMASK SDL_SYSWMEVENT, SDL_SYSWMEVENT
  107. #define SDL_PROXIMITYINMASK SDL_PROXIMITYIN, SDL_PROXIMITYIN
  108. #define SDL_PROXIMITYOUTMASK SDL_PROXIMITYOUT, SDL_PROXIMITYOUT
  109. #define SDL_ALLEVENTS SDL_FIRSTEVENT, SDL_LASTEVENT
  110. #define SDL_BUTTON_WHEELUP 4
  111. #define SDL_BUTTON_WHEELDOWN 5
  112. #define SDL_DEFAULT_REPEAT_DELAY 500
  113. #define SDL_DEFAULT_REPEAT_INTERVAL 30
  114. typedef struct SDL_VideoInfo
  115. {
  116. Uint32 hw_available:1;
  117. Uint32 wm_available:1;
  118. Uint32 UnusedBits1:6;
  119. Uint32 UnusedBits2:1;
  120. Uint32 blit_hw:1;
  121. Uint32 blit_hw_CC:1;
  122. Uint32 blit_hw_A:1;
  123. Uint32 blit_sw:1;
  124. Uint32 blit_sw_CC:1;
  125. Uint32 blit_sw_A:1;
  126. Uint32 blit_fill:1;
  127. Uint32 UnusedBits3:16;
  128. Uint32 video_mem;
  129. SDL_PixelFormat *vfmt;
  130. int current_w;
  131. int current_h;
  132. } SDL_VideoInfo;
  133. /**
  134. * \name Overlay formats
  135. *
  136. * The most common video overlay formats.
  137. *
  138. * For an explanation of these pixel formats, see:
  139. * http://www.webartz.com/fourcc/indexyuv.htm
  140. *
  141. * For information on the relationship between color spaces, see:
  142. * http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
  143. */
  144. /*@{*/
  145. #define SDL_YV12_OVERLAY 0x32315659 /**< Planar mode: Y + V + U (3 planes) */
  146. #define SDL_IYUV_OVERLAY 0x56555949 /**< Planar mode: Y + U + V (3 planes) */
  147. #define SDL_YUY2_OVERLAY 0x32595559 /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
  148. #define SDL_UYVY_OVERLAY 0x59565955 /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
  149. #define SDL_YVYU_OVERLAY 0x55595659 /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
  150. /*@}*//*Overlay formats*/
  151. /**
  152. * The YUV hardware video overlay.
  153. */
  154. typedef struct SDL_Overlay
  155. {
  156. Uint32 format; /**< Read-only */
  157. int w, h; /**< Read-only */
  158. int planes; /**< Read-only */
  159. Uint16 *pitches; /**< Read-only */
  160. Uint8 **pixels; /**< Read-write */
  161. /**
  162. * \name Hardware-specific surface info
  163. */
  164. /*@{*/
  165. struct private_yuvhwfuncs *hwfuncs;
  166. struct private_yuvhwdata *hwdata;
  167. /*@}*//*Hardware-specific surface info*/
  168. /**
  169. * \name Special flags
  170. */
  171. /*@{*/
  172. Uint32 hw_overlay:1; /**< Flag: This overlay hardware accelerated? */
  173. Uint32 UnusedBits:31;
  174. /*@}*//*Special flags*/
  175. } SDL_Overlay;
  176. typedef enum
  177. {
  178. SDL_GRAB_QUERY = -1,
  179. SDL_GRAB_OFF = 0,
  180. SDL_GRAB_ON = 1
  181. } SDL_GrabMode;
  182. struct SDL_SysWMinfo;
  183. /**
  184. * \name Obsolete or renamed key codes
  185. */
  186. /*@{*/
  187. #define SDL_keysym SDL_Keysym
  188. #define SDL_KeySym SDL_Keysym
  189. #define SDL_scancode SDL_Scancode
  190. #define SDL_ScanCode SDL_Scancode
  191. #define SDLKey SDL_Keycode
  192. #define SDLMod SDL_Keymod
  193. /**
  194. * \name Renamed keys
  195. *
  196. * These key constants were renamed for clarity or consistency.
  197. */
  198. /*@{*/
  199. #define SDLK_KP0 SDLK_KP_0
  200. #define SDLK_KP1 SDLK_KP_1
  201. #define SDLK_KP2 SDLK_KP_2
  202. #define SDLK_KP3 SDLK_KP_3
  203. #define SDLK_KP4 SDLK_KP_4
  204. #define SDLK_KP5 SDLK_KP_5
  205. #define SDLK_KP6 SDLK_KP_6
  206. #define SDLK_KP7 SDLK_KP_7
  207. #define SDLK_KP8 SDLK_KP_8
  208. #define SDLK_KP9 SDLK_KP_9
  209. #define SDLK_NUMLOCK SDLK_NUMLOCKCLEAR
  210. #define SDLK_SCROLLOCK SDLK_SCROLLLOCK
  211. #define SDLK_PRINT SDLK_PRINTSCREEN
  212. #define SDLK_LMETA SDLK_LGUI
  213. #define SDLK_RMETA SDLK_RGUI
  214. /*@}*//*Renamed keys*/
  215. /**
  216. * \name META modifier
  217. *
  218. * The META modifier is equivalent to the GUI modifier from the USB standard.
  219. */
  220. /*@{*/
  221. #define KMOD_LMETA KMOD_LGUI
  222. #define KMOD_RMETA KMOD_RGUI
  223. #define KMOD_META KMOD_GUI
  224. /*@}*//*META modifier*/
  225. /**
  226. * \name Not in USB
  227. *
  228. * These keys don't appear in the USB specification (or at least not under
  229. * those names). I'm unsure if the following assignments make sense or if these
  230. * codes should be defined as actual additional SDLK_ constants.
  231. */
  232. /*@{*/
  233. #define SDLK_LSUPER SDLK_LMETA
  234. #define SDLK_RSUPER SDLK_RMETA
  235. #define SDLK_COMPOSE SDLK_APPLICATION
  236. #define SDLK_BREAK SDLK_STOP
  237. #define SDLK_EURO SDLK_2
  238. /*@}*//*Not in USB*/
  239. /*@}*//*Obsolete or renamed key codes*/
  240. #define SDL_SetModuleHandle(x)
  241. #define SDL_AllocSurface SDL_CreateRGBSurface
  242. extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
  243. extern DECLSPEC const char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
  244. extern DECLSPEC const char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
  245. extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
  246. extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,
  247. int height,
  248. int bpp, Uint32 flags);
  249. extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(const SDL_PixelFormat *
  250. format, Uint32 flags);
  251. extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height,
  252. int bpp, Uint32 flags);
  253. extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);
  254. extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,
  255. int numrects, SDL_Rect * rects);
  256. extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen,
  257. Sint32 x,
  258. Sint32 y, Uint32 w, Uint32 h);
  259. extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen);
  260. extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface,
  261. Uint32 flag, Uint8 alpha);
  262. extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);
  263. extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
  264. surface);
  265. extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
  266. const char *icon);
  267. extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,
  268. const char **icon);
  269. extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);
  270. extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
  271. extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
  272. extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
  273. extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface,
  274. int flags,
  275. const SDL_Color * colors,
  276. int firstcolor, int ncolors);
  277. extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
  278. const SDL_Color * colors,
  279. int firstcolor, int ncolors);
  280. extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info);
  281. extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
  282. extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
  283. extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
  284. int height,
  285. Uint32 format,
  286. SDL_Surface *
  287. display);
  288. extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay);
  289. extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);
  290. extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
  291. SDL_Rect * dstrect);
  292. extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
  293. extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
  294. extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
  295. extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
  296. const Uint16 * green,
  297. const Uint16 * blue);
  298. extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
  299. Uint16 * blue);
  300. extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
  301. extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
  302. extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
  303. typedef SDL_Window* SDL_WindowID;
  304. #define SDL_KillThread(X)
  305. /* The timeslice and timer resolution are no longer relevant */
  306. #define SDL_TIMESLICE 10
  307. #define TIMER_RESOLUTION 10
  308. typedef Uint32 (SDLCALL * SDL_OldTimerCallback) (Uint32 interval);
  309. extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_OldTimerCallback callback);
  310. extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
  311. /*@}*//*Compatibility*/
  312. /* Ends C function definitions when using C++ */
  313. #ifdef __cplusplus
  314. /* *INDENT-OFF* */
  315. }
  316. /* *INDENT-ON* */
  317. #endif
  318. #include "close_code.h"
  319. #endif /* _SDL_compat_h */
  320. /* vi: set ts=4 sw=4 expandtab: */