Changeset 168
- Timestamp:
- 07/17/13 05:20:15 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/lib/sdl12.hh
r62 r168 13 13 //#define NV_SDL_SHARED 14 14 15 #define NV_SDL_C 0 16 #define NV_SDL_12 1 17 #define NV_SDL_20 2 18 19 #if !defined(NV_SDL_VERSION) 20 # define NV_SDL_VERSION NV_SDL_12 21 #endif 22 15 23 #if NV_PLATFORM == NV_WINDOWS 16 # define NV_SDL_PATH "SDL.dll" 24 # define NV_SDL_PATH_12 "SDL.dll" 25 # define NV_SDL_PATH_20 "SDL2.dll" 17 26 #elif NV_PLATFORM == NV_APPLE 18 # define NV_SDL_PATH "SDL.framework/SDL" 27 # define NV_SDL_PATH_12 "SDL.framework/SDL" 28 # define NV_SDL_PATH_20 "SDL2.framework/SDL" 19 29 #else 20 # define NV_SDL_PATH "libSDL-1.2.so.0" 30 # define NV_SDL_PATH_12 "libSDL-1.2.so.0" 31 # define NV_SDL_PATH_20 "libSDL-1.2.so.0" 32 #endif 33 34 #if NV_SDL_VERSION == NV_SDL_12 35 # define NV_SDL_PATH NV_SDL_PATH_12 36 #elif NV_SDL_VERSION == NV_SDL_20 37 # define NV_SDL_PATH NV_SDL_PATH_20 38 #elif NV_SDL_VERSION == NV_SDL_C 39 # define NV_SDL_PATH nullptr 40 #else 41 # error "Unrecognized NV_SDL_VERSION!" 21 42 #endif 22 43 … … 37 58 # define NV_SDL_API extern 38 59 #endif 39 40 #if defined(NV_SDL_DYNAMIC)41 # define NV_SDL_FUN( rtype, fname, fparams ) NV_SDL_API rtype (NV_SDL_APIENTRY *fname) fparams42 #else43 # define NV_SDL_FUN( rtype, fname, fparams ) NV_SDL_API rtype NV_SDL_APIENTRY fname fparams44 #endif45 46 /** REMOVE THIS */47 #define DECLSPEC NV_SDL_API48 #define SDLCALL49 60 50 61 /* SDL_stdinc.h types */ … … 81 92 #define SDL_INIT_AUDIO 0x00000010 82 93 #define SDL_INIT_VIDEO 0x00000020 83 #define SDL_INIT_CDROM 0x0000010084 94 #define SDL_INIT_JOYSTICK 0x00000200 85 #define SDL_INIT_NOPARACHUTE 0x00100000 86 #define SDL_INIT_EVENTTHREAD 0x01000000 87 #define SDL_INIT_EVERYTHING 0x0000FFFF 88 95 #if NV_SDL_VERSION == NV_SDL_20 96 #define SDL_INIT_NOPARACHUTE 0x00100000 97 #define SDL_INIT_EVENTTHREAD 0x01000000 98 #define SDL_INIT_EVERYTHING 0x0000FFFF 99 #else 100 #define SDL_INIT_HAPTIC 0x00001000 101 #define SDL_INIT_GAMECONTROLLER 0x00002000 102 #define SDL_INIT_EVENTS 0x00004000 103 #define SDL_INIT_NOPARACHUTE 0x00100000 104 #define SDL_INIT_EVERYTHING ( \ 105 SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ 106 SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ 107 ) 108 #endif 89 109 /* SDL_error.h defines */ 90 110 typedef enum { … … 97 117 } SDL_errorcode; 98 118 119 #if NV_SDL_VERSION == NV_SDL_20 120 #define SDL_RWOPS_UNKNOWN 0 121 #define SDL_RWOPS_WINFILE 1 122 #define SDL_RWOPS_STDFILE 2 123 #define SDL_RWOPS_JNIFILE 3 124 #define SDL_RWOPS_MEMORY 4 125 #define SDL_RWOPS_MEMORY_RO 5 126 #endif 127 99 128 /* SDL_rwops.h defines */ 100 129 typedef struct SDL_RWops { 101 int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence); 102 int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum); 103 int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num); 104 int (SDLCALL *close)(struct SDL_RWops *context); 130 #if NV_SDL_VERSION == NV_SDL_20 131 Sint64 (NV_SDL_APIENTRY *size)(struct SDL_RWops *context); 132 Sint64 (NV_SDL_APIENTRY *seek)(struct SDL_RWops *context, Sint64 offset, int whence); 133 size_t (NV_SDL_APIENTRY *read)(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum); 134 size_t (NV_SDL_APIENTRY *write)(struct SDL_RWops *context, const void *ptr, size_t size, size_t num); 135 #else 136 int (NV_SDL_APIENTRY *seek)(struct SDL_RWops *context, int offset, int whence); 137 int (NV_SDL_APIENTRY *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum); 138 int (NV_SDL_APIENTRY *write)(struct SDL_RWops *context, const void *ptr, int size, int num); 139 #endif 140 int (NV_SDL_APIENTRY *close)(struct SDL_RWops *context); 105 141 106 142 Uint32 type; … … 128 164 struct { 129 165 void *data1; 166 void *data2; 130 167 } unknown; 131 168 } hidden; … … 137 174 #define SDL_ALPHA_TRANSPARENT 0 138 175 176 #if NV_SDL_VERSION == NV_SDL_20 177 typedef struct 178 { 179 int x; 180 int y; 181 } SDL_Point; 182 183 typedef struct SDL_Rect { 184 int x, y; 185 int w, h; 186 } SDL_Rect; 187 #else 139 188 typedef struct SDL_Rect { 140 189 Sint16 x, y; 141 190 Uint16 w, h; 142 191 } SDL_Rect; 192 #endif 143 193 144 194 typedef struct SDL_Color { … … 146 196 Uint8 g; 147 197 Uint8 b; 198 #if NV_SDL_VERSION == NV_SDL_20 148 199 Uint8 unused; 200 #else 201 Uint8 a; 202 #endif 149 203 } SDL_Color; 150 #define SDL_Colour SDL_Color151 204 152 205 typedef struct SDL_Palette { 153 206 int ncolors; 154 207 SDL_Color *colors; 208 #if NV_SDL_VERSION == NV_SDL_20 209 Uint32 version; 210 int refcount; 211 #endif 212 155 213 } SDL_Palette; 156 214 215 #if NV_SDL_VERSION == NV_SDL_20 216 typedef struct SDL_PixelFormat { 217 Uint32 format; 218 SDL_Palette *palette; 219 Uint8 BitsPerPixel; 220 Uint8 BytesPerPixel; 221 Uint8 padding[2]; 222 Uint32 Rmask; 223 Uint32 Gmask; 224 Uint32 Bmask; 225 Uint32 Amask; 226 Uint8 Rloss; 227 Uint8 Gloss; 228 Uint8 Bloss; 229 Uint8 Aloss; 230 Uint8 Rshift; 231 Uint8 Gshift; 232 Uint8 Bshift; 233 Uint8 Ashift; 234 int refcount; 235 struct SDL_PixelFormat *next; 236 } SDL_PixelFormat; 237 #else 157 238 typedef struct SDL_PixelFormat { 158 239 SDL_Palette *palette; … … 175 256 Uint8 alpha; 176 257 } SDL_PixelFormat; 258 #endif 259 260 #if NV_SDL_VERSION == NV_SDL_20 261 typedef struct 262 { 263 Uint32 format; 264 int w; 265 int h; 266 int refresh_rate; 267 void *driverdata; 268 } SDL_DisplayMode; 269 #endif 177 270 178 271 typedef struct SDL_Surface { … … 234 327 int current_h; 235 328 } SDL_VideoInfo; 236 237 #define SDL_YV12_OVERLAY 0x32315659238 #define SDL_IYUV_OVERLAY 0x56555949239 #define SDL_YUY2_OVERLAY 0x32595559240 #define SDL_UYVY_OVERLAY 0x59565955241 #define SDL_YVYU_OVERLAY 0x55595659242 243 typedef struct SDL_Overlay {244 Uint32 format;245 int w, h;246 int planes;247 Uint16 *pitches;248 Uint8 **pixels;249 struct private_yuvhwfuncs *hwfuncs;250 struct private_yuvhwdata *hwdata;251 Uint32 hw_overlay :1;252 Uint32 UnusedBits :31;253 } SDL_Overlay;254 329 255 330 typedef enum { … … 292 367 Uint16 padding; 293 368 Uint32 size; 294 void ( SDLCALL*callback)(void *userdata, Uint8 *stream, int len);369 void (NV_SDL_APIENTRY *callback)(void *userdata, Uint8 *stream, int len); 295 370 void *userdata; 296 371 } SDL_AudioSpec; … … 319 394 int len_mult; 320 395 double len_ratio; 321 void ( SDLCALL*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);396 void (NV_SDL_APIENTRY *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format); 322 397 int filter_index; 323 398 } SDL_AudioCVT; … … 819 894 } SDL_eventaction; 820 895 821 typedef int ( SDLCALL*SDL_EventFilter)(const SDL_Event *event);896 typedef int (NV_SDL_APIENTRY *SDL_EventFilter)(const SDL_Event *event); 822 897 823 898 #define SDL_QUERY -1 … … 829 904 #define SDL_TIMESLICE 10 830 905 #define TIMER_RESOLUTION 10 831 typedef Uint32 ( SDLCALL*SDL_TimerCallback)(Uint32 interval);832 typedef Uint32 ( SDLCALL*SDL_NewTimerCallback)(Uint32 interval, void *param);906 typedef Uint32 (NV_SDL_APIENTRY *SDL_TimerCallback)(Uint32 interval); 907 typedef Uint32 (NV_SDL_APIENTRY *SDL_NewTimerCallback)(Uint32 interval, void *param); 833 908 typedef struct _SDL_TimerID *SDL_TimerID; 834 909 … … 844 919 } SDL_version; 845 920 846 /* SDL.h functions */ 847 NV_SDL_FUN( int, SDL_Init, (Uint32 flags) ); 848 NV_SDL_FUN( int, SDL_InitSubSystem, (Uint32 flags) ); 849 NV_SDL_FUN( void, SDL_QuitSubSystem, (Uint32 flags) ); 850 NV_SDL_FUN( Uint32, SDL_WasInit, (Uint32 flags) ); 851 NV_SDL_FUN( void, SDL_Quit, (void) ); 852 853 /* SDL_rwops.h functions */ 854 NV_SDL_FUN( SDL_RWops *, SDL_RWFromFile, (const char *file, const char *mode) ); 855 NV_SDL_FUN( SDL_RWops *, SDL_RWFromFP, (FILE *fp, int autoclose) ); 856 NV_SDL_FUN( SDL_RWops *, SDL_RWFromMem, (void *mem, int size) ); 857 NV_SDL_FUN( SDL_RWops *, SDL_RWFromConstMem, (const void *mem, int size) ); 858 NV_SDL_FUN( SDL_RWops *, SDL_AllocRW, (void) ); 859 NV_SDL_FUN( void, SDL_FreeRW, (SDL_RWops *area) ); 860 NV_SDL_FUN( Uint16, SDL_ReadLE16, (SDL_RWops *src) ); 861 NV_SDL_FUN( Uint16, SDL_ReadBE16, (SDL_RWops *src) ); 862 NV_SDL_FUN( Uint32, SDL_ReadLE32, (SDL_RWops *src) ); 863 NV_SDL_FUN( Uint32, SDL_ReadBE32, (SDL_RWops *src) ); 864 NV_SDL_FUN( Uint64, SDL_ReadLE64, (SDL_RWops *src) ); 865 NV_SDL_FUN( Uint64, SDL_ReadBE64, (SDL_RWops *src) ); 866 NV_SDL_FUN( int, SDL_WriteLE16, (SDL_RWops *dst, Uint16 value) ); 867 NV_SDL_FUN( int, SDL_WriteBE16, (SDL_RWops *dst, Uint16 value) ); 868 NV_SDL_FUN( int, SDL_WriteLE32, (SDL_RWops *dst, Uint32 value) ); 869 NV_SDL_FUN( int, SDL_WriteBE32, (SDL_RWops *dst, Uint32 value) ); 870 NV_SDL_FUN( int, SDL_WriteLE64, (SDL_RWops *dst, Uint64 value) ); 871 NV_SDL_FUN( int, SDL_WriteBE64, (SDL_RWops *dst, Uint64 value) ); 872 873 /* SDL_video.h defines */ 874 NV_SDL_FUN( int, SDL_VideoInit, (const char *driver_name, Uint32 flags) ); 875 NV_SDL_FUN( void, SDL_VideoQuit, (void) ); 876 NV_SDL_FUN( char *, SDL_VideoDriverName, (char *namebuf, int maxlen) ); 877 NV_SDL_FUN( SDL_Surface *, SDL_GetVideoSurface, (void) ); 878 NV_SDL_FUN( const SDL_VideoInfo *, SDL_GetVideoInfo, (void) ); 879 NV_SDL_FUN( int, SDL_VideoModeOK, (int width, int height, int bpp, Uint32 flags) ); 880 NV_SDL_FUN( SDL_Rect **, SDL_ListModes, (SDL_PixelFormat *format, Uint32 flags) ); 881 NV_SDL_FUN( SDL_Surface *, SDL_SetVideoMode, (int width, int height, int bpp, Uint32 flags) ); 882 NV_SDL_FUN( void, SDL_UpdateRects, (SDL_Surface *screen, int numrects, SDL_Rect *rects) ); 883 NV_SDL_FUN( void, SDL_UpdateRect, (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) ); 884 NV_SDL_FUN( int, SDL_Flip, (SDL_Surface *screen) ); 885 NV_SDL_FUN( int, SDL_SetGamma, (float red, float green, float blue) ); 886 NV_SDL_FUN( int, SDL_SetGammaRamp, (const Uint16 *red, const Uint16 *green, const Uint16 *blue) ); 887 NV_SDL_FUN( int, SDL_GetGammaRamp, (Uint16 *red, Uint16 *green, Uint16 *blue) ); 888 NV_SDL_FUN( int, SDL_SetColors, (SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors) ); 889 NV_SDL_FUN( int, SDL_SetPalette, (SDL_Surface *surface, int flags, SDL_Color *colors, int firstcolor, int ncolors) ); 890 NV_SDL_FUN( Uint32, SDL_MapRGB, (const SDL_PixelFormat * const format, const Uint8 r, const Uint8 g, const Uint8 b) ); 891 NV_SDL_FUN( Uint32, SDL_MapRGBA, (const SDL_PixelFormat * const format, const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a) ); 892 NV_SDL_FUN( void, SDL_GetRGB, (Uint32 pixel, const SDL_PixelFormat * const fmt, Uint8 *r, Uint8 *g, Uint8 *b) ); 893 NV_SDL_FUN( void, SDL_GetRGBA, (Uint32 pixel, const SDL_PixelFormat * const fmt, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) ); 894 NV_SDL_FUN( SDL_Surface *, SDL_CreateRGBSurface, (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) ); 895 NV_SDL_FUN( SDL_Surface *, SDL_CreateRGBSurfaceFrom, (void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) ); 896 NV_SDL_FUN( void, SDL_FreeSurface, (SDL_Surface *surface) ); 897 NV_SDL_FUN( int, SDL_LockSurface, (SDL_Surface *surface) ); 898 NV_SDL_FUN( void, SDL_UnlockSurface, (SDL_Surface *surface) ); 899 NV_SDL_FUN( SDL_Surface *, SDL_LoadBMP_RW, (SDL_RWops *src, int freesrc) ); 900 NV_SDL_FUN( int, SDL_SaveBMP_RW, (SDL_Surface *surface, SDL_RWops *dst, int freedst) ); 901 NV_SDL_FUN( int, SDL_SetColorKey, (SDL_Surface *surface, Uint32 flag, Uint32 key) ); 902 NV_SDL_FUN( int, SDL_SetAlpha, (SDL_Surface *surface, Uint32 flag, Uint8 alpha) ); 903 NV_SDL_FUN( SDL_bool, SDL_SetClipRect, (SDL_Surface *surface, const SDL_Rect *rect) ); 904 NV_SDL_FUN( void, SDL_GetClipRect, (SDL_Surface *surface, SDL_Rect *rect) ); 905 NV_SDL_FUN( SDL_Surface *, SDL_ConvertSurface, (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags) ); 906 NV_SDL_FUN( int, SDL_UpperBlit, (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) ); 907 NV_SDL_FUN( int, SDL_LowerBlit, (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) ); 908 NV_SDL_FUN( int, SDL_FillRect, (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) ); 909 NV_SDL_FUN( SDL_Surface *, SDL_DisplayFormat, (SDL_Surface *surface) ); 910 NV_SDL_FUN( SDL_Surface *, SDL_DisplayFormatAlpha, (SDL_Surface *surface) ); 911 NV_SDL_FUN( SDL_Overlay *, SDL_CreateYUVOverlay, (int width, int height, Uint32 format, SDL_Surface *display) ); 912 NV_SDL_FUN( int, SDL_LockYUVOverlay, (SDL_Overlay *overlay) ); 913 NV_SDL_FUN( void, SDL_UnlockYUVOverlay, (SDL_Overlay *overlay) ); 914 NV_SDL_FUN( int, SDL_DisplayYUVOverlay, (SDL_Overlay *overlay, SDL_Rect *dstrect) ); 915 NV_SDL_FUN( void, SDL_FreeYUVOverlay, (SDL_Overlay *overlay) ); 916 NV_SDL_FUN( int, SDL_GL_LoadLibrary, (const char *path) ); 917 NV_SDL_FUN( void *, SDL_GL_GetProcAddress, (const char* proc) ); 918 NV_SDL_FUN( int, SDL_GL_SetAttribute, (SDL_GLattr attr, int value) ); 919 NV_SDL_FUN( int, SDL_GL_GetAttribute, (SDL_GLattr attr, int* value) ); 920 NV_SDL_FUN( void, SDL_GL_SwapBuffers, (void) ); 921 NV_SDL_FUN( void, SDL_GL_UpdateRects, (int numrects, SDL_Rect* rects) ); 922 NV_SDL_FUN( void, SDL_GL_Lock, (void) ); 923 NV_SDL_FUN( void, SDL_GL_Unlock, (void) ); 924 NV_SDL_FUN( void, SDL_WM_SetCaption, (const char *title, const char *icon) ); 925 NV_SDL_FUN( void, SDL_WM_GetCaption, (char **title, char **icon) ); 926 NV_SDL_FUN( void, SDL_WM_SetIcon, (SDL_Surface *icon, Uint8 *mask) ); 927 NV_SDL_FUN( int, SDL_WM_IconifyWindow, (void) ); 928 NV_SDL_FUN( int, SDL_WM_ToggleFullScreen, (SDL_Surface *surface) ); 929 NV_SDL_FUN( SDL_GrabMode, SDL_WM_GrabInput, (SDL_GrabMode mode) ); 930 931 /* SDL_audio.h functions */ 932 NV_SDL_FUN( int, SDL_AudioInit, (const char *driver_name) ); 933 NV_SDL_FUN( void, SDL_AudioQuit, (void) ); 934 NV_SDL_FUN( char *, SDL_AudioDriverName, (char *namebuf, int maxlen) ); 935 NV_SDL_FUN( int, SDL_OpenAudio, (SDL_AudioSpec *desired, SDL_AudioSpec *obtained) ); 936 NV_SDL_FUN( SDL_audiostatus, SDL_GetAudioStatus, (void) ); 937 NV_SDL_FUN( void, SDL_PauseAudio, (int pause_on) ); 938 NV_SDL_FUN( SDL_AudioSpec *, SDL_LoadWAV_RW, (SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) ); 939 NV_SDL_FUN( void, SDL_FreeWAV, (Uint8 *audio_buf) ); 940 NV_SDL_FUN( int, SDL_BuildAudioCVT, (SDL_AudioCVT *cvt, Uint16 src_format, Uint8 src_channels, int src_rate, Uint16 dst_format, Uint8 dst_channels, int dst_rate) ); 941 NV_SDL_FUN( int, SDL_ConvertAudio, (SDL_AudioCVT *cvt) ); 942 NV_SDL_FUN( void, SDL_MixAudio, (Uint8 *dst, const Uint8 *src, Uint32 len, int volume) ); 943 NV_SDL_FUN( void, SDL_LockAudio, (void) ); 944 NV_SDL_FUN( void, SDL_UnlockAudio, (void) ); 945 NV_SDL_FUN( void, SDL_CloseAudio, (void) ); 946 947 /* SDL_cpuinfo.h functions */ 948 NV_SDL_FUN( SDL_bool, SDL_HasRDTSC, (void) ); 949 NV_SDL_FUN( SDL_bool, SDL_HasMMX, (void) ); 950 NV_SDL_FUN( SDL_bool, SDL_HasMMXExt, (void) ); 951 NV_SDL_FUN( SDL_bool, SDL_Has3DNow, (void) ); 952 NV_SDL_FUN( SDL_bool, SDL_Has3DNowExt, (void) ); 953 NV_SDL_FUN( SDL_bool, SDL_HasSSE, (void) ); 954 NV_SDL_FUN( SDL_bool, SDL_HasSSE2, (void) ); 955 NV_SDL_FUN( SDL_bool, SDL_HasAltiVec, (void) ); 956 957 /* SDL_error.h functions */ 958 NV_SDL_FUN( void, SDL_SetError, (const char *fmt, ...) ); 959 NV_SDL_FUN( char *, SDL_GetError, (void) ); 960 NV_SDL_FUN( void, SDL_ClearError, (void) ); 961 NV_SDL_FUN( void, SDL_Error, (SDL_errorcode code) ); 962 963 /* SDL_active.h functions */ 964 NV_SDL_FUN( Uint8, SDL_GetAppState, (void) ); 965 966 /* SDL_keyboard.h functions */ 967 NV_SDL_FUN( int, SDL_EnableUNICODE, (int enable) ); 968 NV_SDL_FUN( int, SDL_EnableKeyRepeat, (int delay, int interval) ); 969 NV_SDL_FUN( void, SDL_GetKeyRepeat, (int *delay, int *interval) ); 970 NV_SDL_FUN( Uint8 *, SDL_GetKeyState, (int *numkeys) ); 971 NV_SDL_FUN( SDLMod, SDL_GetModState, (void) ); 972 NV_SDL_FUN( void, SDL_SetModState, (SDLMod modstate) ); 973 NV_SDL_FUN( char *, SDL_GetKeyName, (SDLKey key) ); 974 975 /* SDL_mouse.h functions */ 976 NV_SDL_FUN( Uint8, SDL_GetMouseState, (int *x, int *y) ); 977 NV_SDL_FUN( Uint8, SDL_GetRelativeMouseState, (int *x, int *y) ); 978 NV_SDL_FUN( void, SDL_WarpMouse, (Uint16 x, Uint16 y) ); 979 NV_SDL_FUN( SDL_Cursor *, SDL_CreateCursor, (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y) ); 980 NV_SDL_FUN( void, SDL_SetCursor, (SDL_Cursor *cursor) ); 981 NV_SDL_FUN( SDL_Cursor *, SDL_GetCursor, (void) ); 982 NV_SDL_FUN( void, SDL_FreeCursor, (SDL_Cursor *cursor) ); 983 NV_SDL_FUN( int, SDL_ShowCursor, (int toggle) ); 984 985 /* SDL_joystick.h functions */ 986 NV_SDL_FUN( int, SDL_NumJoysticks, (void) ); 987 NV_SDL_FUN( const char *, SDL_JoystickName, (int device_index) ); 988 NV_SDL_FUN( SDL_Joystick *, SDL_JoystickOpen, (int device_index) ); 989 NV_SDL_FUN( int, SDL_JoystickOpened, (int device_index) ); 990 NV_SDL_FUN( int, SDL_JoystickIndex, (SDL_Joystick *joystick) ); 991 NV_SDL_FUN( int, SDL_JoystickNumAxes, (SDL_Joystick *joystick) ); 992 NV_SDL_FUN( int, SDL_JoystickNumBalls, (SDL_Joystick *joystick) ); 993 NV_SDL_FUN( int, SDL_JoystickNumHats, (SDL_Joystick *joystick) ); 994 NV_SDL_FUN( int, SDL_JoystickNumButtons, (SDL_Joystick *joystick) ); 995 NV_SDL_FUN( void, SDL_JoystickUpdate, (void) ); 996 NV_SDL_FUN( int, SDL_JoystickEventState, (int state) ); 997 NV_SDL_FUN( Sint16, SDL_JoystickGetAxis, (SDL_Joystick *joystick, int axis) ); 998 NV_SDL_FUN( Uint8, SDL_JoystickGetHat, (SDL_Joystick *joystick, int hat) ); 999 NV_SDL_FUN( int, SDL_JoystickGetBall, (SDL_Joystick *joystick, int ball, int *dx, int *dy) ); 1000 NV_SDL_FUN( Uint8, SDL_JoystickGetButton, (SDL_Joystick *joystick, int button) ); 1001 NV_SDL_FUN( void, SDL_JoystickClose, (SDL_Joystick *joystick) ); 1002 1003 /* SDL_timer.h functions */ 1004 NV_SDL_FUN( Uint32, SDL_GetTicks, (void) ); 1005 NV_SDL_FUN( void, SDL_Delay, (Uint32 ms) ); 1006 NV_SDL_FUN( int, SDL_SetTimer, (Uint32 interval, SDL_TimerCallback callback) ); 1007 NV_SDL_FUN( SDL_TimerID, SDL_AddTimer, (Uint32 interval, SDL_NewTimerCallback callback, void *param) ); 1008 NV_SDL_FUN( SDL_bool, SDL_RemoveTimer, (SDL_TimerID t) ); 1009 1010 /* SDL_version.h functions */ 1011 NV_SDL_FUN( const SDL_version *, SDL_Linked_Version, (void) ); 1012 1013 /* SDL_event.h functions */ 1014 NV_SDL_FUN( void, SDL_PumpEvents, (void) ); 1015 NV_SDL_FUN( int, SDL_PeepEvents, (SDL_Event *events, int numevents, SDL_eventaction action, Uint32 mask) ); 1016 NV_SDL_FUN( int, SDL_PollEvent, (SDL_Event *event) ); 1017 NV_SDL_FUN( int, SDL_WaitEvent, (SDL_Event *event) ); 1018 NV_SDL_FUN( int, SDL_PushEvent, (SDL_Event *event) ); 1019 NV_SDL_FUN( void, SDL_SetEventFilter, (SDL_EventFilter filter) ); 1020 NV_SDL_FUN( SDL_EventFilter, SDL_GetEventFilter, (void) ); 1021 NV_SDL_FUN( Uint8, SDL_EventState, (Uint8 etype, int state) ); 921 #if defined(NV_SDL_DYNAMIC) 922 # define NV_SDL_FUN( rtype, fname, fparams ) NV_SDL_API rtype (NV_SDL_APIENTRY *fname) fparams 923 #else 924 # define NV_SDL_FUN( rtype, fname, fparams ) NV_SDL_API rtype NV_SDL_APIENTRY fname fparams 925 #endif 926 #include <nv/lib/detail/sdl_functions.inc> 927 #undef NV_SDL_FUN 1022 928 1023 929 #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) -
trunk/nv/lib/sdl_image.hh
r62 r168 38 38 } IMG_InitFlags; 39 39 40 NV_SDL_FUN( const SDL_version *, IMG_Linked_Version, (void) ); 41 NV_SDL_FUN( int, IMG_Init, (int flags) ); 42 NV_SDL_FUN( void, IMG_Quit, (void) ); 43 NV_SDL_FUN( SDL_Surface *, IMG_LoadTyped_RW, (SDL_RWops *src, int freesrc, char *etype) ); 44 NV_SDL_FUN( SDL_Surface *, IMG_Load, (const char *file) ); 45 NV_SDL_FUN( SDL_Surface *, IMG_Load_RW, (SDL_RWops *src, int freesrc) ); 46 NV_SDL_FUN( int, IMG_isICO, (SDL_RWops *src) ); 47 NV_SDL_FUN( int, IMG_isCUR, (SDL_RWops *src) ); 48 NV_SDL_FUN( int, IMG_isBMP, (SDL_RWops *src) ); 49 NV_SDL_FUN( int, IMG_isGIF, (SDL_RWops *src) ); 50 NV_SDL_FUN( int, IMG_isJPG, (SDL_RWops *src) ); 51 NV_SDL_FUN( int, IMG_isPNG, (SDL_RWops *src) ); 52 NV_SDL_FUN( int, IMG_isTIF, (SDL_RWops *src) ); 53 NV_SDL_FUN( SDL_Surface *, IMG_LoadICO_RW, (SDL_RWops *src) ); 54 NV_SDL_FUN( SDL_Surface *, IMG_LoadCUR_RW, (SDL_RWops *src) ); 55 NV_SDL_FUN( SDL_Surface *, IMG_LoadBMP_RW, (SDL_RWops *src) ); 56 NV_SDL_FUN( SDL_Surface *, IMG_LoadGIF_RW, (SDL_RWops *src) ); 57 NV_SDL_FUN( SDL_Surface *, IMG_LoadJPG_RW, (SDL_RWops *src) ); 58 NV_SDL_FUN( SDL_Surface *, IMG_LoadPNG_RW, (SDL_RWops *src) ); 59 NV_SDL_FUN( SDL_Surface *, IMG_LoadTGA_RW, (SDL_RWops *src) ); 60 NV_SDL_FUN( SDL_Surface *, IMG_LoadTIF_RW, (SDL_RWops *src) ); 40 #if defined(NV_SDL_DYNAMIC) 41 # define NV_SDL_FUN( rtype, fname, fparams ) NV_SDL_API rtype (NV_SDL_APIENTRY *fname) fparams 42 #else 43 # define NV_SDL_FUN( rtype, fname, fparams ) NV_SDL_API rtype NV_SDL_APIENTRY fname fparams 44 #endif 45 #include <nv/lib/detail/sdl_image_functions.inc> 46 #undef NV_SDL_FUN 47 61 48 } 62 49 -
trunk/src/lib/sdl12.cc
r109 r168 11 11 #include "nv/library.hh" 12 12 13 /* SDL.h functions */ 14 int (NV_SDL_APIENTRY *SDL_Init) (Uint32 flags) = nullptr; 15 int (NV_SDL_APIENTRY *SDL_InitSubSystem) (Uint32 flags) = nullptr; 16 void (NV_SDL_APIENTRY *SDL_QuitSubSystem) (Uint32 flags) = nullptr; 17 Uint32 (NV_SDL_APIENTRY *SDL_WasInit) (Uint32 flags) = nullptr; 18 void (NV_SDL_APIENTRY *SDL_Quit) (void) = nullptr; 19 20 /* SDL_rwops.h functions */ 21 SDL_RWops * (NV_SDL_APIENTRY *SDL_RWFromFile) (const char *file, const char *mode) = nullptr; 22 SDL_RWops * (NV_SDL_APIENTRY *SDL_RWFromFP) (FILE *fp, int autoclose) = nullptr; 23 SDL_RWops * (NV_SDL_APIENTRY *SDL_RWFromMem) (void *mem, int size) = nullptr; 24 SDL_RWops * (NV_SDL_APIENTRY *SDL_RWFromConstMem) (const void *mem, int size) = nullptr; 25 SDL_RWops * (NV_SDL_APIENTRY *SDL_AllocRW) (void) = nullptr; 26 void (NV_SDL_APIENTRY *SDL_FreeRW) (SDL_RWops *area) = nullptr; 27 Uint16 (NV_SDL_APIENTRY *SDL_ReadLE16) (SDL_RWops *src) = nullptr; 28 Uint16 (NV_SDL_APIENTRY *SDL_ReadBE16) (SDL_RWops *src) = nullptr; 29 Uint32 (NV_SDL_APIENTRY *SDL_ReadLE32) (SDL_RWops *src) = nullptr; 30 Uint32 (NV_SDL_APIENTRY *SDL_ReadBE32) (SDL_RWops *src) = nullptr; 31 Uint64 (NV_SDL_APIENTRY *SDL_ReadLE64) (SDL_RWops *src) = nullptr; 32 Uint64 (NV_SDL_APIENTRY *SDL_ReadBE64) (SDL_RWops *src) = nullptr; 33 int (NV_SDL_APIENTRY *SDL_WriteLE16) (SDL_RWops *dst, Uint16 value) = nullptr; 34 int (NV_SDL_APIENTRY *SDL_WriteBE16) (SDL_RWops *dst, Uint16 value) = nullptr; 35 int (NV_SDL_APIENTRY *SDL_WriteLE32) (SDL_RWops *dst, Uint32 value) = nullptr; 36 int (NV_SDL_APIENTRY *SDL_WriteBE32) (SDL_RWops *dst, Uint32 value) = nullptr; 37 int (NV_SDL_APIENTRY *SDL_WriteLE64) (SDL_RWops *dst, Uint64 value) = nullptr; 38 int (NV_SDL_APIENTRY *SDL_WriteBE64) (SDL_RWops *dst, Uint64 value) = nullptr; 39 40 /* SDL_video.h defines */ 41 int (NV_SDL_APIENTRY *SDL_VideoInit) (const char *driver_name, Uint32 flags) = nullptr; 42 void (NV_SDL_APIENTRY *SDL_VideoQuit) (void) = nullptr; 43 char * (NV_SDL_APIENTRY *SDL_VideoDriverName) (char *namebuf, int maxlen) = nullptr; 44 SDL_Surface * (NV_SDL_APIENTRY *SDL_GetVideoSurface) (void) = nullptr; 45 const SDL_VideoInfo * (NV_SDL_APIENTRY *SDL_GetVideoInfo) (void) = nullptr; 46 int (NV_SDL_APIENTRY *SDL_VideoModeOK) (int width, int height, int bpp, Uint32 flags) = nullptr; 47 SDL_Rect ** (NV_SDL_APIENTRY *SDL_ListModes) (SDL_PixelFormat *format, Uint32 flags) = nullptr; 48 SDL_Surface * (NV_SDL_APIENTRY *SDL_SetVideoMode) (int width, int height, int bpp, Uint32 flags) = nullptr; 49 void (NV_SDL_APIENTRY *SDL_UpdateRects) (SDL_Surface *screen, int numrects, SDL_Rect *rects) = nullptr; 50 void (NV_SDL_APIENTRY *SDL_UpdateRect) (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) = nullptr; 51 int (NV_SDL_APIENTRY *SDL_Flip) (SDL_Surface *screen) = nullptr; 52 int (NV_SDL_APIENTRY *SDL_SetGamma) (float red, float green, float blue) = nullptr; 53 int (NV_SDL_APIENTRY *SDL_SetGammaRamp) (const Uint16 *red, const Uint16 *green, const Uint16 *blue) = nullptr; 54 int (NV_SDL_APIENTRY *SDL_GetGammaRamp) (Uint16 *red, Uint16 *green, Uint16 *blue) = nullptr; 55 int (NV_SDL_APIENTRY *SDL_SetColors) (SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors) = nullptr; 56 int (NV_SDL_APIENTRY *SDL_SetPalette) (SDL_Surface *surface, int flags, SDL_Color *colors, int firstcolor, int ncolors) = nullptr; 57 Uint32 (NV_SDL_APIENTRY *SDL_MapRGB) (const SDL_PixelFormat * const format, const Uint8 r, const Uint8 g, const Uint8 b) = nullptr; 58 Uint32 (NV_SDL_APIENTRY *SDL_MapRGBA) (const SDL_PixelFormat * const format, const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a) = nullptr; 59 void (NV_SDL_APIENTRY *SDL_GetRGB) (Uint32 pixel, const SDL_PixelFormat * const fmt, Uint8 *r, Uint8 *g, Uint8 *b) = nullptr; 60 void (NV_SDL_APIENTRY *SDL_GetRGBA) (Uint32 pixel, const SDL_PixelFormat * const fmt, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) = nullptr; 61 SDL_Surface * (NV_SDL_APIENTRY *SDL_CreateRGBSurface) (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) = nullptr; 62 SDL_Surface * (NV_SDL_APIENTRY *SDL_CreateRGBSurfaceFrom) (void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) = nullptr; 63 void (NV_SDL_APIENTRY *SDL_FreeSurface) (SDL_Surface *surface) = nullptr; 64 int (NV_SDL_APIENTRY *SDL_LockSurface) (SDL_Surface *surface) = nullptr; 65 void (NV_SDL_APIENTRY *SDL_UnlockSurface) (SDL_Surface *surface) = nullptr; 66 SDL_Surface * (NV_SDL_APIENTRY *SDL_LoadBMP_RW) (SDL_RWops *src, int freesrc) = nullptr; 67 int (NV_SDL_APIENTRY *SDL_SaveBMP_RW) (SDL_Surface *surface, SDL_RWops *dst, int freedst) = nullptr; 68 int (NV_SDL_APIENTRY *SDL_SetColorKey) (SDL_Surface *surface, Uint32 flag, Uint32 key) = nullptr; 69 int (NV_SDL_APIENTRY *SDL_SetAlpha) (SDL_Surface *surface, Uint32 flag, Uint8 alpha) = nullptr; 70 SDL_bool (NV_SDL_APIENTRY *SDL_SetClipRect) (SDL_Surface *surface, const SDL_Rect *rect) = nullptr; 71 void (NV_SDL_APIENTRY *SDL_GetClipRect) (SDL_Surface *surface, SDL_Rect *rect) = nullptr; 72 SDL_Surface * (NV_SDL_APIENTRY *SDL_ConvertSurface) (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags) = nullptr; 73 int (NV_SDL_APIENTRY *SDL_UpperBlit) (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) = nullptr; 74 int (NV_SDL_APIENTRY *SDL_LowerBlit) (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) = nullptr; 75 int (NV_SDL_APIENTRY *SDL_FillRect) (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) = nullptr; 76 SDL_Surface * (NV_SDL_APIENTRY *SDL_DisplayFormat) (SDL_Surface *surface) = nullptr; 77 SDL_Surface * (NV_SDL_APIENTRY *SDL_DisplayFormatAlpha) (SDL_Surface *surface) = nullptr; 78 SDL_Overlay * (NV_SDL_APIENTRY *SDL_CreateYUVOverlay) (int width, int height, Uint32 format, SDL_Surface *display) = nullptr; 79 int (NV_SDL_APIENTRY *SDL_LockYUVOverlay) (SDL_Overlay *overlay) = nullptr; 80 void (NV_SDL_APIENTRY *SDL_UnlockYUVOverlay) (SDL_Overlay *overlay) = nullptr; 81 int (NV_SDL_APIENTRY *SDL_DisplayYUVOverlay) (SDL_Overlay *overlay, SDL_Rect *dstrect) = nullptr; 82 void (NV_SDL_APIENTRY *SDL_FreeYUVOverlay) (SDL_Overlay *overlay) = nullptr; 83 int (NV_SDL_APIENTRY *SDL_GL_LoadLibrary) (const char *path) = nullptr; 84 void * (NV_SDL_APIENTRY *SDL_GL_GetProcAddress) (const char* proc) = nullptr; 85 int (NV_SDL_APIENTRY *SDL_GL_SetAttribute) (SDL_GLattr attr, int value) = nullptr; 86 int (NV_SDL_APIENTRY *SDL_GL_GetAttribute) (SDL_GLattr attr, int* value) = nullptr; 87 void (NV_SDL_APIENTRY *SDL_GL_SwapBuffers) (void) = nullptr; 88 void (NV_SDL_APIENTRY *SDL_GL_UpdateRects) (int numrects, SDL_Rect* rects) = nullptr; 89 void (NV_SDL_APIENTRY *SDL_GL_Lock) (void) = nullptr; 90 void (NV_SDL_APIENTRY *SDL_GL_Unlock) (void) = nullptr; 91 void (NV_SDL_APIENTRY *SDL_WM_SetCaption) (const char *title, const char *icon) = nullptr; 92 void (NV_SDL_APIENTRY *SDL_WM_GetCaption) (char **title, char **icon) = nullptr; 93 void (NV_SDL_APIENTRY *SDL_WM_SetIcon) (SDL_Surface *icon, Uint8 *mask) = nullptr; 94 int (NV_SDL_APIENTRY *SDL_WM_IconifyWindow) (void) = nullptr; 95 int (NV_SDL_APIENTRY *SDL_WM_ToggleFullScreen) (SDL_Surface *surface) = nullptr; 96 SDL_GrabMode (NV_SDL_APIENTRY *SDL_WM_GrabInput) (SDL_GrabMode mode) = nullptr; 97 98 /* SDL_audio.h functions */ 99 int (NV_SDL_APIENTRY *SDL_AudioInit) (const char *driver_name) = nullptr; 100 void (NV_SDL_APIENTRY *SDL_AudioQuit) (void) = nullptr; 101 char * (NV_SDL_APIENTRY *SDL_AudioDriverName) (char *namebuf, int maxlen) = nullptr; 102 int (NV_SDL_APIENTRY *SDL_OpenAudio) (SDL_AudioSpec *desired, SDL_AudioSpec *obtained) = nullptr; 103 SDL_audiostatus (NV_SDL_APIENTRY *SDL_GetAudioStatus) (void) = nullptr; 104 void (NV_SDL_APIENTRY *SDL_PauseAudio) (int pause_on) = nullptr; 105 SDL_AudioSpec * (NV_SDL_APIENTRY *SDL_LoadWAV_RW) (SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) = nullptr; 106 void (NV_SDL_APIENTRY *SDL_FreeWAV) (Uint8 *audio_buf) = nullptr; 107 int (NV_SDL_APIENTRY *SDL_BuildAudioCVT) (SDL_AudioCVT *cvt, Uint16 src_format, Uint8 src_channels, int src_rate, Uint16 dst_format, Uint8 dst_channels, int dst_rate) = nullptr; 108 int (NV_SDL_APIENTRY *SDL_ConvertAudio) (SDL_AudioCVT *cvt) = nullptr; 109 void (NV_SDL_APIENTRY *SDL_MixAudio) (Uint8 *dst, const Uint8 *src, Uint32 len, int volume) = nullptr; 110 void (NV_SDL_APIENTRY *SDL_LockAudio) (void) = nullptr; 111 void (NV_SDL_APIENTRY *SDL_UnlockAudio) (void) = nullptr; 112 void (NV_SDL_APIENTRY *SDL_CloseAudio) (void) = nullptr; 113 114 /* SDL_cpuinfo.h functions */ 115 SDL_bool (NV_SDL_APIENTRY *SDL_HasRDTSC) (void) = nullptr; 116 SDL_bool (NV_SDL_APIENTRY *SDL_HasMMX) (void) = nullptr; 117 SDL_bool (NV_SDL_APIENTRY *SDL_HasMMXExt) (void) = nullptr; 118 SDL_bool (NV_SDL_APIENTRY *SDL_Has3DNow) (void) = nullptr; 119 SDL_bool (NV_SDL_APIENTRY *SDL_Has3DNowExt) (void) = nullptr; 120 SDL_bool (NV_SDL_APIENTRY *SDL_HasSSE) (void) = nullptr; 121 SDL_bool (NV_SDL_APIENTRY *SDL_HasSSE2) (void) = nullptr; 122 SDL_bool (NV_SDL_APIENTRY *SDL_HasAltiVec) (void) = nullptr; 123 124 /* SDL_error.h functions */ 125 void (NV_SDL_APIENTRY *SDL_SetError) (const char *fmt, ...) = nullptr; 126 char * (NV_SDL_APIENTRY *SDL_GetError) (void) = nullptr; 127 void (NV_SDL_APIENTRY *SDL_ClearError) (void) = nullptr; 128 void (NV_SDL_APIENTRY *SDL_Error) (SDL_errorcode code) = nullptr; 129 130 /* SDL_active.h functions */ 131 Uint8 (NV_SDL_APIENTRY *SDL_GetAppState) (void) = nullptr; 132 133 /* SDL_keyboard.h functions */ 134 int (NV_SDL_APIENTRY *SDL_EnableUNICODE) (int enable) = nullptr; 135 int (NV_SDL_APIENTRY *SDL_EnableKeyRepeat) (int delay, int interval) = nullptr; 136 void (NV_SDL_APIENTRY *SDL_GetKeyRepeat) (int *delay, int *interval) = nullptr; 137 Uint8 * (NV_SDL_APIENTRY *SDL_GetKeyState) (int *numkeys) = nullptr; 138 SDLMod (NV_SDL_APIENTRY *SDL_GetModState) (void) = nullptr; 139 void (NV_SDL_APIENTRY *SDL_SetModState) (SDLMod modstate) = nullptr; 140 char * (NV_SDL_APIENTRY *SDL_GetKeyName) (SDLKey key) = nullptr; 141 142 /* SDL_mouse.h functions */ 143 Uint8 (NV_SDL_APIENTRY *SDL_GetMouseState) (int *x, int *y) = nullptr; 144 Uint8 (NV_SDL_APIENTRY *SDL_GetRelativeMouseState) (int *x, int *y) = nullptr; 145 void (NV_SDL_APIENTRY *SDL_WarpMouse) (Uint16 x, Uint16 y) = nullptr; 146 SDL_Cursor * (NV_SDL_APIENTRY *SDL_CreateCursor) (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y) = nullptr; 147 void (NV_SDL_APIENTRY *SDL_SetCursor) (SDL_Cursor *cursor) = nullptr; 148 SDL_Cursor * (NV_SDL_APIENTRY *SDL_GetCursor) (void) = nullptr; 149 void (NV_SDL_APIENTRY *SDL_FreeCursor) (SDL_Cursor *cursor) = nullptr; 150 int (NV_SDL_APIENTRY *SDL_ShowCursor) (int toggle) = nullptr; 151 152 /* SDL_joystick.h functions */ 153 int (NV_SDL_APIENTRY *SDL_NumJoysticks) (void) = nullptr; 154 const char * (NV_SDL_APIENTRY *SDL_JoystickName) (int device_index) = nullptr; 155 SDL_Joystick * (NV_SDL_APIENTRY *SDL_JoystickOpen) (int device_index) = nullptr; 156 int (NV_SDL_APIENTRY *SDL_JoystickOpened) (int device_index) = nullptr; 157 int (NV_SDL_APIENTRY *SDL_JoystickIndex) (SDL_Joystick *joystick) = nullptr; 158 int (NV_SDL_APIENTRY *SDL_JoystickNumAxes) (SDL_Joystick *joystick) = nullptr; 159 int (NV_SDL_APIENTRY *SDL_JoystickNumBalls) (SDL_Joystick *joystick) = nullptr; 160 int (NV_SDL_APIENTRY *SDL_JoystickNumHats) (SDL_Joystick *joystick) = nullptr; 161 int (NV_SDL_APIENTRY *SDL_JoystickNumButtons) (SDL_Joystick *joystick) = nullptr; 162 void (NV_SDL_APIENTRY *SDL_JoystickUpdate) (void) = nullptr; 163 int (NV_SDL_APIENTRY *SDL_JoystickEventState) (int state) = nullptr; 164 Sint16 (NV_SDL_APIENTRY *SDL_JoystickGetAxis) (SDL_Joystick *joystick, int axis) = nullptr; 165 Uint8 (NV_SDL_APIENTRY *SDL_JoystickGetHat) (SDL_Joystick *joystick, int hat) = nullptr; 166 int (NV_SDL_APIENTRY *SDL_JoystickGetBall) (SDL_Joystick *joystick, int ball, int *dx, int *dy) = nullptr; 167 Uint8 (NV_SDL_APIENTRY *SDL_JoystickGetButton) (SDL_Joystick *joystick, int button) = nullptr; 168 void (NV_SDL_APIENTRY *SDL_JoystickClose) (SDL_Joystick *joystick) = nullptr; 169 170 /* SDL_event.h functions */ 171 void (NV_SDL_APIENTRY *SDL_PumpEvents) (void) = nullptr; 172 int (NV_SDL_APIENTRY *SDL_PeepEvents) (SDL_Event *events, int numevents, SDL_eventaction action, Uint32 mask) = nullptr; 173 int (NV_SDL_APIENTRY *SDL_PollEvent) (SDL_Event *event) = nullptr; 174 int (NV_SDL_APIENTRY *SDL_WaitEvent) (SDL_Event *event) = nullptr; 175 int (NV_SDL_APIENTRY *SDL_PushEvent) (SDL_Event *event) = nullptr; 176 void (NV_SDL_APIENTRY *SDL_SetEventFilter) (SDL_EventFilter filter) = nullptr; 177 SDL_EventFilter (NV_SDL_APIENTRY *SDL_GetEventFilter) (void) = nullptr; 178 Uint8 (NV_SDL_APIENTRY *SDL_EventState) (Uint8 type, int state) = nullptr; 179 180 /* SDL_timer.h functions */ 181 Uint32 (NV_SDL_APIENTRY *SDL_GetTicks) (void) = nullptr; 182 void (NV_SDL_APIENTRY *SDL_Delay) (Uint32 ms) = nullptr; 183 int (NV_SDL_APIENTRY *SDL_SetTimer) (Uint32 interval, SDL_TimerCallback callback) = nullptr; 184 SDL_TimerID (NV_SDL_APIENTRY *SDL_AddTimer) (Uint32 interval, SDL_NewTimerCallback callback, void *param) = nullptr; 185 SDL_bool (NV_SDL_APIENTRY *SDL_RemoveTimer) (SDL_TimerID t) = nullptr; 186 187 /* SDL_version.h functions */ 188 const SDL_version * (NV_SDL_APIENTRY *SDL_Linked_Version) (void) = nullptr; 13 #define NV_SDL_FUN( rtype, fname, fparams ) rtype (NV_SDL_APIENTRY *fname) fparams = nullptr; 14 #include <nv/lib/detail/sdl_functions.inc> 15 #undef NV_SDL_FUN 189 16 190 17 bool nv::load_sdl_library( const char* path ) 191 18 { 192 # define NV_SDL_LOAD( symbol ) *(void **) (&symbol) = sdl_library.get(#symbol);193 19 static nv::library sdl_library; 194 20 if ( sdl_library.is_open() ) return true; 195 21 sdl_library.open( path ); 196 197 /* SDL.h functions */ 198 NV_SDL_LOAD( SDL_Init ); 199 NV_SDL_LOAD( SDL_InitSubSystem ); 200 NV_SDL_LOAD( SDL_QuitSubSystem ); 201 NV_SDL_LOAD( SDL_WasInit ); 202 NV_SDL_LOAD( SDL_Quit ); 203 204 /* SDL_rwops.h functions */ 205 NV_SDL_LOAD( SDL_RWFromFile ); 206 NV_SDL_LOAD( SDL_RWFromFP ); 207 NV_SDL_LOAD( SDL_RWFromMem ); 208 NV_SDL_LOAD( SDL_RWFromConstMem ); 209 NV_SDL_LOAD( SDL_AllocRW ); 210 NV_SDL_LOAD( SDL_FreeRW ); 211 NV_SDL_LOAD( SDL_ReadLE16 ); 212 NV_SDL_LOAD( SDL_ReadBE16 ); 213 NV_SDL_LOAD( SDL_ReadLE32 ); 214 NV_SDL_LOAD( SDL_ReadBE32 ); 215 NV_SDL_LOAD( SDL_ReadLE64 ); 216 NV_SDL_LOAD( SDL_ReadBE64 ); 217 NV_SDL_LOAD( SDL_WriteLE16 ); 218 NV_SDL_LOAD( SDL_WriteBE16 ); 219 NV_SDL_LOAD( SDL_WriteLE32 ); 220 NV_SDL_LOAD( SDL_WriteBE32 ); 221 NV_SDL_LOAD( SDL_WriteLE64 ); 222 NV_SDL_LOAD( SDL_WriteBE64 ); 223 224 /* SDL_video.h defines */ 225 NV_SDL_LOAD( SDL_VideoInit ); 226 NV_SDL_LOAD( SDL_VideoQuit ); 227 NV_SDL_LOAD( SDL_VideoDriverName ); 228 NV_SDL_LOAD( SDL_GetVideoSurface ); 229 NV_SDL_LOAD( SDL_GetVideoInfo ); 230 NV_SDL_LOAD( SDL_VideoModeOK ); 231 NV_SDL_LOAD( SDL_ListModes ); 232 NV_SDL_LOAD( SDL_SetVideoMode ); 233 NV_SDL_LOAD( SDL_UpdateRects ); 234 NV_SDL_LOAD( SDL_UpdateRect ); 235 NV_SDL_LOAD( SDL_Flip ); 236 NV_SDL_LOAD( SDL_SetGamma ); 237 NV_SDL_LOAD( SDL_SetGammaRamp ); 238 NV_SDL_LOAD( SDL_GetGammaRamp ); 239 NV_SDL_LOAD( SDL_SetColors ); 240 NV_SDL_LOAD( SDL_SetPalette ); 241 NV_SDL_LOAD( SDL_MapRGB ); 242 NV_SDL_LOAD( SDL_MapRGBA ); 243 NV_SDL_LOAD( SDL_GetRGB ); 244 NV_SDL_LOAD( SDL_GetRGBA ); 245 NV_SDL_LOAD( SDL_CreateRGBSurface ); 246 NV_SDL_LOAD( SDL_CreateRGBSurfaceFrom ); 247 NV_SDL_LOAD( SDL_FreeSurface ); 248 NV_SDL_LOAD( SDL_LockSurface ); 249 NV_SDL_LOAD( SDL_UnlockSurface ); 250 NV_SDL_LOAD( SDL_LoadBMP_RW ); 251 NV_SDL_LOAD( SDL_SaveBMP_RW ); 252 NV_SDL_LOAD( SDL_SetColorKey ); 253 NV_SDL_LOAD( SDL_SetAlpha ); 254 NV_SDL_LOAD( SDL_SetClipRect ); 255 NV_SDL_LOAD( SDL_GetClipRect ); 256 NV_SDL_LOAD( SDL_ConvertSurface ); 257 NV_SDL_LOAD( SDL_UpperBlit ); 258 NV_SDL_LOAD( SDL_LowerBlit ); 259 NV_SDL_LOAD( SDL_FillRect ); 260 NV_SDL_LOAD( SDL_DisplayFormat ); 261 NV_SDL_LOAD( SDL_DisplayFormatAlpha ); 262 NV_SDL_LOAD( SDL_CreateYUVOverlay ); 263 NV_SDL_LOAD( SDL_LockYUVOverlay ); 264 NV_SDL_LOAD( SDL_UnlockYUVOverlay ); 265 NV_SDL_LOAD( SDL_DisplayYUVOverlay ); 266 NV_SDL_LOAD( SDL_FreeYUVOverlay ); 267 NV_SDL_LOAD( SDL_GL_LoadLibrary ); 268 NV_SDL_LOAD( SDL_GL_GetProcAddress ); 269 NV_SDL_LOAD( SDL_GL_SetAttribute ); 270 NV_SDL_LOAD( SDL_GL_GetAttribute ); 271 NV_SDL_LOAD( SDL_GL_SwapBuffers ); 272 NV_SDL_LOAD( SDL_GL_UpdateRects ); 273 NV_SDL_LOAD( SDL_GL_Lock ); 274 NV_SDL_LOAD( SDL_GL_Unlock ); 275 NV_SDL_LOAD( SDL_WM_SetCaption ); 276 NV_SDL_LOAD( SDL_WM_GetCaption ); 277 NV_SDL_LOAD( SDL_WM_SetIcon ); 278 NV_SDL_LOAD( SDL_WM_IconifyWindow ); 279 NV_SDL_LOAD( SDL_WM_ToggleFullScreen ); 280 NV_SDL_LOAD( SDL_WM_GrabInput ); 281 282 /* SDL_audio.h functions */ 283 NV_SDL_LOAD( SDL_AudioInit ); 284 NV_SDL_LOAD( SDL_AudioQuit ); 285 NV_SDL_LOAD( SDL_AudioDriverName ); 286 NV_SDL_LOAD( SDL_OpenAudio ); 287 NV_SDL_LOAD( SDL_GetAudioStatus ); 288 NV_SDL_LOAD( SDL_PauseAudio ); 289 NV_SDL_LOAD( SDL_LoadWAV_RW ); 290 NV_SDL_LOAD( SDL_FreeWAV ); 291 NV_SDL_LOAD( SDL_BuildAudioCVT ); 292 NV_SDL_LOAD( SDL_ConvertAudio ); 293 NV_SDL_LOAD( SDL_MixAudio ); 294 NV_SDL_LOAD( SDL_LockAudio ); 295 NV_SDL_LOAD( SDL_UnlockAudio ); 296 NV_SDL_LOAD( SDL_CloseAudio ); 297 298 /* SDL_cpuinfo.h functions */ 299 NV_SDL_LOAD( SDL_HasRDTSC ); 300 NV_SDL_LOAD( SDL_HasMMX ); 301 NV_SDL_LOAD( SDL_HasMMXExt ); 302 NV_SDL_LOAD( SDL_Has3DNow ); 303 NV_SDL_LOAD( SDL_Has3DNowExt ); 304 NV_SDL_LOAD( SDL_HasSSE ); 305 NV_SDL_LOAD( SDL_HasSSE2 ); 306 NV_SDL_LOAD( SDL_HasAltiVec ); 307 308 /* SDL_error.h functions */ 309 NV_SDL_LOAD( SDL_SetError ); 310 NV_SDL_LOAD( SDL_GetError ); 311 NV_SDL_LOAD( SDL_ClearError ); 312 NV_SDL_LOAD( SDL_Error ); 313 314 /* SDL_active.h functions */ 315 NV_SDL_LOAD( SDL_GetAppState ); 316 317 /* SDL_keyboard.h functions */ 318 NV_SDL_LOAD( SDL_EnableUNICODE ); 319 NV_SDL_LOAD( SDL_EnableKeyRepeat ); 320 NV_SDL_LOAD( SDL_GetKeyRepeat ); 321 NV_SDL_LOAD( SDL_GetKeyState ); 322 NV_SDL_LOAD( SDL_GetModState ); 323 NV_SDL_LOAD( SDL_SetModState ); 324 NV_SDL_LOAD( SDL_GetKeyName ); 325 326 /* SDL_mouse.h functions */ 327 NV_SDL_LOAD( SDL_GetMouseState ); 328 NV_SDL_LOAD( SDL_GetRelativeMouseState ); 329 NV_SDL_LOAD( SDL_WarpMouse ); 330 NV_SDL_LOAD( SDL_CreateCursor ); 331 NV_SDL_LOAD( SDL_SetCursor ); 332 NV_SDL_LOAD( SDL_GetCursor ); 333 NV_SDL_LOAD( SDL_FreeCursor ); 334 NV_SDL_LOAD( SDL_ShowCursor ); 335 336 /* SDL_joystick.h functions */ 337 NV_SDL_LOAD( SDL_NumJoysticks ); 338 NV_SDL_LOAD( SDL_JoystickName ); 339 NV_SDL_LOAD( SDL_JoystickOpen ); 340 NV_SDL_LOAD( SDL_JoystickOpened ); 341 NV_SDL_LOAD( SDL_JoystickIndex ); 342 NV_SDL_LOAD( SDL_JoystickNumAxes ); 343 NV_SDL_LOAD( SDL_JoystickNumBalls ); 344 NV_SDL_LOAD( SDL_JoystickNumHats ); 345 NV_SDL_LOAD( SDL_JoystickNumButtons ); 346 NV_SDL_LOAD( SDL_JoystickUpdate ); 347 NV_SDL_LOAD( SDL_JoystickEventState ); 348 NV_SDL_LOAD( SDL_JoystickGetAxis ); 349 NV_SDL_LOAD( SDL_JoystickGetHat ); 350 NV_SDL_LOAD( SDL_JoystickGetBall ); 351 NV_SDL_LOAD( SDL_JoystickGetButton ); 352 NV_SDL_LOAD( SDL_JoystickClose ); 353 354 /* SDL_timer.h functions */ 355 NV_SDL_LOAD( SDL_GetTicks ); 356 NV_SDL_LOAD( SDL_Delay ); 357 NV_SDL_LOAD( SDL_SetTimer ); 358 NV_SDL_LOAD( SDL_AddTimer ); 359 NV_SDL_LOAD( SDL_RemoveTimer ); 360 361 /* SDL_version.h functions */ 362 NV_SDL_LOAD( SDL_Linked_Version ); 363 364 /* SDL_event.h functions */ 365 NV_SDL_LOAD( SDL_PumpEvents ); 366 NV_SDL_LOAD( SDL_PeepEvents ); 367 NV_SDL_LOAD( SDL_PollEvent ); 368 NV_SDL_LOAD( SDL_WaitEvent ); 369 NV_SDL_LOAD( SDL_PushEvent ); 370 NV_SDL_LOAD( SDL_SetEventFilter ); 371 NV_SDL_LOAD( SDL_GetEventFilter ); 372 NV_SDL_LOAD( SDL_EventState ); 373 374 # undef NV_SDL_LOAD 22 # define NV_SDL_FUN( rtype, fname, fparams ) *(void **) (&fname) = sdl_library.get(#fname); 23 # include <nv/lib/detail/sdl_functions.inc> 24 # undef NV_SDL_FUN 375 25 return true; 376 26 } -
trunk/src/lib/sdl_image.cc
r109 r168 11 11 #include "nv/library.hh" 12 12 13 /* SDL_image.h functions */ 14 const SDL_version * (NV_SDL_APIENTRY *IMG_Linked_Version) (void) = nullptr; 15 int (NV_SDL_APIENTRY *IMG_Init) (int flags) = nullptr; 16 void (NV_SDL_APIENTRY *IMG_Quit) (void) = nullptr; 17 SDL_Surface * (NV_SDL_APIENTRY *IMG_LoadTyped_RW) (SDL_RWops *src, int freesrc, char *type) = nullptr; 18 SDL_Surface * (NV_SDL_APIENTRY *IMG_Load) (const char *file) = nullptr; 19 SDL_Surface * (NV_SDL_APIENTRY *IMG_Load_RW) (SDL_RWops *src, int freesrc) = nullptr; 20 int (NV_SDL_APIENTRY *IMG_isICO) (SDL_RWops *src) = nullptr; 21 int (NV_SDL_APIENTRY *IMG_isCUR) (SDL_RWops *src) = nullptr; 22 int (NV_SDL_APIENTRY *IMG_isBMP) (SDL_RWops *src) = nullptr; 23 int (NV_SDL_APIENTRY *IMG_isGIF) (SDL_RWops *src) = nullptr; 24 int (NV_SDL_APIENTRY *IMG_isJPG) (SDL_RWops *src) = nullptr; 25 int (NV_SDL_APIENTRY *IMG_isPNG) (SDL_RWops *src) = nullptr; 26 int (NV_SDL_APIENTRY *IMG_isTIF) (SDL_RWops *src) = nullptr; 27 SDL_Surface * (NV_SDL_APIENTRY *IMG_LoadICO_RW) (SDL_RWops *src) = nullptr; 28 SDL_Surface * (NV_SDL_APIENTRY *IMG_LoadCUR_RW) (SDL_RWops *src) = nullptr; 29 SDL_Surface * (NV_SDL_APIENTRY *IMG_LoadBMP_RW) (SDL_RWops *src) = nullptr; 30 SDL_Surface * (NV_SDL_APIENTRY *IMG_LoadGIF_RW) (SDL_RWops *src) = nullptr; 31 SDL_Surface * (NV_SDL_APIENTRY *IMG_LoadJPG_RW) (SDL_RWops *src) = nullptr; 32 SDL_Surface * (NV_SDL_APIENTRY *IMG_LoadPNG_RW) (SDL_RWops *src) = nullptr; 33 SDL_Surface * (NV_SDL_APIENTRY *IMG_LoadTGA_RW) (SDL_RWops *src) = nullptr; 34 SDL_Surface * (NV_SDL_APIENTRY *IMG_LoadTIF_RW) (SDL_RWops *src) = nullptr; 13 #define NV_SDL_FUN( rtype, fname, fparams ) rtype (NV_SDL_APIENTRY *fname) fparams = nullptr; 14 #include <nv/lib/detail/sdl_image_functions.inc> 15 #undef NV_SDL_FUN 35 16 36 17 bool nv::load_sdl_image_library( const char* path ) 37 18 { 38 # define NV_SDL_IMAGE_LOAD( symbol ) *(void **) (&symbol) = sdl_image_library.get(#symbol);39 19 static nv::library sdl_image_library; 40 20 if ( sdl_image_library.is_open() ) return true; 41 21 sdl_image_library.open( path ); 42 22 43 NV_SDL_IMAGE_LOAD( IMG_Linked_Version ); 44 NV_SDL_IMAGE_LOAD( IMG_Init ); 45 NV_SDL_IMAGE_LOAD( IMG_Quit ); 46 NV_SDL_IMAGE_LOAD( IMG_LoadTyped_RW ); 47 NV_SDL_IMAGE_LOAD( IMG_Load ); 48 NV_SDL_IMAGE_LOAD( IMG_Load_RW ); 49 NV_SDL_IMAGE_LOAD( IMG_isICO ); 50 NV_SDL_IMAGE_LOAD( IMG_isCUR ); 51 NV_SDL_IMAGE_LOAD( IMG_isBMP ); 52 NV_SDL_IMAGE_LOAD( IMG_isGIF ); 53 NV_SDL_IMAGE_LOAD( IMG_isJPG ); 54 NV_SDL_IMAGE_LOAD( IMG_isPNG ); 55 NV_SDL_IMAGE_LOAD( IMG_isTIF ); 56 NV_SDL_IMAGE_LOAD( IMG_LoadICO_RW ); 57 NV_SDL_IMAGE_LOAD( IMG_LoadCUR_RW ); 58 NV_SDL_IMAGE_LOAD( IMG_LoadBMP_RW ); 59 NV_SDL_IMAGE_LOAD( IMG_LoadGIF_RW ); 60 NV_SDL_IMAGE_LOAD( IMG_LoadJPG_RW ); 61 NV_SDL_IMAGE_LOAD( IMG_LoadPNG_RW ); 62 NV_SDL_IMAGE_LOAD( IMG_LoadTGA_RW ); 63 NV_SDL_IMAGE_LOAD( IMG_LoadTIF_RW ); 23 # define NV_SDL_FUN( rtype, fname, fparams ) *(void **) (&fname) = sdl_image_library.get(#fname); 24 # include <nv/lib/detail/sdl_image_functions.inc> 25 # undef NV_SDL_FUN 64 26 65 # undef NV_SDL_IMAGE_LOAD66 27 return true; 67 28 }
Note: See TracChangeset
for help on using the changeset viewer.