Path: blob/main/system/include/SDL/SDL_compat.h
6169 views
/*1Simple DirectMedia Layer2Copyright (C) 1997-2011 Sam Lantinga <[email protected]>34This software is provided 'as-is', without any express or implied5warranty. In no event will the authors be held liable for any damages6arising from the use of this software.78Permission is granted to anyone to use this software for any purpose,9including commercial applications, and to alter it and redistribute it10freely, subject to the following restrictions:11121. The origin of this software must not be misrepresented; you must not13claim that you wrote the original software. If you use this software14in a product, an acknowledgment in the product documentation would be15appreciated but is not required.162. Altered source versions must be plainly marked as such, and must not be17misrepresented as being the original software.183. This notice may not be removed or altered from any source distribution.19*/2021/**22* \defgroup Compatibility SDL 1.2 Compatibility API23*/24/*@{*/2526/**27* \file SDL_compat.h28*29* This file contains functions for backwards compatibility with SDL 1.2.30*/3132/**33* \def SDL_NO_COMPAT34*35* #define SDL_NO_COMPAT to prevent SDL_compat.h from being included.36* SDL_NO_COMPAT is intended to make it easier to covert SDL 1.2 code to37* SDL 1.3/2.0.38*/3940/*@}*/4142#ifdef SDL_NO_COMPAT43#define _SDL_compat_h44#endif4546#ifndef _SDL_compat_h47#define _SDL_compat_h4849#include "SDL_video.h"50#include "SDL_version.h"5152#include "begin_code.h"53/* Set up for C function definitions, even when using C++ */54#ifdef __cplusplus55/* *INDENT-OFF* */56extern "C" {57/* *INDENT-ON* */58#endif5960/**61* \addtogroup Compatibility62*/63/*@{*/6465/* Platform */66#ifdef __WIN32__67#undef __WIN32__68#define __WIN32__ 169#endif7071/**72* \name Surface flags73*/74/*@{*/75#define SDL_SWSURFACE 0x00000000 /**< \note Not used */76#define SDL_SRCALPHA 0x0001000077#define SDL_SRCCOLORKEY 0x0002000078#define SDL_ANYFORMAT 0x0010000079#define SDL_HWPALETTE 0x0020000080#define SDL_DOUBLEBUF 0x0040000081#define SDL_FULLSCREEN 0x0080000082#define SDL_RESIZABLE 0x0100000083#define SDL_NOFRAME 0x0200000084#define SDL_OPENGL 0x0400000085#define SDL_HWSURFACE 0x08000001 /**< \note Not used */86#define SDL_ASYNCBLIT 0x08000000 /**< \note Not used */87#define SDL_RLEACCELOK 0x08000000 /**< \note Not used */88#define SDL_HWACCEL 0x08000000 /**< \note Not used */89/*@}*//*Surface flags*/9091#define SDL_APPMOUSEFOCUS 0x0192#define SDL_APPINPUTFOCUS 0x0293#define SDL_APPACTIVE 0x049495#define SDL_LOGPAL 0x0196#define SDL_PHYSPAL 0x029798#define SDL_ACTIVEEVENT SDL_EVENT_COMPAT199#define SDL_VIDEORESIZE SDL_EVENT_COMPAT2100#define SDL_VIDEOEXPOSE SDL_EVENT_COMPAT3101#define SDL_ACTIVEEVENTMASK SDL_ACTIVEEVENT, SDL_ACTIVEEVENT102#define SDL_VIDEORESIZEMASK SDL_VIDEORESIZE, SDL_VIDEORESIZE103#define SDL_VIDEOEXPOSEMASK SDL_VIDEOEXPOSE, SDL_VIDEOEXPOSE104#define SDL_WINDOWEVENTMASK SDL_WINDOWEVENT, SDL_WINDOWEVENT105#define SDL_KEYDOWNMASK SDL_KEYDOWN, SDL_KEYDOWN106#define SDL_KEYUPMASK SDL_KEYUP, SDL_KEYUP107#define SDL_KEYEVENTMASK SDL_KEYDOWN, SDL_KEYUP108#define SDL_TEXTEDITINGMASK SDL_TEXTEDITING, SDL_TEXTEDITING109#define SDL_TEXTINPUTMASK SDL_TEXTINPUT, SDL_TEXTINPUT110#define SDL_MOUSEMOTIONMASK SDL_MOUSEMOTION, SDL_MOUSEMOTION111#define SDL_MOUSEBUTTONDOWNMASK SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONDOWN112#define SDL_MOUSEBUTTONUPMASK SDL_MOUSEBUTTONUP, SDL_MOUSEBUTTONUP113#define SDL_MOUSEWHEELMASK SDL_MOUSEWHEEL, SDL_MOUSEWHEEL114#define SDL_MOUSEEVENTMASK SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP115#define SDL_JOYAXISMOTIONMASK SDL_JOYAXISMOTION, SDL_JOYAXISMOTION116#define SDL_JOYBALLMOTIONMASK SDL_JOYBALLMOTION, SDL_JOYBALLMOTION117#define SDL_JOYHATMOTIONMASK SDL_JOYHATMOTION, SDL_JOYHATMOTION118#define SDL_JOYBUTTONDOWNMASK SDL_JOYBUTTONDOWN, SDL_JOYBUTTONDOWN119#define SDL_JOYBUTTONUPMASK SDL_JOYBUTTONUP, SDL_JOYBUTTONUP120#define SDL_JOYEVENTMASK SDL_JOYAXISMOTION, SDL_JOYBUTTONUP121#define SDL_QUITMASK SDL_QUIT, SDL_QUIT122#define SDL_SYSWMEVENTMASK SDL_SYSWMEVENT, SDL_SYSWMEVENT123#define SDL_PROXIMITYINMASK SDL_PROXIMITYIN, SDL_PROXIMITYIN124#define SDL_PROXIMITYOUTMASK SDL_PROXIMITYOUT, SDL_PROXIMITYOUT125#define SDL_ALLEVENTS SDL_FIRSTEVENT, SDL_LASTEVENT126127#define SDL_BUTTON_WHEELUP 4128#define SDL_BUTTON_WHEELDOWN 5129130#define SDL_DEFAULT_REPEAT_DELAY 500131#define SDL_DEFAULT_REPEAT_INTERVAL 30132133typedef struct SDL_VideoInfo134{135Uint32 hw_available:1;136Uint32 wm_available:1;137Uint32 UnusedBits1:6;138Uint32 UnusedBits2:1;139Uint32 blit_hw:1;140Uint32 blit_hw_CC:1;141Uint32 blit_hw_A:1;142Uint32 blit_sw:1;143Uint32 blit_sw_CC:1;144Uint32 blit_sw_A:1;145Uint32 blit_fill:1;146Uint32 UnusedBits3:16;147Uint32 video_mem;148149SDL_PixelFormat *vfmt;150151int current_w;152int current_h;153} SDL_VideoInfo;154155/**156* \name Overlay formats157*158* The most common video overlay formats.159*160* For an explanation of these pixel formats, see:161* http://www.webartz.com/fourcc/indexyuv.htm162*163* For information on the relationship between color spaces, see:164* http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html165*/166/*@{*/167#define SDL_YV12_OVERLAY 0x32315659 /**< Planar mode: Y + V + U (3 planes) */168#define SDL_IYUV_OVERLAY 0x56555949 /**< Planar mode: Y + U + V (3 planes) */169#define SDL_YUY2_OVERLAY 0x32595559 /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */170#define SDL_UYVY_OVERLAY 0x59565955 /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */171#define SDL_YVYU_OVERLAY 0x55595659 /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */172/*@}*//*Overlay formats*/173174/**175* The YUV hardware video overlay.176*/177typedef struct SDL_Overlay178{179Uint32 format; /**< Read-only */180int w, h; /**< Read-only */181int planes; /**< Read-only */182Uint16 *pitches; /**< Read-only */183Uint8 **pixels; /**< Read-write */184185/**186* \name Hardware-specific surface info187*/188/*@{*/189struct private_yuvhwfuncs *hwfuncs;190struct private_yuvhwdata *hwdata;191/*@}*//*Hardware-specific surface info*/192193/**194* \name Special flags195*/196/*@{*/197Uint32 hw_overlay:1; /**< Flag: This overlay hardware accelerated? */198Uint32 UnusedBits:31;199/*@}*//*Special flags*/200} SDL_Overlay;201202typedef enum203{204SDL_GRAB_QUERY = -1,205SDL_GRAB_OFF = 0,206SDL_GRAB_ON = 1207} SDL_GrabMode;208209struct SDL_SysWMinfo;210211/**212* \name Obsolete or renamed key codes213*/214/*@{*/215216#define SDL_keysym SDL_Keysym217#define SDL_KeySym SDL_Keysym218#define SDL_scancode SDL_Scancode219#define SDL_ScanCode SDL_Scancode220#define SDLKey SDL_Keycode221#define SDLMod SDL_Keymod222223/**224* \name Renamed keys225*226* These key constants were renamed for clarity or consistency.227*/228/*@{*/229#define SDLK_KP0 SDLK_KP_0230#define SDLK_KP1 SDLK_KP_1231#define SDLK_KP2 SDLK_KP_2232#define SDLK_KP3 SDLK_KP_3233#define SDLK_KP4 SDLK_KP_4234#define SDLK_KP5 SDLK_KP_5235#define SDLK_KP6 SDLK_KP_6236#define SDLK_KP7 SDLK_KP_7237#define SDLK_KP8 SDLK_KP_8238#define SDLK_KP9 SDLK_KP_9239#define SDLK_NUMLOCK SDLK_NUMLOCKCLEAR240#define SDLK_SCROLLOCK SDLK_SCROLLLOCK241#define SDLK_PRINT SDLK_PRINTSCREEN242#define SDLK_LMETA SDLK_LGUI243#define SDLK_RMETA SDLK_RGUI244/*@}*//*Renamed keys*/245246/**247* \name META modifier248*249* The META modifier is equivalent to the GUI modifier from the USB standard.250*/251/*@{*/252#define KMOD_LMETA KMOD_LGUI253#define KMOD_RMETA KMOD_RGUI254#define KMOD_META KMOD_GUI255/*@}*//*META modifier*/256257/**258* \name Not in USB259*260* These keys don't appear in the USB specification (or at least not under261* those names). I'm unsure if the following assignments make sense or if these262* codes should be defined as actual additional SDLK_ constants.263*/264/*@{*/265#define SDLK_LSUPER SDLK_LMETA266#define SDLK_RSUPER SDLK_RMETA267#define SDLK_COMPOSE SDLK_APPLICATION268#define SDLK_BREAK SDLK_STOP269#define SDLK_EURO SDLK_2270/*@}*//*Not in USB*/271272/*@}*//*Obsolete or renamed key codes*/273274#define SDL_SetModuleHandle(x)275#define SDL_AllocSurface SDL_CreateRGBSurface276277extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);278extern DECLSPEC const char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);279extern DECLSPEC const char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);280extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);281extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,282int height,283int bpp, Uint32 flags);284extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(const SDL_PixelFormat *285format, Uint32 flags);286extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height,287int bpp, Uint32 flags);288extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);289extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,290int numrects, SDL_Rect * rects);291extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen,292Sint32 x,293Sint32 y, Uint32 w, Uint32 h);294extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen);295extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface,296Uint32 flag, Uint8 alpha);297extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);298extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *299surface);300extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,301const char *icon);302extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,303const char **icon);304extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);305extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);306extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);307extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);308extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface,309int flags,310const SDL_Color * colors,311int firstcolor, int ncolors);312extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,313const SDL_Color * colors,314int firstcolor, int ncolors);315extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info);316extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);317extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);318extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,319int height,320Uint32 format,321SDL_Surface *322display);323extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay);324extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);325extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,326SDL_Rect * dstrect);327extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);328extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);329extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);330extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,331const Uint16 * green,332const Uint16 * blue);333extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,334Uint16 * blue);335extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);336extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);337extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);338339typedef SDL_Window* SDL_WindowID;340341#define SDL_KillThread(X)342343/* The timeslice and timer resolution are no longer relevant */344#define SDL_TIMESLICE 10345#define TIMER_RESOLUTION 10346347typedef Uint32 (SDLCALL * SDL_OldTimerCallback) (Uint32 interval);348extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_OldTimerCallback callback);349350extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);351352/*@}*//*Compatibility*/353354/* Ends C function definitions when using C++ */355#ifdef __cplusplus356/* *INDENT-OFF* */357}358/* *INDENT-ON* */359#endif360#include "close_code.h"361362#endif /* _SDL_compat_h */363364/* vi: set ts=4 sw=4 expandtab: */365366367