include/SDL_compat.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 12 Dec 2008 06:46:20 +0000
changeset 2862 929e7dd10031
parent 2859 99210400e8b9
child 3034 0e821769fc51
permissions -rw-r--r--
Added current_w and current_h to SDL_VideoInfo for SDL 1.2 compatibility
slouken@1895
     1
/*
slouken@1895
     2
    SDL - Simple DirectMedia Layer
slouken@2859
     3
    Copyright (C) 1997-2009 Sam Lantinga
slouken@1895
     4
slouken@1895
     5
    This library is free software; you can redistribute it and/or
slouken@1895
     6
    modify it under the terms of the GNU Lesser General Public
slouken@1895
     7
    License as published by the Free Software Foundation; either
slouken@1895
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@1895
     9
slouken@1895
    10
    This library is distributed in the hope that it will be useful,
slouken@1895
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@1895
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1895
    13
    Lesser General Public License for more details.
slouken@1895
    14
slouken@1895
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1895
    16
    License along with this library; if not, write to the Free Software
slouken@1895
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@1895
    18
slouken@1895
    19
    Sam Lantinga
slouken@1895
    20
    slouken@libsdl.org
slouken@1895
    21
*/
slouken@1895
    22
slouken@1895
    23
/* This file contains functions for backwards compatibility with SDL 1.2 */
slouken@1895
    24
slouken@1895
    25
#ifndef _SDL_compat_h
slouken@1895
    26
#define _SDL_compat_h
slouken@1895
    27
slouken@1895
    28
#include "SDL_video.h"
slouken@1895
    29
#include "SDL_version.h"
slouken@1895
    30
slouken@1895
    31
#include "begin_code.h"
slouken@1895
    32
/* Set up for C function definitions, even when using C++ */
slouken@1895
    33
#ifdef __cplusplus
slouken@1895
    34
/* *INDENT-OFF* */
slouken@1895
    35
extern "C" {
slouken@1895
    36
/* *INDENT-ON* */
slouken@1895
    37
#endif
slouken@1895
    38
slouken@2222
    39
#define SDL_SWSURFACE       0x00000000  /* Not used */
slouken@2267
    40
#define SDL_SRCALPHA        0x00010000
slouken@2267
    41
#define SDL_SRCCOLORKEY     0x00020000
slouken@1895
    42
#define SDL_ANYFORMAT       0x00100000
slouken@1895
    43
#define SDL_HWPALETTE       0x00200000
slouken@1895
    44
#define SDL_DOUBLEBUF       0x00400000
slouken@1895
    45
#define SDL_FULLSCREEN      0x00800000
slouken@1895
    46
#define SDL_RESIZABLE       0x01000000
slouken@1895
    47
#define SDL_NOFRAME         0x02000000
slouken@1895
    48
#define SDL_OPENGL          0x04000000
slouken@2222
    49
#define SDL_HWSURFACE       0x08000001  /* Not used */
slouken@1895
    50
#define SDL_ASYNCBLIT       0x08000000  /* Not used */
slouken@2267
    51
#define SDL_RLEACCELOK      0x08000000  /* Not used */
slouken@1895
    52
#define SDL_HWACCEL         0x08000000  /* Not used */
slouken@1895
    53
slouken@1895
    54
#define SDL_APPMOUSEFOCUS	0x01
slouken@1895
    55
#define SDL_APPINPUTFOCUS	0x02
slouken@1895
    56
#define SDL_APPACTIVE		0x04
slouken@1895
    57
slouken@1895
    58
#define SDL_LOGPAL 0x01
slouken@1895
    59
#define SDL_PHYSPAL 0x02
slouken@1895
    60
slouken@1895
    61
#define SDL_ACTIVEEVENT	SDL_EVENT_RESERVED1
slouken@1895
    62
#define SDL_VIDEORESIZE	SDL_EVENT_RESERVED2
slouken@1895
    63
#define SDL_VIDEOEXPOSE	SDL_EVENT_RESERVED3
slouken@1895
    64
#define SDL_ACTIVEEVENTMASK	SDL_EVENTMASK(SDL_ACTIVEEVENT)
slouken@1895
    65
#define SDL_VIDEORESIZEMASK SDL_EVENTMASK(SDL_VIDEORESIZE)
slouken@1895
    66
#define SDL_VIDEOEXPOSEMASK SDL_EVENTMASK(SDL_VIDEOEXPOSE)
slouken@1895
    67
slouken@1895
    68
#define SDL_BUTTON_WHEELUP	4
slouken@1895
    69
#define SDL_BUTTON_WHEELDOWN	5
slouken@1895
    70
slouken@2129
    71
#define SDL_DEFAULT_REPEAT_DELAY	500
slouken@2129
    72
#define SDL_DEFAULT_REPEAT_INTERVAL	30
slouken@2129
    73
slouken@1895
    74
typedef struct SDL_VideoInfo
slouken@1895
    75
{
slouken@1895
    76
    Uint32 hw_available:1;
slouken@1895
    77
    Uint32 wm_available:1;
slouken@1895
    78
    Uint32 UnusedBits1:6;
slouken@1895
    79
    Uint32 UnusedBits2:1;
slouken@1895
    80
    Uint32 blit_hw:1;
slouken@1895
    81
    Uint32 blit_hw_CC:1;
slouken@1895
    82
    Uint32 blit_hw_A:1;
slouken@1895
    83
    Uint32 blit_sw:1;
slouken@1895
    84
    Uint32 blit_sw_CC:1;
slouken@1895
    85
    Uint32 blit_sw_A:1;
slouken@1895
    86
    Uint32 blit_fill:1;
slouken@1895
    87
    Uint32 UnusedBits3:16;
slouken@1895
    88
    Uint32 video_mem;
slouken@1895
    89
slouken@1895
    90
    SDL_PixelFormat *vfmt;
slouken@2862
    91
slouken@2862
    92
    int current_w;
slouken@2862
    93
    int current_h;
slouken@1895
    94
} SDL_VideoInfo;
slouken@1895
    95
slouken@1895
    96
/* The most common video overlay formats.
slouken@1895
    97
   For an explanation of these pixel formats, see:
slouken@1895
    98
   http://www.webartz.com/fourcc/indexyuv.htm
slouken@1895
    99
slouken@1895
   100
   For information on the relationship between color spaces, see:
slouken@1895
   101
   http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
slouken@1895
   102
 */
slouken@1895
   103
#define SDL_YV12_OVERLAY  0x32315659    /* Planar mode: Y + V + U  (3 planes) */
slouken@1895
   104
#define SDL_IYUV_OVERLAY  0x56555949    /* Planar mode: Y + U + V  (3 planes) */
slouken@1895
   105
#define SDL_YUY2_OVERLAY  0x32595559    /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
slouken@1895
   106
#define SDL_UYVY_OVERLAY  0x59565955    /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
slouken@1895
   107
#define SDL_YVYU_OVERLAY  0x55595659    /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
slouken@1895
   108
slouken@1895
   109
/* The YUV hardware video overlay */
slouken@1895
   110
typedef struct SDL_Overlay
slouken@1895
   111
{
slouken@1895
   112
    Uint32 format;              /* Read-only */
slouken@1895
   113
    int w, h;                   /* Read-only */
slouken@1895
   114
    int planes;                 /* Read-only */
slouken@1895
   115
    Uint16 *pitches;            /* Read-only */
slouken@1895
   116
    Uint8 **pixels;             /* Read-write */
slouken@1895
   117
slouken@1895
   118
    /* Hardware-specific surface info */
slouken@1895
   119
    struct private_yuvhwfuncs *hwfuncs;
slouken@1895
   120
    struct private_yuvhwdata *hwdata;
slouken@1895
   121
slouken@1895
   122
    /* Special flags */
slouken@1895
   123
    Uint32 hw_overlay:1;        /* Flag: This overlay hardware accelerated? */
slouken@1895
   124
    Uint32 UnusedBits:31;
slouken@1895
   125
} SDL_Overlay;
slouken@1895
   126
slouken@1895
   127
typedef enum
slouken@1895
   128
{
slouken@1895
   129
    SDL_GRAB_QUERY = -1,
slouken@1895
   130
    SDL_GRAB_OFF = 0,
slouken@1895
   131
    SDL_GRAB_ON = 1
slouken@1895
   132
} SDL_GrabMode;
slouken@1895
   133
slouken@1895
   134
struct SDL_SysWMinfo;
slouken@1895
   135
slouken@2303
   136
/* Obsolete or renamed key codes */
slouken@2268
   137
slouken@2303
   138
/* These key constants were renamed for clarity or consistency. */
slouken@2709
   139
#define SDLK_0	'0'
slouken@2709
   140
#define SDLK_1	'1'
slouken@2709
   141
#define SDLK_2	'2'
slouken@2709
   142
#define SDLK_3	'3'
slouken@2709
   143
#define SDLK_4	'4'
slouken@2709
   144
#define SDLK_5	'5'
slouken@2709
   145
#define SDLK_6	'6'
slouken@2709
   146
#define SDLK_7	'7'
slouken@2709
   147
#define SDLK_8	'8'
slouken@2709
   148
#define SDLK_9	'9'
slouken@2303
   149
#define SDLK_a  'a'
slouken@2303
   150
#define SDLK_b  'b'
slouken@2303
   151
#define SDLK_c  'c'
slouken@2303
   152
#define SDLK_d  'd'
slouken@2303
   153
#define SDLK_e  'e'
slouken@2303
   154
#define SDLK_f  'f'
slouken@2303
   155
#define SDLK_g  'g'
slouken@2303
   156
#define SDLK_h  'h'
slouken@2303
   157
#define SDLK_i  'i'
slouken@2303
   158
#define SDLK_j  'j'
slouken@2303
   159
#define SDLK_k  'k'
slouken@2303
   160
#define SDLK_l  'l'
slouken@2303
   161
#define SDLK_m  'm'
slouken@2303
   162
#define SDLK_n  'n'
slouken@2303
   163
#define SDLK_o  'o'
slouken@2303
   164
#define SDLK_p  'p'
slouken@2303
   165
#define SDLK_q  'q'
slouken@2303
   166
#define SDLK_r  'r'
slouken@2303
   167
#define SDLK_s  's'
slouken@2303
   168
#define SDLK_t  't'
slouken@2303
   169
#define SDLK_u  'u'
slouken@2303
   170
#define SDLK_v  'v'
slouken@2303
   171
#define SDLK_w  'w'
slouken@2303
   172
#define SDLK_x  'x'
slouken@2303
   173
#define SDLK_y  'y'
slouken@2303
   174
#define SDLK_z  'z'
slouken@2303
   175
#define SDLK_QUOTE      '\''
slouken@2303
   176
#define SDLK_MINUS      '-'
slouken@2303
   177
#define SDLK_BACKQUOTE  '`'
slouken@2303
   178
#define SDLK_EXCLAIM    '!'
slouken@2303
   179
#define SDLK_QUOTEDBL   '"'
slouken@2303
   180
#define SDLK_HASH       '#'
slouken@2303
   181
#define SDLK_DOLLAR     '$'
slouken@2303
   182
#define SDLK_AMPERSAND  '&'
slouken@2303
   183
#define SDLK_LEFTPAREN  '('
slouken@2303
   184
#define SDLK_RIGHTPAREN ')'
slouken@2303
   185
#define SDLK_ASTERISK   '*'
slouken@2303
   186
#define SDLK_PLUS       '+'
slouken@2303
   187
#define SDLK_COLON      ':'
slouken@2303
   188
#define SDLK_LESS       '<'
slouken@2303
   189
#define SDLK_GREATER    '>'
slouken@2303
   190
#define SDLK_QUESTION   '?'
slouken@2303
   191
#define SDLK_AT         '@'
slouken@2303
   192
#define SDLK_CARET      '^'
slouken@2303
   193
#define SDLK_UNDERSCORE '_'
slouken@2268
   194
#define SDLK_KP0 SDLK_KP_0
slouken@2268
   195
#define SDLK_KP1 SDLK_KP_1
slouken@2268
   196
#define SDLK_KP2 SDLK_KP_2
slouken@2268
   197
#define SDLK_KP3 SDLK_KP_3
slouken@2268
   198
#define SDLK_KP4 SDLK_KP_4
slouken@2268
   199
#define SDLK_KP5 SDLK_KP_5
slouken@2268
   200
#define SDLK_KP6 SDLK_KP_6
slouken@2268
   201
#define SDLK_KP7 SDLK_KP_7
slouken@2268
   202
#define SDLK_KP8 SDLK_KP_8
slouken@2268
   203
#define SDLK_KP9 SDLK_KP_9
slouken@2303
   204
#define SDLK_NUMLOCK SDLK_NUMLOCKCLEAR
slouken@2268
   205
#define SDLK_SCROLLOCK SDLK_SCROLLLOCK
slouken@2268
   206
#define SDLK_PRINT SDLK_PRINTSCREEN
slouken@2268
   207
slouken@2303
   208
/* The META modifier is equivalent to the GUI modifier from the USB standard */
slouken@2303
   209
#define KMOD_LMETA KMOD_LGUI
slouken@2303
   210
#define KMOD_RMETA KMOD_RGUI
slouken@2303
   211
#define KMOD_META KMOD_GUI
slouken@2268
   212
slouken@2268
   213
/* 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. */
slouken@2268
   214
#define SDLK_LSUPER SDLK_LMETA
slouken@2268
   215
#define SDLK_RSUPER SDLK_RMETA
slouken@2268
   216
#define SDLK_COMPOSE SDLK_APPLICATION
slouken@2268
   217
#define SDLK_BREAK SDLK_STOP
slouken@2268
   218
#define SDLK_EURO SDLK_2
slouken@2268
   219
slouken@2268
   220
slouken@1895
   221
#define SDL_SetModuleHandle(x)
slouken@1895
   222
#define SDL_AllocSurface    SDL_CreateRGBSurface
slouken@1895
   223
slouken@1895
   224
extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
bob@2329
   225
extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
bob@2329
   226
extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
slouken@1895
   227
extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
bob@2328
   228
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,
bob@2328
   229
                                            int height,
bob@2329
   230
                                            int bpp, Uint32 flags);
slouken@1895
   231
extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(SDL_PixelFormat * format,
slouken@1895
   232
                                                 Uint32 flags);
bob@2328
   233
extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width,
bob@2328
   234
                                                      int height,
bob@2329
   235
                                                      int bpp, Uint32 flags);
slouken@1895
   236
extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);
slouken@1895
   237
extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,
bob@2329
   238
                                             int numrects, SDL_Rect * rects);
bob@2328
   239
extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen,
bob@2328
   240
                                            Sint32 x,
bob@2329
   241
                                            Sint32 y, Uint32 w, Uint32 h);
slouken@1895
   242
extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen);
bob@2328
   243
extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface,
bob@2329
   244
                                         Uint32 flag, Uint8 alpha);
slouken@1895
   245
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);
bob@2329
   246
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
bob@2329
   247
                                                            surface);
slouken@1895
   248
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
slouken@1895
   249
                                               const char *icon);
slouken@2043
   250
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,
slouken@2043
   251
                                               const char **icon);
bob@2329
   252
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);
slouken@1895
   253
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
slouken@1895
   254
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
slouken@1895
   255
extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
bob@2328
   256
extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface,
bob@2328
   257
                                           int flags,
slouken@1895
   258
                                           const SDL_Color * colors,
bob@2329
   259
                                           int firstcolor, int ncolors);
slouken@1895
   260
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
slouken@1895
   261
                                          const SDL_Color * colors,
bob@2329
   262
                                          int firstcolor, int ncolors);
slouken@1895
   263
extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info);
slouken@1895
   264
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
bob@2329
   265
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
slouken@1895
   266
extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
slouken@1895
   267
                                                          int height,
slouken@1895
   268
                                                          Uint32 format,
slouken@1895
   269
                                                          SDL_Surface *
slouken@1895
   270
                                                          display);
slouken@1895
   271
extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay);
slouken@1895
   272
extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);
slouken@1895
   273
extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
slouken@1895
   274
                                                  SDL_Rect * dstrect);
slouken@1895
   275
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
slouken@1912
   276
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
bob@2329
   277
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
bob@2329
   278
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
slouken@2303
   279
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
slouken@1895
   280
slouken@1895
   281
/* Ends C function definitions when using C++ */
slouken@1895
   282
#ifdef __cplusplus
slouken@1895
   283
/* *INDENT-OFF* */
slouken@1895
   284
}
slouken@1895
   285
/* *INDENT-ON* */
slouken@1895
   286
#endif
slouken@1895
   287
#include "close_code.h"
slouken@1895
   288
slouken@1895
   289
#endif /* _SDL_compat_h */
slouken@1895
   290
slouken@1895
   291
/* vi: set ts=4 sw=4 expandtab: */