Update of /cvsroot/vba/VisualBoyAdvance/win32/dependencies/sdl In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21776/win32/dependencies/sdl Added Files: SDL.h SDL_active.h SDL_audio.h SDL_byteorder.h SDL_cdrom.h SDL_config.h SDL_config.h.default SDL_config.h.in SDL_config_amiga.h SDL_config_dreamcast.h SDL_config_macos.h SDL_config_macosx.h SDL_config_minimal.h SDL_config_os2.h SDL_config_win32.h SDL_copying.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_getenv.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_platform.h SDL_quit.h SDL_rwops.h SDL_stdinc.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h Log Message: added static build of SDL version 1.2.10 (stable) --- NEW FILE: SDL_syswm.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ /* Include file for SDL custom system window manager hooks */ #ifndef _SDL_syswm_h #define _SDL_syswm_h #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_version.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* Your application has access to a special type of event 'SDL_SYSWMEVENT', which contains window-manager specific information and arrives whenever an unhandled window event occurs. This event is ignored by default, but you can enable it with SDL_EventState() */ #ifdef SDL_PROTOTYPES_ONLY struct SDL_SysWMinfo; typedef struct SDL_SysWMinfo SDL_SysWMinfo; #else /* This is the structure for custom window manager events */ #if defined(SDL_VIDEO_DRIVER_X11) #if defined(__APPLE__) && defined(__MACH__) /* conflicts with Quickdraw.h */ #define Cursor X11Cursor #endif #include <X11/Xlib.h> #include <X11/Xatom.h> #if defined(__APPLE__) && defined(__MACH__) /* matches the re-define above */ #undef Cursor #endif /* These are the various supported subsystems under UNIX */ typedef enum { SDL_SYSWM_X11 } SDL_SYSWM_TYPE; /* The UNIX custom event structure */ struct SDL_SysWMmsg { SDL_version version; SDL_SYSWM_TYPE subsystem; union { XEvent xevent; } event; }; /* The UNIX custom window manager information structure. When this structure is returned, it holds information about which low level system it is using, and will be one of SDL_SYSWM_TYPE. */ typedef struct SDL_SysWMinfo { SDL_version version; SDL_SYSWM_TYPE subsystem; union { struct { Display *display; /* The X11 display */ Window window; /* The X11 display window */ /* These locking functions should be called around any X11 functions using the display variable. They lock the event thread, so should not be called around event functions or from event filters. */ void (*lock_func)(void); void (*unlock_func)(void); /* Introduced in SDL 1.0.2 */ Window fswindow; /* The X11 fullscreen window */ Window wmwindow; /* The X11 managed input window */ } x11; } info; } SDL_SysWMinfo; #elif defined(SDL_VIDEO_DRIVER_NANOX) #include <microwin/nano-X.h> /* The generic custom event structure */ struct SDL_SysWMmsg { SDL_version version; int data; }; /* The windows custom window manager information structure */ typedef struct SDL_SysWMinfo { SDL_version version ; GR_WINDOW_ID window ; /* The display window */ } SDL_SysWMinfo; #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI) #define WIN32_LEAN_AND_MEAN #include <windows.h> /* The windows custom event structure */ struct SDL_SysWMmsg { SDL_version version; HWND hwnd; /* The window for the message */ UINT msg; /* The type of message */ WPARAM wParam; /* WORD message parameter */ LPARAM lParam; /* LONG message parameter */ }; /* The windows custom window manager information structure */ typedef struct SDL_SysWMinfo { SDL_version version; HWND window; /* The Win32 display window */ HGLRC hglrc; /* The OpenGL context, if any */ } SDL_SysWMinfo; #elif defined(SDL_VIDEO_DRIVER_RISCOS) /* RISC OS custom event structure */ struct SDL_SysWMmsg { SDL_version version; int eventCode; /* The window for the message */ int pollBlock[64]; }; /* The RISC OS custom window manager information structure */ typedef struct SDL_SysWMinfo { SDL_version version; int wimpVersion; /* Wimp version running under */ int taskHandle; /* The RISC OS task handle */ int window; /* The RISC OS display window */ } SDL_SysWMinfo; #elif defined(SDL_VIDEO_DRIVER_PHOTON) #include <sys/neutrino.h> #include <Ph.h> /* The QNX custom event structure */ struct SDL_SysWMmsg { SDL_version version; int data; }; /* The QNX custom window manager information structure */ typedef struct SDL_SysWMinfo { SDL_version version; int data; } SDL_SysWMinfo; #else /* The generic custom event structure */ struct SDL_SysWMmsg { SDL_version version; int data; }; /* The generic custom window manager information structure */ typedef struct SDL_SysWMinfo { SDL_version version; int data; } SDL_SysWMinfo; #endif /* video driver type */ #endif /* SDL_PROTOTYPES_ONLY */ /* Function prototypes */ /* * This function gives you custom hooks into the window manager information. * It fills the structure pointed to by 'info' with custom information and * returns 1 if the function is implemented. If it's not implemented, or * the version member of the 'info' structure is invalid, it returns 0. * * You typically use this function like this: * SDL_SysWMInfo info; * SDL_VERSION(&info.version); * if ( SDL_GetWMInfo(&info) ) { ... } */ extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* _SDL_syswm_h */ --- NEW FILE: SDL_config_macos.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ #ifndef _SDL_config_macos_h #define _SDL_config_macos_h #include "SDL_platform.h" /* This is a set of defines to configure the SDL features */ #include <MacTypes.h> typedef SInt8 int8_t; typedef UInt8 uint8_t; typedef SInt16 int16_t; typedef UInt16 uint16_t; typedef SInt32 int32_t; typedef UInt32 uint32_t; typedef SInt64 int64_t; typedef UInt64 uint64_t; typedef unsigned long uintptr_t; #define SDL_HAS_64BIT_TYPE 1 /* Useful headers */ #define HAVE_STDIO_H 1 #define STDC_HEADERS 1 #define HAVE_STRING_H 1 #define HAVE_CTYPE_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 /* C library functions */ #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_ALLOCA 1 #define HAVE_ABS 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 #define HAVE_ITOA 1 #define HAVE_STRTOL 1 #define HAVE_STRTOD 1 #define HAVE_ATOI 1 #define HAVE_ATOF 1 #define HAVE_STRCMP 1 #define HAVE_STRNCMP 1 #define HAVE_SSCANF 1 /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_SNDMGR 1 #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various cdrom drivers */ #if TARGET_API_MAC_CARBON #define SDL_CDROM_DUMMY 1 #else #define SDL_CDROM_MACOS 1 #endif /* Enable various input drivers */ #if TARGET_API_MAC_CARBON #define SDL_JOYSTICK_DUMMY 1 #else #define SDL_JOYSTICK_MACOS 1 #endif /* Enable various shared object loading systems */ #define SDL_LOADSO_MACOS 1 /* Enable various threading systems */ #define SDL_THREADS_DISABLED 1 /* Enable various timer systems */ #define SDL_TIMER_MACOS 1 /* Enable various video drivers */ #define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DRAWSPROCKET 1 #define SDL_VIDEO_DRIVER_TOOLBOX 1 /* Enable OpenGL support */ #define SDL_VIDEO_OPENGL 1 #endif /* _SDL_config_macos_h */ --- NEW FILE: SDL_getenv.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ /* DEPRECATED */ #include "SDL_stdinc.h" --- NEW FILE: SDL_config_win32.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ #ifndef _SDL_config_win32_h #define _SDL_config_win32_h #include "SDL_platform.h" /* This is a set of defines to configure the SDL features */ #ifdef _MSC_VER typedef signed __int8 int8_t; typedef unsigned __int8 uint8_t; typedef signed __int16 int16_t; typedef unsigned __int16 uint16_t; typedef signed __int32 int32_t; typedef unsigned __int32 uint32_t; typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; #ifndef _UINTPTR_T_DEFINED #ifdef _WIN64 typedef unsigned __int64 uintptr_t; #else typedef unsigned int uintptr_t; #endif #define _UINTPTR_T_DEFINED #endif #else typedef signed char int8_t; typedef unsigned char uint8_t; typedef signed short int16_t; typedef unsigned short uint16_t; typedef signed int int32_t; typedef unsigned int uint32_t; typedef signed long long int64_t; typedef unsigned long long uint64_t; #ifndef _SIZE_T_DEFINED_ #define _SIZE_T_DEFINED_ typedef unsigned int size_t; #endif typedef unsigned int uintptr_t; #endif /* _MSC_VER */ #define SDL_HAS_64BIT_TYPE 1 /* Enabled for SDL 1.2 (binary compatibility) */ #define HAVE_LIBC 1 #ifdef HAVE_LIBC /* Useful headers */ #define HAVE_STDIO_H 1 #define STDC_HEADERS 1 #define HAVE_STRING_H 1 #define HAVE_CTYPE_H 1 #define HAVE_MATH_H 1 #ifndef _WIN32_WCE #define HAVE_SIGNAL_H 1 #endif /* C library functions */ #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_ALLOCA 1 #define HAVE_QSORT 1 #define HAVE_ABS 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 #define HAVE__STRREV 1 #define HAVE__STRUPR 1 #define HAVE__STRLWR 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 #define HAVE_ITOA 1 #define HAVE__LTOA 1 #define HAVE__ULTOA 1 #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 #define HAVE_STRTOLL 1 #define HAVE_STRTOD 1 #define HAVE_ATOI 1 #define HAVE_ATOF 1 #define HAVE_STRCMP 1 #define HAVE_STRNCMP 1 #define HAVE__STRICMP 1 #define HAVE__STRNICMP 1 #define HAVE_SSCANF 1 #else #define HAVE_STDARG_H 1 #define HAVE_STDDEF_H 1 #endif /* Enable various audio drivers */ #ifndef _WIN32_WCE #define SDL_AUDIO_DRIVER_DSOUND 1 #endif #define SDL_AUDIO_DRIVER_WAVEOUT 1 #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various cdrom drivers */ #ifdef _WIN32_WCE #define SDL_CDROM_DISABLED 1 #else #define SDL_CDROM_WIN32 1 #endif /* Enable various input drivers */ #ifdef _WIN32_WCE #define SDL_JOYSTICK_DISABLED 1 #else #define SDL_JOYSTICK_WINMM 1 #endif /* Enable various shared object loading systems */ #define SDL_LOADSO_WIN32 1 /* Enable various threading systems */ #define SDL_THREAD_WIN32 1 /* Enable various timer systems */ #ifdef _WIN32_WCE #define SDL_TIMER_WINCE 1 #else #define SDL_TIMER_WIN32 1 #endif /* Enable various video drivers */ #ifdef _WIN32_WCE #define SDL_VIDEO_DRIVER_GAPI 1 #endif #ifndef _WIN32_WCE #define SDL_VIDEO_DRIVER_DDRAW 1 #endif #define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_WINDIB 1 /* Enable OpenGL support */ #ifndef _WIN32_WCE #define SDL_VIDEO_OPENGL 1 #define SDL_VIDEO_OPENGL_WGL 1 #endif /* Enable assembly routines (Win64 doesn't have inline asm) */ #ifndef _WIN64 #define SDL_ASSEMBLY_ROUTINES 1 #endif #endif /* _SDL_config_win32_h */ --- NEW FILE: SDL_thread.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ #ifndef _SDL_thread_h #define _SDL_thread_h /* Header for the SDL thread management routines These are independent of the other SDL routines. */ #include "SDL_stdinc.h" #include "SDL_error.h" /* Thread synchronization primitives */ #include "SDL_mutex.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* The SDL thread structure, defined in SDL_thread.c */ struct SDL_Thread; typedef struct SDL_Thread SDL_Thread; /* Create a thread */ #if (defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__) /* We compile SDL into a DLL on OS/2. This means, that it's the DLL which creates a new thread for the calling process with the SDL_CreateThread() API. There is a problem with this, that only the RTL of the SDL.DLL will be initialized for those threads, and not the RTL of the calling application! To solve this, we make a little hack here. We'll always use the caller's _beginthread() and _endthread() APIs to start a new thread. This way, if it's the SDL.DLL which uses this API, then the RTL of SDL.DLL will be used to create the new thread, and if it's the application, then the RTL of the application will be used. So, in short: Always use the _beginthread() and _endthread() of the calling runtime library! */ #define SDL_PASSED_BEGINTHREAD_ENDTHREAD #ifndef _WIN32_WCE #include <process.h> /* This has _beginthread() and _endthread() defined! */ #endif #ifdef __OS2__ typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg); typedef void (*pfnSDL_CurrentEndThread)(void); #elif __GNUC__ typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned (__stdcall *func)(void *), void *arg, unsigned, unsigned *threadID); typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); #else typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned (__stdcall *func)(void *), void *arg, unsigned, unsigned *threadID); typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); #endif extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); #ifdef __OS2__ #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread) #elif defined(_WIN32_WCE) #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL) #else #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex) #endif #else extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data); #endif /* Get the 32-bit thread identifier for the current thread */ extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void); /* Get the 32-bit thread identifier for the specified thread, equivalent to SDL_ThreadID() if the specified thread is NULL. */ extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread); /* Wait for a thread to finish. The return code for the thread function is placed in the area pointed to by 'status', if 'status' is not NULL. */ extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status); /* Forcefully kill a thread without worrying about its state */ extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* _SDL_thread_h */ --- NEW FILE: SDL_copying.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ --- NEW FILE: SDL_stdinc.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ /* This is a general header that includes C language support */ #ifndef _SDL_stdinc_h #define _SDL_stdinc_h #include "SDL_config.h" #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #ifdef HAVE_STDIO_H #include <stdio.h> #endif #if defined(STDC_HEADERS) # include <stdlib.h> # include <stddef.h> # include <stdarg.h> #else # if defined(HAVE_STDLIB_H) # include <stdlib.h> # elif defined(HAVE_MALLOC_H) # include <malloc.h> # endif # if defined(HAVE_STDDEF_H) # include <stddef.h> # endif # if defined(HAVE_STDARG_H) # include <stdarg.h> # endif #endif #ifdef HAVE_STRING_H # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) # include <memory.h> # endif # include <string.h> #endif #ifdef HAVE_STRINGS_H # include <strings.h> #endif #if defined(HAVE_INTTYPES_H) # include <inttypes.h> #elif defined(HAVE_STDINT_H) # include <stdint.h> #endif #ifdef HAVE_CTYPE_H # include <ctype.h> #endif #ifdef HAVE_ICONV_H # include <iconv.h> #endif /* The number of elements in an array */ #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) #define SDL_TABLESIZE(table) SDL_arraysize(table) /* Basic data types */ typedef enum SDL_bool { SDL_FALSE = 0, SDL_TRUE = 1 } SDL_bool; typedef int8_t Sint8; typedef uint8_t Uint8; typedef int16_t Sint16; typedef uint16_t Uint16; typedef int32_t Sint32; typedef uint32_t Uint32; #ifdef SDL_HAS_64BIT_TYPE typedef int64_t Sint64; typedef uint64_t Uint64; #else /* This is really just a hack to prevent the compiler from complaining */ typedef struct { Uint32 hi; Uint32 lo; } Uint64, Sint64; #endif /* Make sure the types really have the right sizes */ #define SDL_COMPILE_TIME_ASSERT(name, x) \ typedef int SDL_dummy_ ## name[(x) * 2 - 1] SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); /* Check to make sure enums are the size of ints, for structure packing. For both Watcom C/C++ and Borland C/C++ the compiler option that makes enums having the size of an int must be enabled. This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). */ /* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ #ifdef __MWERKS__ #pragma enumsalwaysint on #endif typedef enum { DUMMY_ENUM_VALUE } SDL_DUMMY_ENUM; SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif #ifdef HAVE_MALLOC #define SDL_malloc malloc #else extern DECLSPEC void * SDLCALL SDL_malloc(size_t size); #endif #ifdef HAVE_CALLOC #define SDL_calloc calloc #else extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size); #endif #ifdef HAVE_REALLOC #define SDL_realloc realloc #else extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); #endif #ifdef HAVE_FREE #define SDL_free free #else extern DECLSPEC void SDLCALL SDL_free(void *mem); #endif #if defined(HAVE_ALLOCA) && !defined(alloca) # if defined(HAVE_ALLOCA_H) # include <alloca.h> # elif defined(__GNUC__) # define alloca __builtin_alloca # elif defined(_MSC_VER) # include <malloc.h> # define alloca _alloca # elif defined(__WATCOMC__) # include <malloc.h> # elif defined(__AIX__) #pragma alloca # elif defined(__MRC__) void *alloca (unsigned); # else char *alloca (); # endif #endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) #define SDL_stack_free(data) #else #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*count) #define SDL_stack_free(data) SDL_free(data) #endif #ifdef HAVE_GETENV #define SDL_getenv getenv #else extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); #endif #ifdef HAVE_PUTENV #define SDL_putenv putenv #else extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); #endif #ifdef HAVE_QSORT #define SDL_qsort qsort #else extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *)); #endif #ifdef HAVE_ABS #define SDL_abs abs #else #define SDL_abs(X) ((X) < 0 ? -(X) : (X)) #endif #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) #define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) #ifdef HAVE_CTYPE_H #define SDL_isdigit(X) isdigit(X) #define SDL_isspace(X) isspace(X) #define SDL_toupper(X) toupper(X) #define SDL_tolower(X) tolower(X) #else #define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9')) #define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n')) #define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X)) #define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X)) #endif #ifdef HAVE_MEMSET #define SDL_memset memset #else extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len); #endif #if defined(__GNUC__) && defined(i386) #define SDL_memset4(dst, val, len) \ do { \ int u0, u1, u2; \ __asm__ __volatile__ ( \ "cld\n\t" \ "rep ; stosl\n\t" \ : "=&D" (u0), "=&a" (u1), "=&c" (u2) \ : "0" (dst), "1" (val), "2" ((Uint32)(len)) \ : "memory" ); \ } while(0) #endif #ifndef SDL_memset4 #define SDL_memset4(dst, val, len) \ do { \ unsigned _count = (len); \ unsigned _n = (_count + 3) / 4; \ Uint32 *_p = (Uint32 *)(dst); \ Uint32 _val = (val); \ switch (_count % 4) { \ case 0: do { *_p++ = _val; \ case 3: *_p++ = _val; \ case 2: *_p++ = _val; \ case 1: *_p++ = _val; \ } while ( --_n ); \ } \ } while(0) #endif #if defined(__GNUC__) && defined(i386) #define SDL_memcpy(dst, src, len) \ do { \ int u0, u1, u2; \ __asm__ __volatile__ ( \ "cld\n\t" \ "rep ; movsl\n\t" \ "testb $2,%b4\n\t" \ "je 1f\n\t" \ "movsw\n" \ "1:\ttestb $1,%b4\n\t" \ "je 2f\n\t" \ "movsb\n" \ "2:" \ : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ : "0" ((unsigned)(len)/4), "q" (len), "1" (dst),"2" (src) \ : "memory" ); \ } while(0) #endif #ifndef SDL_memcpy #ifdef HAVE_MEMCPY #define SDL_memcpy memcpy #elif defined(HAVE_BCOPY) #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) #else extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); #endif #endif #if defined(__GNUC__) && defined(i386) #define SDL_memcpy4(dst, src, len) \ do { \ int ecx, edi, esi; \ __asm__ __volatile__ ( \ "cld\n\t" \ "rep ; movsl" \ : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \ : "0" ((unsigned)(len)), "1" (dst), "2" (src) \ : "memory" ); \ } while(0) #endif #ifndef SDL_memcpy4 #define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2) #endif #if defined(__GNUC__) && defined(i386) #define SDL_revcpy(dst, src, len) \ do { \ int u0, u1, u2; \ char *dstp = (char *)(dst); \ char *srcp = (char *)(src); \ int n = (len); \ if ( n >= 4 ) { \ __asm__ __volatile__ ( \ "std\n\t" \ "rep ; movsl\n\t" \ : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ : "0" (n >> 2), \ "1" (dstp+(n-4)), "2" (srcp+(n-4)) \ : "memory" ); \ } \ switch (n & 3) { \ case 3: dstp[2] = srcp[2]; \ case 2: dstp[1] = srcp[1]; \ case 1: dstp[0] = srcp[0]; \ break; \ default: \ break; \ } \ } while(0) #endif #ifndef SDL_revcpy extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len); #endif #ifdef HAVE_MEMMOVE #define SDL_memmove memmove #elif defined(HAVE_BCOPY) #define SDL_memmove(d, s, n) bcopy((s), (d), (n)) #else #define SDL_memmove(dst, src, len) \ do { \ if ( dst < src ) { \ SDL_memcpy(dst, src, len); \ } else { \ SDL_revcpy(dst, src, len); \ } \ } while(0) #endif #ifdef HAVE_MEMCMP #define SDL_memcmp memcmp #else extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); #endif #ifdef HAVE_STRLEN #define SDL_strlen strlen #else extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); #endif #ifdef HAVE_STRLCPY #define SDL_strlcpy strlcpy #else extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); #endif #ifdef HAVE_STRLCAT #define SDL_strlcat strlcat #else extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); #endif #ifdef HAVE_STRDUP #define SDL_strdup strdup #else extern DECLSPEC char * SDLCALL SDL_strdup(const char *string); #endif #ifdef HAVE__STRREV #define SDL_strrev _strrev #else extern DECLSPEC char * SDLCALL SDL_strrev(char *string); #endif #ifdef HAVE__STRUPR #define SDL_strupr _strupr #else extern DECLSPEC char * SDLCALL SDL_strupr(char *string); #endif #ifdef HAVE__STRLWR #define SDL_strlwr _strlwr #else extern DECLSPEC char * SDLCALL SDL_strlwr(char *string); #endif #ifdef HAVE_STRCHR #define SDL_strchr strchr #elif defined(HAVE_INDEX) #define SDL_strchr index #else extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c); #endif #ifdef HAVE_STRRCHR #define SDL_strrchr strrchr #elif defined(HAVE_RINDEX) #define SDL_strrchr rindex #else extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c); #endif #ifdef HAVE_STRSTR #define SDL_strstr strstr #else extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle); #endif #ifdef HAVE_ITOA #define SDL_itoa itoa #else #define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix) #endif #ifdef HAVE__LTOA #define SDL_ltoa _ltoa #else extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix); #endif #ifdef HAVE__UITOA #define SDL_uitoa _uitoa #else #define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix) #endif #ifdef HAVE__ULTOA #define SDL_ultoa _ultoa #else extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix); #endif #ifdef HAVE_STRTOL #define SDL_strtol strtol #else extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base); #endif #ifdef HAVE_STRTOUL #define SDL_strtoul strtoul #else extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base); #endif #ifdef SDL_HAS_64BIT_TYPE #ifdef HAVE__I64TOA #define SDL_lltoa _i64toa #else extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix); #endif #ifdef HAVE__UI64TOA #define SDL_ulltoa _ui64toa #else extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix); #endif #ifdef HAVE_STRTOLL #define SDL_strtoll strtoll #else extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base); #endif #ifdef HAVE_STRTOULL #define SDL_strtoull strtoull #else extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base); #endif #endif /* SDL_HAS_64BIT_TYPE */ #ifdef HAVE_STRTOD #define SDL_strtod strtod #else extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp); #endif #ifdef HAVE_ATOI #define SDL_atoi atoi #else #define SDL_atoi(X) SDL_strtol(X, NULL, 0) #endif #ifdef HAVE_ATOF #define SDL_atof atof #else #define SDL_atof(X) SDL_strtod(X, NULL) #endif #ifdef HAVE_STRCMP #define SDL_strcmp strcmp #else extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); #endif #ifdef HAVE_STRNCMP #define SDL_strncmp strncmp #else extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); #endif #ifdef HAVE_STRCASECMP #define SDL_strcasecmp strcasecmp #elif defined(HAVE__STRICMP) #define SDL_strcasecmp _stricmp #else extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); #endif #ifdef HAVE_STRNCASECMP #define SDL_strncasecmp strncasecmp #elif defined(HAVE__STRNICMP) #define SDL_strncasecmp _strnicmp #else extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen); #endif #ifdef HAVE_SSCANF #define SDL_sscanf sscanf #else extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); #endif #ifdef HAVE_SNPRINTF #define SDL_snprintf snprintf #else extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); #endif #ifdef HAVE_VSNPRINTF #define SDL_vsnprintf vsnprintf #else extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); #endif /* The SDL implementation of iconv() returns these error codes */ #define SDL_ICONV_ERROR (size_t)-1 #define SDL_ICONV_E2BIG (size_t)-2 #define SDL_ICONV_EILSEQ (size_t)-3 #define SDL_ICONV_EINVAL (size_t)-4 #ifdef HAVE_ICONV #define SDL_iconv_t iconv_t #define SDL_iconv_open iconv_open #define SDL_iconv_close iconv_close extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); #else typedef struct _SDL_iconv_t *SDL_iconv_t; extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); #endif /* This function converts a string between encodings in one pass, returning a string that must be freed with SDL_free() or NULL on error. */ extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft); #define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* _SDL_stdinc_h */ --- NEW FILE: SDL_audio.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ /* Access to the raw audio mixing buffer for the SDL library */ #ifndef _SDL_audio_h #define _SDL_audio_h #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_endian.h" #include "SDL_mutex.h" #include "SDL_thread.h" #include "SDL_rwops.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* The calculated values in this structure are calculated by SDL_OpenAudio() */ typedef struct SDL_AudioSpec { int freq; /* DSP frequency -- samples per second */ Uint16 format; /* Audio data format */ Uint8 channels; /* Number of channels: 1 mono, 2 stereo */ Uint8 silence; /* Audio buffer silence value (calculated) */ Uint16 samples; /* Audio buffer size in samples (power of 2) */ Uint16 padding; /* Necessary for some compile environments */ Uint32 size; /* Audio buffer size in bytes (calculated) */ /* This function is called when the audio device needs more data. 'stream' is a pointer to the audio data buffer 'len' is the length of that buffer in bytes. Once the callback returns, the buffer will no longer be valid. Stereo samples are stored in a LRLRLR ordering. */ void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len); void *userdata; } SDL_AudioSpec; /* Audio format flags (defaults to LSB byte order) */ #define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */ #define AUDIO_S8 0x8008 /* Signed 8-bit samples */ #define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */ #define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */ #define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */ #define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */ #define AUDIO_U16 AUDIO_U16LSB #define AUDIO_S16 AUDIO_S16LSB /* Native audio byte ordering */ #if SDL_BYTEORDER == SDL_LIL_ENDIAN #define AUDIO_U16SYS AUDIO_U16LSB #define AUDIO_S16SYS AUDIO_S16LSB #else #define AUDIO_U16SYS AUDIO_U16MSB #define AUDIO_S16SYS AUDIO_S16MSB #endif /* A structure to hold a set of audio conversion filters and buffers */ typedef struct SDL_AudioCVT { int needed; /* Set to 1 if conversion possible */ Uint16 src_format; /* Source audio format */ Uint16 dst_format; /* Target audio format */ double rate_incr; /* Rate conversion increment */ Uint8 *buf; /* Buffer to hold entire audio data */ int len; /* Length of original audio buffer */ int len_cvt; /* Length of converted audio buffer */ int len_mult; /* buffer must be len*len_mult big */ double len_ratio; /* Given len, final size is len*len_ratio */ void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format); int filter_index; /* Current audio conversion function */ } SDL_AudioCVT; /* Function prototypes */ /* These functions are used internally, and should not be used unless you * have a specific need to specify the audio driver you want to use. * You should normally use SDL_Init() or SDL_InitSubSystem(). */ extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); extern DECLSPEC void SDLCALL SDL_AudioQuit(void); /* This function fills the given character buffer with the name of the * current audio driver, and returns a pointer to it if the audio driver has * been initialized. It returns NULL if no driver has been initialized. */ extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen); /* * This function opens the audio device with the desired parameters, and * returns 0 if successful, placing the actual hardware parameters in the * structure pointed to by 'obtained'. If 'obtained' is NULL, the audio * data passed to the callback function will be guaranteed to be in the * requested format, and will be automatically converted to the hardware * audio format if necessary. This function returns -1 if it failed * to open the audio device, or couldn't set up the audio thread. * * When filling in the desired audio spec structure, * 'desired->freq' should be the desired audio frequency in samples-per-second. * 'desired->format' should be the desired audio format. * 'desired->samples' is the desired size of the audio buffer, in samples. * This number should be a power of two, and may be adjusted by the audio * driver to a value more suitable for the hardware. Good values seem to * range between 512 and 8096 inclusive, depending on the application and * CPU speed. Smaller values yield faster response time, but can lead * to underflow if the application is doing heavy processing and cannot * fill the audio buffer in time. A stereo sample consists of both right * and left channels in LR ordering. * Note that the number of samples is directly related to time by the * following formula: ms = (samples*1000)/freq * 'desired->size' is the size in bytes of the audio buffer, and is * calculated by SDL_OpenAudio(). * 'desired->silence' is the value used to set the buffer to silence, * and is calculated by SDL_OpenAudio(). * 'desired->callback' should be set to a function that will be called * when the audio device is ready for more data. It is passed a pointer * to the audio buffer, and the length in bytes of the audio buffer. * This function usually runs in a separate thread, and so you should * protect data structures that it accesses by calling SDL_LockAudio() * and SDL_UnlockAudio() in your code. * 'desired->userdata' is passed as the first parameter to your callback * function. * * The audio device starts out playing silence when it's opened, and should * be enabled for playing by calling SDL_PauseAudio(0) when you are ready * for your audio callback function to be called. Since the audio driver * may modify the requested size of the audio buffer, you should allocate * any local mixing buffers after you open the audio device. */ extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained); /* * Get the current audio state: */ typedef enum { SDL_AUDIO_STOPPED = 0, SDL_AUDIO_PLAYING, SDL_AUDIO_PAUSED } SDL_audiostatus; extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void); /* * This function pauses and unpauses the audio callback processing. * It should be called with a parameter of 0 after opening the audio * device to start playing sound. This is so you can safely initialize * data for your callback function after opening the audio device. * Silence will be written to the audio device during the pause. */ extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); /* * This function loads a WAVE from the data source, automatically freeing * that source if 'freesrc' is non-zero. For example, to load a WAVE file, * you could do: * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); * * If this function succeeds, it returns the given SDL_AudioSpec, * filled with the audio data format of the wave data, and sets * 'audio_buf' to a malloc()'d buffer containing the audio data, * and sets 'audio_len' to the length of that audio buffer, in bytes. * You need to free the audio buffer with SDL_FreeWAV() when you are * done with it. * * This function returns NULL and sets the SDL error message if the * wave file cannot be opened, uses an unknown data format, or is * corrupt. Currently raw and MS-ADPCM WAVE files are supported. */ extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); /* Compatibility convenience function -- loads a WAV from a file */ #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) /* * This function frees data previously allocated with SDL_LoadWAV_RW() */ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf); /* * This function takes a source format and rate and a destination format * and rate, and initializes the 'cvt' structure with information needed * by SDL_ConvertAudio() to convert a buffer of audio data from one format * to the other. * This function returns 0, or -1 if there was an error. */ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt, Uint16 src_format, Uint8 src_channels, int src_rate, Uint16 dst_format, Uint8 dst_channels, int dst_rate); /* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), * created an audio buffer cvt->buf, and filled it with cvt->len bytes of * audio data in the source format, this function will convert it in-place * to the desired format. * The data conversion may expand the size of the audio data, so the buffer * cvt->buf should be allocated after the cvt structure is initialized by * SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. */ extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt); /* * This takes two audio buffers of the playing audio format and mixes * them, performing addition, volume adjustment, and overflow clipping. * The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME * for full audio volume. Note this does not change hardware volume. * This is provided for convenience -- you can mix your own audio data. */ #define SDL_MIX_MAXVOLUME 128 extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume); /* * The lock manipulated by these functions protects the callback function. * During a LockAudio/UnlockAudio pair, you can be guaranteed that the * callback function is not running. Do not call these from the callback * function or you will cause deadlock. */ extern DECLSPEC void SDLCALL SDL_LockAudio(void); extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); /* * This function shuts down audio processing and closes the audio device. */ extern DECLSPEC void SDLCALL SDL_CloseAudio(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* _SDL_audio_h */ --- NEW FILE: SDL_quit.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ /* Include file for SDL quit event handling */ #ifndef _SDL_quit_h #define _SDL_quit_h #include "SDL_stdinc.h" #include "SDL_error.h" /* An SDL_QUITEVENT is generated when the user tries to close the application window. If it is ignored or filtered out, the window will remain open. If it is not ignored or filtered, it is queued normally and the window is allowed to close. When the window is closed, screen updates will complete, but have no effect. SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) and SIGTERM (system termination request), if handlers do not already exist, that generate SDL_QUITEVENT events as well. There is no way to determine the cause of an SDL_QUITEVENT, but setting a signal handler in your application will override the default generation of quit events for that signal. */ /* There are no functions directly affecting the quit event */ #define SDL_QuitRequested() \ (SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK)) #endif /* _SDL_quit_h */ --- NEW FILE: SDL_joystick.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ /* Include file for SDL joystick event handling */ #ifndef _SDL_joystick_h #define _SDL_joystick_h #include "SDL_stdinc.h" #include "SDL_error.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* In order to use these functions, SDL_Init() must have been called with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system for joysticks, and load appropriate drivers. */ /* The joystick structure used to identify an SDL joystick */ struct _SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick; /* Function prototypes */ /* * Count the number of joysticks attached to the system */ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); /* * Get the implementation dependent name of a joystick. * This can be called before any joysticks are opened. * If no name can be found, this function returns NULL. */ extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index); /* * Open a joystick for use - the index passed as an argument refers to * the N'th joystick on the system. This index is the value which will * identify this joystick in future joystick events. * * This function returns a joystick identifier, or NULL if an error occurred. */ extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index); /* * Returns 1 if the joystick has been opened, or 0 if it has not. */ extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index); /* * Get the device index of an opened joystick. */ extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick); /* * Get the number of general axis controls on a joystick */ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick); /* * Get the number of trackballs on a joystick * Joystick trackballs have only relative motion events associated * with them and their state cannot be polled. */ extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick); /* * Get the number of POV hats on a joystick */ extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick); /* * Get the number of buttons on a joystick */ extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick); /* * Update the current state of the open joysticks. * This is called automatically by the event loop if any joystick * events are enabled. */ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); /* * Enable/disable joystick event polling. * If joystick events are disabled, you must call SDL_JoystickUpdate() * yourself and check the state of the joystick when you want joystick * information. * The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. */ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); /* * Get the current state of an axis control on a joystick * The state is a value ranging from -32768 to 32767. * The axis indices start at index 0. */ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); /* * Get the current state of a POV hat on a joystick * The return value is one of the following positions: */ #define SDL_HAT_CENTERED 0x00 #define SDL_HAT_UP 0x01 #define SDL_HAT_RIGHT 0x02 #define SDL_HAT_DOWN 0x04 #define SDL_HAT_LEFT 0x08 #define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) #define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) /* * The hat indices start at index 0. */ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat); /* * Get the ball axis change since the last poll * This returns 0, or -1 if you passed it invalid parameters. * The ball indices start at index 0. */ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); /* * Get the current state of a button on a joystick * The button indices start at index 0. */ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button); /* * Close a joystick previously opened with SDL_JoystickOpen() */ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* _SDL_joystick_h */ --- NEW FILE: SDL_active.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ /* Include file for SDL application focus event handling */ #ifndef _SDL_active_h #define _SDL_active_h #include "SDL_stdinc.h" #include "SDL_error.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* The available application states */ #define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */ #define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */ #define SDL_APPACTIVE 0x04 /* The application is active */ /* Function prototypes */ /* * This function returns the current state of the application, which is a * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to * see your application, otherwise it has been iconified or disabled. */ extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* _SDL_active_h */ --- NEW FILE: SDL_rwops.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga sl...@li... */ /* This file provides a general interface for SDL to read and write data sources. It can easily be extended to files, memory, etc. */ #ifndef _SDL_rwops_h #define _SDL_rwops_h #include "SDL_stdinc.h" #include "SDL_error.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* This is the read/write operation structure -- very basic */ typedef struct SDL_RWops { /* Seek to 'offset' relative to whence, one of stdio's whence values: SEEK_SET, SEEK_CUR, SEEK_END Returns the final offset in the data source. */ int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence); /* Read up to 'num' objects each of size 'objsize' from the data source to the area pointed at by 'ptr'. Returns the number of objects read, or -1 if the read failed. */ int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum); /* Write exactly 'num' objects each of size 'objsize' from the area pointed at by 'ptr' to data source. Returns 'num', or -1 if the write failed. */ int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num); /* Close and free an allocated SDL_FSops structure */ int (SDLCALL *close)(struct SDL_RWops *context); Uint32 type; union { #ifdef __WIN32__ struct { int append; void* h; } win32io; #endif #ifdef HAVE_STDIO_H struct { int autoclose; FILE *fp; } stdio; #endif struct { Uint8 *base; Uint8 *here; Uint8 *stop; } mem; struct { void *data1; } unknown; } hidden; } SDL_RWops; /* Functions to create SDL_RWops structures from various data sources */ extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode); #ifdef HAVE_STDIO_H extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose); #endif extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size); extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size); extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void); extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area); #define RW_SEEK_SET 0 /* Seek from the beginning of data */ #define RW_SEEK_CUR 1 /* Seek relative to current read point */ #define RW_SEEK_END 2 /* Seek relative to the end of data */ /* Macros to easily read and write from an SDL_RWops structure */ #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) #define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) #define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) #define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) #define SDL_RWclose(ctx) (ctx)->close(ctx) /* Read an item of the specified endianness and return in native format */ extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src); extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src); extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src); extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src); extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src); extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src); /* Write an item of native format to the specified endianness */ extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value); extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value); extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value); extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value); extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value); extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* _SDL_rwops_h */ --- NEW FILE: SDL_keyboard.h --- /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Ge... [truncated message content] |