Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
359 lines (313 loc) · 12.1 KB

SDL_compat.h

File metadata and controls

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