include/SDL_compat.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 19 Oct 2009 13:31:58 +0000
changeset 3407 d3baf5ac4e37
parent 3164 c5b2884c26b4
child 3536 0267b8b1595c
permissions -rw-r--r--
Partial fix for bug #859

Header file update from Ken for improved doxygen output
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@3407
    23
 /**
slouken@3407
    24
 *  \defgroup Compatibility SDL 1.2 Compatibility API
slouken@3407
    25
 */
slouken@3407
    26
/*@{*/
slouken@1895
    27
slouken@3407
    28
/**
slouken@3407
    29
 *  \file SDL_compat.h
slouken@3407
    30
 *
slouken@3407
    31
 *  This file contains functions for backwards compatibility with SDL 1.2.
slouken@3407
    32
 */
slouken@3407
    33
slouken@3407
    34
/**
slouken@3407
    35
 *  \def SDL_NO_COMPAT
slouken@3407
    36
 *
slouken@3407
    37
 *  #define SDL_NO_COMPAT to prevent SDL_compat.h from being included.
slouken@3407
    38
 *  SDL_NO_COMPAT is intended to make it easier to covert SDL 1.2 code to
slouken@3407
    39
 *  SDL 1.3/2.0.
slouken@3407
    40
 */
slouken@3407
    41
slouken@3407
    42
 /*@}*/
bob@3164
    43
bob@3164
    44
#ifdef SDL_NO_COMPAT
bob@3164
    45
#define _SDL_compat_h
bob@3164
    46
#endif
bob@3164
    47
slouken@1895
    48
#ifndef _SDL_compat_h
slouken@1895
    49
#define _SDL_compat_h
slouken@1895
    50
slouken@1895
    51
#include "SDL_video.h"
slouken@1895
    52
#include "SDL_version.h"
slouken@1895
    53
slouken@1895
    54
#include "begin_code.h"
slouken@1895
    55
/* Set up for C function definitions, even when using C++ */
slouken@1895
    56
#ifdef __cplusplus
slouken@1895
    57
/* *INDENT-OFF* */
slouken@1895
    58
extern "C" {
slouken@1895
    59
/* *INDENT-ON* */
slouken@1895
    60
#endif
slouken@1895
    61
slouken@3407
    62
/**
slouken@3407
    63
 *  \addtogroup Compatibility
slouken@3407
    64
 */
slouken@3407
    65
/*@{*/
slouken@3407
    66
slouken@3407
    67
/**
slouken@3407
    68
 *  \name Surface flags
slouken@3407
    69
 */
slouken@3407
    70
/*@{*/
slouken@3407
    71
#define SDL_SWSURFACE       0x00000000  /**< \note Not used */
slouken@2267
    72
#define SDL_SRCALPHA        0x00010000
slouken@2267
    73
#define SDL_SRCCOLORKEY     0x00020000
slouken@1895
    74
#define SDL_ANYFORMAT       0x00100000
slouken@1895
    75
#define SDL_HWPALETTE       0x00200000
slouken@1895
    76
#define SDL_DOUBLEBUF       0x00400000
slouken@1895
    77
#define SDL_FULLSCREEN      0x00800000
slouken@1895
    78
#define SDL_RESIZABLE       0x01000000
slouken@1895
    79
#define SDL_NOFRAME         0x02000000
slouken@1895
    80
#define SDL_OPENGL          0x04000000
slouken@3407
    81
#define SDL_HWSURFACE       0x08000001  /**< \note Not used */
slouken@3407
    82
#define SDL_ASYNCBLIT       0x08000000  /**< \note Not used */
slouken@3407
    83
#define SDL_RLEACCELOK      0x08000000  /**< \note Not used */
slouken@3407
    84
#define SDL_HWACCEL         0x08000000  /**< \note Not used */
slouken@3407
    85
/*@}*//*Surface flags*/
slouken@1895
    86
slouken@1895
    87
#define SDL_APPMOUSEFOCUS	0x01
slouken@1895
    88
#define SDL_APPINPUTFOCUS	0x02
slouken@1895
    89
#define SDL_APPACTIVE		0x04
slouken@1895
    90
slouken@1895
    91
#define SDL_LOGPAL 0x01
slouken@1895
    92
#define SDL_PHYSPAL 0x02
slouken@1895
    93
slouken@1895
    94
#define SDL_ACTIVEEVENT	SDL_EVENT_RESERVED1
slouken@1895
    95
#define SDL_VIDEORESIZE	SDL_EVENT_RESERVED2
slouken@1895
    96
#define SDL_VIDEOEXPOSE	SDL_EVENT_RESERVED3
slouken@1895
    97
#define SDL_ACTIVEEVENTMASK	SDL_EVENTMASK(SDL_ACTIVEEVENT)
slouken@1895
    98
#define SDL_VIDEORESIZEMASK SDL_EVENTMASK(SDL_VIDEORESIZE)
slouken@1895
    99
#define SDL_VIDEOEXPOSEMASK SDL_EVENTMASK(SDL_VIDEOEXPOSE)
slouken@1895
   100
slouken@1895
   101
#define SDL_BUTTON_WHEELUP	4
slouken@1895
   102
#define SDL_BUTTON_WHEELDOWN	5
slouken@1895
   103
slouken@2129
   104
#define SDL_DEFAULT_REPEAT_DELAY	500
slouken@2129
   105
#define SDL_DEFAULT_REPEAT_INTERVAL	30
slouken@2129
   106
slouken@1895
   107
typedef struct SDL_VideoInfo
slouken@1895
   108
{
slouken@1895
   109
    Uint32 hw_available:1;
slouken@1895
   110
    Uint32 wm_available:1;
slouken@1895
   111
    Uint32 UnusedBits1:6;
slouken@1895
   112
    Uint32 UnusedBits2:1;
slouken@1895
   113
    Uint32 blit_hw:1;
slouken@1895
   114
    Uint32 blit_hw_CC:1;
slouken@1895
   115
    Uint32 blit_hw_A:1;
slouken@1895
   116
    Uint32 blit_sw:1;
slouken@1895
   117
    Uint32 blit_sw_CC:1;
slouken@1895
   118
    Uint32 blit_sw_A:1;
slouken@1895
   119
    Uint32 blit_fill:1;
slouken@1895
   120
    Uint32 UnusedBits3:16;
slouken@1895
   121
    Uint32 video_mem;
slouken@1895
   122
slouken@1895
   123
    SDL_PixelFormat *vfmt;
slouken@2862
   124
slouken@2862
   125
    int current_w;
slouken@2862
   126
    int current_h;
slouken@1895
   127
} SDL_VideoInfo;
slouken@1895
   128
slouken@3407
   129
/**
slouken@3407
   130
 *  \name Overlay formats
slouken@3407
   131
 *
slouken@3407
   132
 *  The most common video overlay formats.
slouken@3407
   133
 *  
slouken@3407
   134
 *  For an explanation of these pixel formats, see:
slouken@3407
   135
 *  http://www.webartz.com/fourcc/indexyuv.htm
slouken@3407
   136
 *  
slouken@3407
   137
 *  For information on the relationship between color spaces, see:
slouken@3407
   138
 *  http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
slouken@3407
   139
 */
slouken@3407
   140
/*@{*/
slouken@3407
   141
#define SDL_YV12_OVERLAY  0x32315659    /**< Planar mode: Y + V + U  (3 planes) */
slouken@3407
   142
#define SDL_IYUV_OVERLAY  0x56555949    /**< Planar mode: Y + U + V  (3 planes) */
slouken@3407
   143
#define SDL_YUY2_OVERLAY  0x32595559    /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
slouken@3407
   144
#define SDL_UYVY_OVERLAY  0x59565955    /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
slouken@3407
   145
#define SDL_YVYU_OVERLAY  0x55595659    /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
slouken@3407
   146
/*@}*//*Overlay formats*/
slouken@1895
   147
slouken@3407
   148
/**
slouken@3407
   149
 *  The YUV hardware video overlay.
slouken@1895
   150
 */
slouken@1895
   151
typedef struct SDL_Overlay
slouken@1895
   152
{
slouken@3407
   153
    Uint32 format;              /**< Read-only */
slouken@3407
   154
    int w, h;                   /**< Read-only */
slouken@3407
   155
    int planes;                 /**< Read-only */
slouken@3407
   156
    Uint16 *pitches;            /**< Read-only */
slouken@3407
   157
    Uint8 **pixels;             /**< Read-write */
slouken@1895
   158
slouken@3407
   159
    /** 
slouken@3407
   160
     *  \name Hardware-specific surface info
slouken@3407
   161
     */
slouken@3407
   162
    /*@{*/
slouken@1895
   163
    struct private_yuvhwfuncs *hwfuncs;
slouken@1895
   164
    struct private_yuvhwdata *hwdata;
slouken@3407
   165
    /*@}*//*Hardware-specific surface info*/
slouken@1895
   166
slouken@3407
   167
    /** 
slouken@3407
   168
     *  \name Special flags
slouken@3407
   169
     */
slouken@3407
   170
    /*@{*/
slouken@3407
   171
    Uint32 hw_overlay:1;        /**< Flag: This overlay hardware accelerated? */
slouken@1895
   172
    Uint32 UnusedBits:31;
slouken@3407
   173
    /*@}*//*Special flags*/
slouken@1895
   174
} SDL_Overlay;
slouken@1895
   175
slouken@1895
   176
typedef enum
slouken@1895
   177
{
slouken@1895
   178
    SDL_GRAB_QUERY = -1,
slouken@1895
   179
    SDL_GRAB_OFF = 0,
slouken@1895
   180
    SDL_GRAB_ON = 1
slouken@1895
   181
} SDL_GrabMode;
slouken@1895
   182
slouken@1895
   183
struct SDL_SysWMinfo;
slouken@1895
   184
slouken@3407
   185
/**
slouken@3407
   186
 *  \name Obsolete or renamed key codes
slouken@3407
   187
 */
slouken@3407
   188
/*@{*/
slouken@2268
   189
slouken@3407
   190
/** 
slouken@3407
   191
 *  \name Renamed keys
slouken@3407
   192
 *
slouken@3407
   193
 *  These key constants were renamed for clarity or consistency. 
slouken@3407
   194
 */
slouken@3407
   195
/*@{*/
slouken@2709
   196
#define SDLK_0	'0'
slouken@2709
   197
#define SDLK_1	'1'
slouken@2709
   198
#define SDLK_2	'2'
slouken@2709
   199
#define SDLK_3	'3'
slouken@2709
   200
#define SDLK_4	'4'
slouken@2709
   201
#define SDLK_5	'5'
slouken@2709
   202
#define SDLK_6	'6'
slouken@2709
   203
#define SDLK_7	'7'
slouken@2709
   204
#define SDLK_8	'8'
slouken@2709
   205
#define SDLK_9	'9'
slouken@2303
   206
#define SDLK_a  'a'
slouken@2303
   207
#define SDLK_b  'b'
slouken@2303
   208
#define SDLK_c  'c'
slouken@2303
   209
#define SDLK_d  'd'
slouken@2303
   210
#define SDLK_e  'e'
slouken@2303
   211
#define SDLK_f  'f'
slouken@2303
   212
#define SDLK_g  'g'
slouken@2303
   213
#define SDLK_h  'h'
slouken@2303
   214
#define SDLK_i  'i'
slouken@2303
   215
#define SDLK_j  'j'
slouken@2303
   216
#define SDLK_k  'k'
slouken@2303
   217
#define SDLK_l  'l'
slouken@2303
   218
#define SDLK_m  'm'
slouken@2303
   219
#define SDLK_n  'n'
slouken@2303
   220
#define SDLK_o  'o'
slouken@2303
   221
#define SDLK_p  'p'
slouken@2303
   222
#define SDLK_q  'q'
slouken@2303
   223
#define SDLK_r  'r'
slouken@2303
   224
#define SDLK_s  's'
slouken@2303
   225
#define SDLK_t  't'
slouken@2303
   226
#define SDLK_u  'u'
slouken@2303
   227
#define SDLK_v  'v'
slouken@2303
   228
#define SDLK_w  'w'
slouken@2303
   229
#define SDLK_x  'x'
slouken@2303
   230
#define SDLK_y  'y'
slouken@2303
   231
#define SDLK_z  'z'
slouken@2303
   232
#define SDLK_QUOTE      '\''
slouken@2303
   233
#define SDLK_MINUS      '-'
slouken@2303
   234
#define SDLK_BACKQUOTE  '`'
slouken@2303
   235
#define SDLK_EXCLAIM    '!'
slouken@2303
   236
#define SDLK_QUOTEDBL   '"'
slouken@2303
   237
#define SDLK_HASH       '#'
slouken@2303
   238
#define SDLK_DOLLAR     '$'
slouken@2303
   239
#define SDLK_AMPERSAND  '&'
slouken@2303
   240
#define SDLK_LEFTPAREN  '('
slouken@2303
   241
#define SDLK_RIGHTPAREN ')'
slouken@2303
   242
#define SDLK_ASTERISK   '*'
slouken@2303
   243
#define SDLK_PLUS       '+'
slouken@2303
   244
#define SDLK_COLON      ':'
slouken@2303
   245
#define SDLK_LESS       '<'
slouken@2303
   246
#define SDLK_GREATER    '>'
slouken@2303
   247
#define SDLK_QUESTION   '?'
slouken@2303
   248
#define SDLK_AT         '@'
slouken@2303
   249
#define SDLK_CARET      '^'
slouken@2303
   250
#define SDLK_UNDERSCORE '_'
slouken@2268
   251
#define SDLK_KP0 SDLK_KP_0
slouken@2268
   252
#define SDLK_KP1 SDLK_KP_1
slouken@2268
   253
#define SDLK_KP2 SDLK_KP_2
slouken@2268
   254
#define SDLK_KP3 SDLK_KP_3
slouken@2268
   255
#define SDLK_KP4 SDLK_KP_4
slouken@2268
   256
#define SDLK_KP5 SDLK_KP_5
slouken@2268
   257
#define SDLK_KP6 SDLK_KP_6
slouken@2268
   258
#define SDLK_KP7 SDLK_KP_7
slouken@2268
   259
#define SDLK_KP8 SDLK_KP_8
slouken@2268
   260
#define SDLK_KP9 SDLK_KP_9
slouken@2303
   261
#define SDLK_NUMLOCK SDLK_NUMLOCKCLEAR
slouken@2268
   262
#define SDLK_SCROLLOCK SDLK_SCROLLLOCK
slouken@2268
   263
#define SDLK_PRINT SDLK_PRINTSCREEN
slouken@3407
   264
/*@}*//*Renamed keys*/
slouken@2268
   265
slouken@3407
   266
/**
slouken@3407
   267
 *  \name META modifier
slouken@3407
   268
 *  
slouken@3407
   269
 *  The META modifier is equivalent to the GUI modifier from the USB standard.
slouken@3407
   270
 */
slouken@3407
   271
/*@{*/
slouken@2303
   272
#define KMOD_LMETA KMOD_LGUI
slouken@2303
   273
#define KMOD_RMETA KMOD_RGUI
slouken@2303
   274
#define KMOD_META KMOD_GUI
slouken@3407
   275
/*@}*//*META modifier*/
slouken@2268
   276
slouken@3407
   277
/** 
slouken@3407
   278
 *  \name Not in USB
slouken@3407
   279
 *
slouken@3407
   280
 *  These keys don't appear in the USB specification (or at least not under 
slouken@3407
   281
 *  those names). I'm unsure if the following assignments make sense or if these
slouken@3407
   282
 *  codes should be defined as actual additional SDLK_ constants.
slouken@3407
   283
 */
slouken@3407
   284
/*@{*/
slouken@2268
   285
#define SDLK_LSUPER SDLK_LMETA
slouken@2268
   286
#define SDLK_RSUPER SDLK_RMETA
slouken@2268
   287
#define SDLK_COMPOSE SDLK_APPLICATION
slouken@2268
   288
#define SDLK_BREAK SDLK_STOP
slouken@2268
   289
#define SDLK_EURO SDLK_2
slouken@3407
   290
/*@}*//*Not in USB*/
slouken@2268
   291
slouken@3407
   292
/*@}*//*Obsolete or renamed key codes*/
slouken@2268
   293
slouken@1895
   294
#define SDL_SetModuleHandle(x)
slouken@1895
   295
#define SDL_AllocSurface    SDL_CreateRGBSurface
slouken@1895
   296
slouken@1895
   297
extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
bob@2329
   298
extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
bob@2329
   299
extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
slouken@1895
   300
extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
bob@2328
   301
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,
bob@2328
   302
                                            int height,
bob@2329
   303
                                            int bpp, Uint32 flags);
slouken@3040
   304
extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(const SDL_PixelFormat *
slouken@3040
   305
                                                 format, Uint32 flags);
slouken@3040
   306
extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height,
bob@2329
   307
                                                      int bpp, Uint32 flags);
slouken@1895
   308
extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);
slouken@1895
   309
extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,
bob@2329
   310
                                             int numrects, SDL_Rect * rects);
bob@2328
   311
extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen,
bob@2328
   312
                                            Sint32 x,
bob@2329
   313
                                            Sint32 y, Uint32 w, Uint32 h);
slouken@1895
   314
extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen);
bob@2328
   315
extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface,
bob@2329
   316
                                         Uint32 flag, Uint8 alpha);
slouken@1895
   317
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);
bob@2329
   318
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
bob@2329
   319
                                                            surface);
slouken@1895
   320
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
slouken@1895
   321
                                               const char *icon);
slouken@2043
   322
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,
slouken@2043
   323
                                               const char **icon);
bob@2329
   324
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);
slouken@1895
   325
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
slouken@1895
   326
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
slouken@1895
   327
extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
bob@2328
   328
extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface,
bob@2328
   329
                                           int flags,
slouken@1895
   330
                                           const SDL_Color * colors,
bob@2329
   331
                                           int firstcolor, int ncolors);
slouken@1895
   332
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
slouken@1895
   333
                                          const SDL_Color * colors,
bob@2329
   334
                                          int firstcolor, int ncolors);
slouken@1895
   335
extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info);
slouken@1895
   336
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
bob@2329
   337
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
slouken@1895
   338
extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
slouken@1895
   339
                                                          int height,
slouken@1895
   340
                                                          Uint32 format,
slouken@1895
   341
                                                          SDL_Surface *
slouken@1895
   342
                                                          display);
slouken@1895
   343
extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay);
slouken@1895
   344
extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);
slouken@1895
   345
extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
slouken@1895
   346
                                                  SDL_Rect * dstrect);
slouken@1895
   347
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
slouken@1912
   348
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
bob@2329
   349
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
bob@2329
   350
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
slouken@2303
   351
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
slouken@1895
   352
slouken@3407
   353
/*@}*//*Compatibility*/
slouken@3407
   354
slouken@1895
   355
/* Ends C function definitions when using C++ */
slouken@1895
   356
#ifdef __cplusplus
slouken@1895
   357
/* *INDENT-OFF* */
slouken@1895
   358
}
slouken@1895
   359
/* *INDENT-ON* */
slouken@1895
   360
#endif
slouken@1895
   361
#include "close_code.h"
slouken@1895
   362
slouken@1895
   363
#endif /* _SDL_compat_h */
slouken@1895
   364
slouken@1895
   365
/* vi: set ts=4 sw=4 expandtab: */