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