include/SDL_compat.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 11 Aug 2007 20:54:31 +0000
changeset 2222 926294b2bb4e
parent 2153 760c1bd2d625
child 2266 e61ad15a205f
permissions -rw-r--r--
Emphasized the separation between SDL_Surface and SDL_Texture
- SDL_Surface is a system memory representation of pixel data
- SDL_Texture is a video memory representation of pixel data

The concept of SDL_Surface with SDL_HWSURFACE is no longer used.

Separated SDL_Texture types by usage rather than memory type
- SDL_TEXTUREACCESS_STATIC is for rarely changed pixel data,
can be placed in video memory.
- SDL_TEXTUREACCESS_STREAMING is for frequently changing pixel
data, usually placed in system memory or AGP memory.

Optimized the SDL_compat usage of the OpenGL renderer by only
using one copy of the framebuffer instead of two.
slouken@1895
     1
/*
slouken@1895
     2
    SDL - Simple DirectMedia Layer
slouken@1895
     3
    Copyright (C) 1997-2006 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@1895
    40
#define SDL_ANYFORMAT       0x00100000
slouken@1895
    41
#define SDL_HWPALETTE       0x00200000
slouken@1895
    42
#define SDL_DOUBLEBUF       0x00400000
slouken@1895
    43
#define SDL_FULLSCREEN      0x00800000
slouken@1895
    44
#define SDL_RESIZABLE       0x01000000
slouken@1895
    45
#define SDL_NOFRAME         0x02000000
slouken@1895
    46
#define SDL_OPENGL          0x04000000
slouken@2222
    47
#define SDL_HWSURFACE       0x08000001  /* Not used */
slouken@1895
    48
#define SDL_ASYNCBLIT       0x08000000  /* Not used */
slouken@1895
    49
#define SDL_HWACCEL         0x08000000  /* Not used */
slouken@1895
    50
slouken@1895
    51
#define SDL_APPMOUSEFOCUS	0x01
slouken@1895
    52
#define SDL_APPINPUTFOCUS	0x02
slouken@1895
    53
#define SDL_APPACTIVE		0x04
slouken@1895
    54
slouken@1895
    55
#define SDL_LOGPAL 0x01
slouken@1895
    56
#define SDL_PHYSPAL 0x02
slouken@1895
    57
slouken@1895
    58
#define SDL_ACTIVEEVENT	SDL_EVENT_RESERVED1
slouken@1895
    59
#define SDL_VIDEORESIZE	SDL_EVENT_RESERVED2
slouken@1895
    60
#define SDL_VIDEOEXPOSE	SDL_EVENT_RESERVED3
slouken@1895
    61
#define SDL_ACTIVEEVENTMASK	SDL_EVENTMASK(SDL_ACTIVEEVENT)
slouken@1895
    62
#define SDL_VIDEORESIZEMASK SDL_EVENTMASK(SDL_VIDEORESIZE)
slouken@1895
    63
#define SDL_VIDEOEXPOSEMASK SDL_EVENTMASK(SDL_VIDEOEXPOSE)
slouken@1895
    64
slouken@1895
    65
#define SDL_BUTTON_WHEELUP	4
slouken@1895
    66
#define SDL_BUTTON_WHEELDOWN	5
slouken@1895
    67
slouken@2129
    68
#define SDL_DEFAULT_REPEAT_DELAY	500
slouken@2129
    69
#define SDL_DEFAULT_REPEAT_INTERVAL	30
slouken@2129
    70
slouken@1895
    71
typedef struct SDL_VideoInfo
slouken@1895
    72
{
slouken@1895
    73
    Uint32 hw_available:1;
slouken@1895
    74
    Uint32 wm_available:1;
slouken@1895
    75
    Uint32 UnusedBits1:6;
slouken@1895
    76
    Uint32 UnusedBits2:1;
slouken@1895
    77
    Uint32 blit_hw:1;
slouken@1895
    78
    Uint32 blit_hw_CC:1;
slouken@1895
    79
    Uint32 blit_hw_A:1;
slouken@1895
    80
    Uint32 blit_sw:1;
slouken@1895
    81
    Uint32 blit_sw_CC:1;
slouken@1895
    82
    Uint32 blit_sw_A:1;
slouken@1895
    83
    Uint32 blit_fill:1;
slouken@1895
    84
    Uint32 UnusedBits3:16;
slouken@1895
    85
    Uint32 video_mem;
slouken@1895
    86
slouken@1895
    87
    SDL_PixelFormat *vfmt;
slouken@1895
    88
} SDL_VideoInfo;
slouken@1895
    89
slouken@1895
    90
/* The most common video overlay formats.
slouken@1895
    91
   For an explanation of these pixel formats, see:
slouken@1895
    92
   http://www.webartz.com/fourcc/indexyuv.htm
slouken@1895
    93
slouken@1895
    94
   For information on the relationship between color spaces, see:
slouken@1895
    95
   http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
slouken@1895
    96
 */
slouken@1895
    97
#define SDL_YV12_OVERLAY  0x32315659    /* Planar mode: Y + V + U  (3 planes) */
slouken@1895
    98
#define SDL_IYUV_OVERLAY  0x56555949    /* Planar mode: Y + U + V  (3 planes) */
slouken@1895
    99
#define SDL_YUY2_OVERLAY  0x32595559    /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
slouken@1895
   100
#define SDL_UYVY_OVERLAY  0x59565955    /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
slouken@1895
   101
#define SDL_YVYU_OVERLAY  0x55595659    /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
slouken@1895
   102
slouken@1895
   103
/* The YUV hardware video overlay */
slouken@1895
   104
typedef struct SDL_Overlay
slouken@1895
   105
{
slouken@1895
   106
    Uint32 format;              /* Read-only */
slouken@1895
   107
    int w, h;                   /* Read-only */
slouken@1895
   108
    int planes;                 /* Read-only */
slouken@1895
   109
    Uint16 *pitches;            /* Read-only */
slouken@1895
   110
    Uint8 **pixels;             /* Read-write */
slouken@1895
   111
slouken@1895
   112
    /* Hardware-specific surface info */
slouken@1895
   113
    struct private_yuvhwfuncs *hwfuncs;
slouken@1895
   114
    struct private_yuvhwdata *hwdata;
slouken@1895
   115
slouken@1895
   116
    /* Special flags */
slouken@1895
   117
    Uint32 hw_overlay:1;        /* Flag: This overlay hardware accelerated? */
slouken@1895
   118
    Uint32 UnusedBits:31;
slouken@1895
   119
} SDL_Overlay;
slouken@1895
   120
slouken@1895
   121
typedef enum
slouken@1895
   122
{
slouken@1895
   123
    SDL_GRAB_QUERY = -1,
slouken@1895
   124
    SDL_GRAB_OFF = 0,
slouken@1895
   125
    SDL_GRAB_ON = 1
slouken@1895
   126
} SDL_GrabMode;
slouken@1895
   127
slouken@1895
   128
struct SDL_SysWMinfo;
slouken@1895
   129
slouken@1895
   130
#define SDL_SetModuleHandle(x)
slouken@1895
   131
#define SDL_AllocSurface    SDL_CreateRGBSurface
slouken@1895
   132
slouken@1895
   133
extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
slouken@1895
   134
extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
slouken@1895
   135
extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
slouken@1895
   136
extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
slouken@1895
   137
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp,
slouken@1895
   138
                                            Uint32 flags);
slouken@1895
   139
extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(SDL_PixelFormat * format,
slouken@1895
   140
                                                 Uint32 flags);
slouken@1895
   141
extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height,
slouken@1895
   142
                                                      int bpp, Uint32 flags);
slouken@1895
   143
extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);
slouken@1895
   144
extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,
slouken@1895
   145
                                             int numrects, SDL_Rect * rects);
slouken@1895
   146
extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen, Sint32 x,
slouken@1895
   147
                                            Sint32 y, Uint32 w, Uint32 h);
slouken@1895
   148
extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen);
slouken@1895
   149
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);
slouken@1895
   150
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
slouken@1895
   151
                                                            surface);
slouken@1895
   152
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
slouken@1895
   153
                                               const char *icon);
slouken@2043
   154
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,
slouken@2043
   155
                                               const char **icon);
slouken@1895
   156
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);
slouken@1895
   157
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
slouken@1895
   158
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
slouken@1895
   159
extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
slouken@1895
   160
extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface, int flags,
slouken@1895
   161
                                           const SDL_Color * colors,
slouken@1895
   162
                                           int firstcolor, int ncolors);
slouken@1895
   163
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
slouken@1895
   164
                                          const SDL_Color * colors,
slouken@1895
   165
                                          int firstcolor, int ncolors);
slouken@1895
   166
extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info);
slouken@1895
   167
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
slouken@1895
   168
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
slouken@1895
   169
extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
slouken@1895
   170
                                                          int height,
slouken@1895
   171
                                                          Uint32 format,
slouken@1895
   172
                                                          SDL_Surface *
slouken@1895
   173
                                                          display);
slouken@1895
   174
extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay);
slouken@1895
   175
extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);
slouken@1895
   176
extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
slouken@1895
   177
                                                  SDL_Rect * dstrect);
slouken@1895
   178
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
slouken@1912
   179
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
slouken@2129
   180
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
slouken@2129
   181
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
slouken@1895
   182
slouken@1895
   183
/* Ends C function definitions when using C++ */
slouken@1895
   184
#ifdef __cplusplus
slouken@1895
   185
/* *INDENT-OFF* */
slouken@1895
   186
}
slouken@1895
   187
/* *INDENT-ON* */
slouken@1895
   188
#endif
slouken@1895
   189
#include "close_code.h"
slouken@1895
   190
slouken@1895
   191
#endif /* _SDL_compat_h */
slouken@1895
   192
slouken@1895
   193
/* vi: set ts=4 sw=4 expandtab: */