Merge pull request #343 from jordan-woyak/disable-sdl-windows

Disable SDL input on Windows.
This commit is contained in:
shuffle2 2014-05-21 19:47:44 -07:00
commit dd413269e3
145 changed files with 11 additions and 51799 deletions

View File

@ -581,6 +581,7 @@ if(NOT ANDROID)
endif()
if(SDL2_FOUND)
message("Using shared SDL2")
add_definitions(-DHAVE_SDL=1)
include_directories(${SDL2_INCLUDE_DIR})
else(SDL2_FOUND)
# SDL2 not found, try SDL
@ -589,12 +590,11 @@ if(NOT ANDROID)
endif()
if(SDL_FOUND)
message("Using shared SDL")
add_definitions(-DHAVE_SDL=1)
include_directories(${SDL_INCLUDE_DIR})
else(SDL_FOUND)
# TODO: Use the prebuilt one on Windows
message("Using static SDL from Externals")
include_directories(Externals/SDL/SDL Externals/SDL Externals/SDL/include)
add_subdirectory(Externals/SDL)
message("SDL NOT found, disabling SDL input")
add_definitions(-DHAVE_SDL=0)
endif(SDL_FOUND)
endif(SDL2_FOUND)
endif()

View File

@ -1,22 +0,0 @@
add_definitions(-DSDL_VIDEO_DISABLED=1)
add_definitions(-DSDL_EVENTS_DISABLED=1)
set(SRCS src/SDL.c src/SDL_error.c src/SDL_fatal.c src/joystick/SDL_joystick.c)
if(APPLE)
set(SRCS ${SRCS} src/joystick/darwin/SDL_sysjoystick.c)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(SRCS ${SRCS} src/joystick/linux/SDL_sysjoystick.c)
set(SRCS ${SRCS} src/stdlib/SDL_string.c)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
set(SRCS ${SRCS} src/joystick/bsd/SDL_sysjoystick.c)
set(SRCS ${SRCS} src/stdlib/SDL_malloc.c)
set(SRCS ${SRCS} src/stdlib/SDL_string.c)
elseif(WIN32)
set(SRCS ${SRCS} src/joystick/win32/SDL_mmjoystick.c)
else()
set(SRCS ${SRCS} src/joystick/dummy/SDL_sysjoystick.c)
endif()
add_library(SDL STATIC ${SRCS})

View File

@ -1,2 +0,0 @@
#include "SDL_config.h"
#include "include/SDL.h"

View File

@ -1,65 +0,0 @@
#ifndef _SDL_config_h
#define _SDL_config_h
#include <sys/ioctl.h> /* XXX */
#define SDL_JOYSTICK_USBHID 1
#define HAVE_USBHID_H 1
#define USBHID_NEW
#define USBHID_UCR_DATA
#define HAVE_ABS 1
#define HAVE_ALLOCA 1
#define HAVE_ATOF 1
#define HAVE_ATOI 1
#define HAVE_BCOPY 1
#define HAVE_CALLOC 1
#define HAVE_CTYPE_H 1
#define HAVE_FREE 1
#define HAVE_GETENV 1
#define HAVE_INTTYPES_H 1
#define HAVE_MALLOC 1
#define HAVE_MATH_H 1
#define HAVE_MEMCMP 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMORY_H 1
#define HAVE_MEMSET 1
#define HAVE_MPROTECT 1
#define HAVE_NANOSLEEP 1
#define HAVE_PUTENV 1
#define HAVE_QSORT 1
#define HAVE_REALLOC 1
#define HAVE_SETJMP 1
#define HAVE_SIGACTION 1
#define HAVE_SIGNAL_H 1
#define HAVE_SNPRINTF 1
#define HAVE_SSCANF 1
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRCASECMP 1
#define HAVE_STRCHR 1
#define HAVE_STRCMP 1
#define HAVE_STRDUP 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_STRLCAT 1
#define HAVE_STRLCPY 1
#define HAVE_STRLEN 1
#define HAVE_STRNCASECMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOD 1
#define HAVE_STRTOL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOULL 1
#define HAVE_SYS_TYPES_H
#define HAVE_UNSETENV 1
#define HAVE_VSNPRINTF 1
#endif

View File

@ -1,311 +0,0 @@
/* include/SDL_config.h. Generated from SDL_config.h.in by configure. */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_config_h
#define _SDL_config_h
/* This is a set of defines to configure the SDL features */
/* General platform specific identifiers */
#include "SDL_platform.h"
/* Make sure that this isn't included by Visual C++ */
#ifdef _MSC_VER
#error You should copy include/SDL_config.h.default to include/SDL_config.h
#endif
/* C language features */
/* #undef const */
/* #undef inline */
/* #undef volatile */
/* C datatypes */
/* #undef size_t */
/* #undef int8_t */
/* #undef uint8_t */
/* #undef int16_t */
/* #undef uint16_t */
/* #undef int32_t */
/* #undef uint32_t */
/* #undef int64_t */
/* #undef uint64_t */
/* #undef uintptr_t */
#define SDL_HAS_64BIT_TYPE 1
/* Endianness */
#define SDL_BYTEORDER 1234
/* Comment this if you want to build without any C library requirements */
#define HAVE_LIBC 1
#if HAVE_LIBC
/* Useful headers */
#define HAVE_ALLOCA_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STDLIB_H 1
#define HAVE_STDARG_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRING_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
#define HAVE_ICONV_H 1
#define HAVE_SIGNAL_H 1
/* #undef HAVE_ALTIVEC_H */
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
#define HAVE_GETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#endif
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
/* #undef HAVE_STRLCPY */
/* #undef HAVE_STRLCAT */
#define HAVE_STRDUP 1
/* #undef HAVE__STRREV */
/* #undef HAVE__STRUPR */
/* #undef HAVE__STRLWR */
/* #undef HAVE_INDEX */
/* #undef HAVE_RINDEX */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_ITOA */
/* #undef HAVE__LTOA */
/* #undef HAVE__UITOA */
/* #undef HAVE__ULTOA */
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
/* #undef HAVE__I64TOA */
/* #undef HAVE__UI64TOA */
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
/* #undef HAVE__STRICMP */
#define HAVE_STRCASECMP 1
/* #undef HAVE__STRNICMP */
#define HAVE_STRNCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_ICONV 1
#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
/* #undef HAVE_CLOCK_GETTIME */
#define HAVE_GETPAGESIZE 1
#define HAVE_MPROTECT 1
#else
/* We may need some replacement for stdarg.h here */
#include <stdarg.h>
#endif /* HAVE_LIBC */
/* Allow disabling of core subsystems */
/* #undef SDL_AUDIO_DISABLED */
/* #undef SDL_CDROM_DISABLED */
/* #undef SDL_CPUINFO_DISABLED */
/* #undef SDL_EVENTS_DISABLED */
/* #undef SDL_FILE_DISABLED */
/* #undef SDL_JOYSTICK_DISABLED */
/* #undef SDL_LOADSO_DISABLED */
/* #undef SDL_THREADS_DISABLED */
/* #undef SDL_TIMERS_DISABLED */
/* #undef SDL_VIDEO_DISABLED */
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_ALSA 1
#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "libasound.so.2"
/* #undef SDL_AUDIO_DRIVER_ARTS */
/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_BAUDIO */
/* #undef SDL_AUDIO_DRIVER_BSD */
/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
/* #undef SDL_AUDIO_DRIVER_DART */
/* #undef SDL_AUDIO_DRIVER_DC */
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* #undef SDL_AUDIO_DRIVER_DMEDIA */
/* #undef SDL_AUDIO_DRIVER_DSOUND */
#define SDL_AUDIO_DRIVER_PULSE 1
#define SDL_AUDIO_DRIVER_PULSE_DYNAMIC "libpulse-simple.so.0"
#define SDL_AUDIO_DRIVER_ESD 1
#define SDL_AUDIO_DRIVER_ESD_DYNAMIC "libesd.so.0"
/* #undef SDL_AUDIO_DRIVER_MINT */
/* #undef SDL_AUDIO_DRIVER_MMEAUDIO */
#define SDL_AUDIO_DRIVER_NAS 1
#define SDL_AUDIO_DRIVER_NAS_DYNAMIC "libaudio.so.2"
#define SDL_AUDIO_DRIVER_OSS 1
/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */
/* #undef SDL_AUDIO_DRIVER_PAUD */
/* #undef SDL_AUDIO_DRIVER_QNXNTO */
/* #undef SDL_AUDIO_DRIVER_SNDMGR */
/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
/* #undef SDL_AUDIO_DRIVER_WAVEOUT */
/* Enable various cdrom drivers */
/* #undef SDL_CDROM_AIX */
/* #undef SDL_CDROM_BEOS */
/* #undef SDL_CDROM_BSDI */
/* #undef SDL_CDROM_DC */
/* #undef SDL_CDROM_DUMMY */
/* #undef SDL_CDROM_FREEBSD */
#define SDL_CDROM_LINUX 1
/* #undef SDL_CDROM_MACOS */
/* #undef SDL_CDROM_MACOSX */
/* #undef SDL_CDROM_MINT */
/* #undef SDL_CDROM_OPENBSD */
/* #undef SDL_CDROM_OS2 */
/* #undef SDL_CDROM_OSF */
/* #undef SDL_CDROM_QNX */
/* #undef SDL_CDROM_WIN32 */
/* Enable various input drivers */
#define SDL_INPUT_LINUXEV 1
/* #undef SDL_INPUT_TSLIB */
/* #undef SDL_JOYSTICK_BEOS */
/* #undef SDL_JOYSTICK_DC */
/* #undef SDL_JOYSTICK_DUMMY */
/* #undef SDL_JOYSTICK_IOKIT */
#define SDL_JOYSTICK_LINUX 1
/* #undef SDL_JOYSTICK_MACOS */
/* #undef SDL_JOYSTICK_MINT */
/* #undef SDL_JOYSTICK_OS2 */
/* #undef SDL_JOYSTICK_RISCOS */
/* #undef SDL_JOYSTICK_WINMM */
/* #undef SDL_JOYSTICK_USBHID */
/* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
/* Enable various shared object loading systems */
/* #undef SDL_LOADSO_BEOS */
/* #undef SDL_LOADSO_DLCOMPAT */
#define SDL_LOADSO_DLOPEN 1
/* #undef SDL_LOADSO_DUMMY */
/* #undef SDL_LOADSO_LDG */
/* #undef SDL_LOADSO_MACOS */
/* #undef SDL_LOADSO_OS2 */
/* #undef SDL_LOADSO_WIN32 */
/* Enable various threading systems */
/* #undef SDL_THREAD_BEOS */
/* #undef SDL_THREAD_DC */
/* #undef SDL_THREAD_OS2 */
/* #undef SDL_THREAD_PTH */
#define SDL_THREAD_PTHREAD 1
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
/* #undef SDL_THREAD_SPROC */
/* #undef SDL_THREAD_WIN32 */
/* Enable various timer systems */
/* #undef SDL_TIMER_BEOS */
/* #undef SDL_TIMER_DC */
/* #undef SDL_TIMER_DUMMY */
/* #undef SDL_TIMER_MACOS */
/* #undef SDL_TIMER_MINT */
/* #undef SDL_TIMER_OS2 */
/* #undef SDL_TIMER_RISCOS */
#define SDL_TIMER_UNIX 1
/* #undef SDL_TIMER_WIN32 */
/* #undef SDL_TIMER_WINCE */
/* Enable various video drivers */
/* #undef SDL_VIDEO_DRIVER_AALIB */
/* #undef SDL_VIDEO_DRIVER_BWINDOW */
/* #undef SDL_VIDEO_DRIVER_CACA */
/* #undef SDL_VIDEO_DRIVER_DC */
/* #undef SDL_VIDEO_DRIVER_DDRAW */
#define SDL_VIDEO_DRIVER_DGA 1
#define SDL_VIDEO_DRIVER_DIRECTFB 1
/* #undef SDL_VIDEO_DRIVER_DRAWSPROCKET */
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_FBCON 1
/* #undef SDL_VIDEO_DRIVER_GAPI */
/* #undef SDL_VIDEO_DRIVER_GEM */
/* #undef SDL_VIDEO_DRIVER_GGI */
/* #undef SDL_VIDEO_DRIVER_IPOD */
/* #undef SDL_VIDEO_DRIVER_NANOX */
/* #undef SDL_VIDEO_DRIVER_OS2FS */
/* #undef SDL_VIDEO_DRIVER_PHOTON */
/* #undef SDL_VIDEO_DRIVER_PICOGUI */
/* #undef SDL_VIDEO_DRIVER_PS2GS */
/* #undef SDL_VIDEO_DRIVER_PS3 */
/* #undef SDL_VIDEO_DRIVER_QTOPIA */
/* #undef SDL_VIDEO_DRIVER_QUARTZ */
/* #undef SDL_VIDEO_DRIVER_RISCOS */
/* #undef SDL_VIDEO_DRIVER_SVGALIB */
/* #undef SDL_VIDEO_DRIVER_TOOLBOX */
/* #undef SDL_VIDEO_DRIVER_VGL */
/* #undef SDL_VIDEO_DRIVER_WINDIB */
/* #undef SDL_VIDEO_DRIVER_WSCONS */
#define SDL_VIDEO_DRIVER_X11 1
#define SDL_VIDEO_DRIVER_X11_DGAMOUSE 1
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so.6"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "libXrandr.so.2"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER "libXrender.so.1"
#define SDL_VIDEO_DRIVER_X11_VIDMODE 1
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
#define SDL_VIDEO_DRIVER_X11_XME 1
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
#define SDL_VIDEO_DRIVER_X11_XV 1
/* #undef SDL_VIDEO_DRIVER_XBIOS */
/* Enable OpenGL support */
#define SDL_VIDEO_OPENGL 1
#define SDL_VIDEO_OPENGL_GLX 1
/* #undef SDL_VIDEO_OPENGL_WGL */
/* #undef SDL_VIDEO_OPENGL_OSMESA */
/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
/* Disable screensaver */
#define SDL_VIDEO_DISABLE_SCREENSAVER 1
/* Enable assembly routines */
#define SDL_ASSEMBLY_ROUTINES 1
/* #undef SDL_HERMES_BLITTERS */
/* #undef SDL_ALTIVEC_BLITTERS */
#endif /* _SDL_config_h */

View File

@ -1 +0,0 @@
#include "include/SDL_version.h"

View File

@ -1,21 +0,0 @@
#include <sys/param.h>
#if defined __APPLE__
#include "include/SDL_config_macosx.h"
#elif defined BSD4_4
#include "SDL/SDL_config_bsd.h"
#elif defined __linux__
#include "SDL/SDL_config_linux.h"
#endif
#define SDL_AUDIO_DISABLED 1
#define SDL_CDROM_DISABLED 1
#define SDL_CPUINFO_DISABLED 1
#define SDL_EVENTS_DISABLED 1
#define SDL_FILE_DISABLED 1
#undef SDL_JOYSTICK_DISABLED
#define SDL_LOADSO_DISABLED 1
#define SDL_THREADS_DISABLED 1
#define SDL_TIMERS_DISABLED 1
#define SDL_VIDEO_DISABLED 1

View File

@ -1,101 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL.h
* Main include header for the SDL library
*/
#ifndef _SDL_H
#define _SDL_H
#include "SDL_main.h"
#include "SDL_stdinc.h"
#include "SDL_audio.h"
#include "SDL_cdrom.h"
#include "SDL_cpuinfo.h"
#include "SDL_endian.h"
#include "SDL_error.h"
#include "SDL_events.h"
#include "SDL_loadso.h"
#include "SDL_mutex.h"
#include "SDL_rwops.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
#include "SDL_video.h"
#include "SDL_version.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/** @file SDL.h
* @note As of version 0.5, SDL is loaded dynamically into the application
*/
/** @name SDL_INIT Flags
* These are the flags which may be passed to SDL_Init() -- you should
* specify the subsystems which you will be using in your application.
*/
/*@{*/
#define SDL_INIT_TIMER 0x00000001
#define SDL_INIT_AUDIO 0x00000010
#define SDL_INIT_VIDEO 0x00000020
#define SDL_INIT_CDROM 0x00000100
#define SDL_INIT_JOYSTICK 0x00000200
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
#define SDL_INIT_EVENTTHREAD 0x01000000 /**< Not supported on all OS's */
#define SDL_INIT_EVERYTHING 0x0000FFFF
/*@}*/
/** This function loads the SDL dynamically linked library and initializes
* the subsystems specified by 'flags' (and those satisfying dependencies)
* Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
* signal handlers for some commonly ignored fatal signals (like SIGSEGV)
*/
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
/** This function initializes specific SDL subsystems */
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
/** This function cleans up specific SDL subsystems */
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
/** This function returns mask of the specified subsystems which have
* been initialized.
* If 'flags' is 0, it returns a mask of all initialized subsystems.
*/
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
/** This function cleans up all initialized subsystems and unloads the
* dynamically linked library. You should call it upon all exit conditions.
*/
extern DECLSPEC void SDLCALL SDL_Quit(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_H */

View File

@ -1,63 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/**
* @file SDL_active.h
* 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
/** @name 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 */

View File

@ -1,284 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/**
* @file SDL_audio.h
* 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
/**
* 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.
*
* @note 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.
*
* @param[out] stream A pointer to the audio data buffer
* @param[in] len The length of the audio 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;
/**
* @name 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
/**
* @name 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 */
/**
* @name Audio Init and Quit
* 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.
*
* 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.
*
* @sa SDL_AudioSpec
*/
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
typedef enum {
SDL_AUDIO_STOPPED = 0,
SDL_AUDIO_PLAYING,
SDL_AUDIO_PAUSED
} SDL_audiostatus;
/** Get the current audio state */
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:
* @code SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); @endcode
*
* 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.
*
* @return 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);
#define SDL_MIX_MAXVOLUME 128
/**
* 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.
*/
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
/**
* @name Audio Locks
* 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 */

View File

@ -1,29 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/**
* @file SDL_byteorder.h
* @deprecated Use SDL_endian.h instead
*/
/* DEPRECATED */
#include "SDL_endian.h"

View File

@ -1,202 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/**
* @file SDL_cdrom.h
* This is the CD-audio control API for Simple DirectMedia Layer
*/
#ifndef _SDL_cdrom_h
#define _SDL_cdrom_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
/**
* @file SDL_cdrom.h
* In order to use these functions, SDL_Init() must have been called
* with the SDL_INIT_CDROM flag. This causes SDL to scan the system
* for CD-ROM drives, and load appropriate drivers.
*/
/** The maximum number of CD-ROM tracks on a disk */
#define SDL_MAX_TRACKS 99
/** @name Track Types
* The types of CD-ROM track possible
*/
/*@{*/
#define SDL_AUDIO_TRACK 0x00
#define SDL_DATA_TRACK 0x04
/*@}*/
/** The possible states which a CD-ROM drive can be in. */
typedef enum {
CD_TRAYEMPTY,
CD_STOPPED,
CD_PLAYING,
CD_PAUSED,
CD_ERROR = -1
} CDstatus;
/** Given a status, returns true if there's a disk in the drive */
#define CD_INDRIVE(status) ((int)(status) > 0)
typedef struct SDL_CDtrack {
Uint8 id; /**< Track number */
Uint8 type; /**< Data or audio track */
Uint16 unused;
Uint32 length; /**< Length, in frames, of this track */
Uint32 offset; /**< Offset, in frames, from start of disk */
} SDL_CDtrack;
/** This structure is only current as of the last call to SDL_CDStatus() */
typedef struct SDL_CD {
int id; /**< Private drive identifier */
CDstatus status; /**< Current drive status */
/** The rest of this structure is only valid if there's a CD in drive */
/*@{*/
int numtracks; /**< Number of tracks on disk */
int cur_track; /**< Current track position */
int cur_frame; /**< Current frame offset within current track */
SDL_CDtrack track[SDL_MAX_TRACKS+1];
/*@}*/
} SDL_CD;
/** @name Frames / MSF Conversion Functions
* Conversion functions from frames to Minute/Second/Frames and vice versa
*/
/*@{*/
#define CD_FPS 75
#define FRAMES_TO_MSF(f, M,S,F) { \
int value = f; \
*(F) = value%CD_FPS; \
value /= CD_FPS; \
*(S) = value%60; \
value /= 60; \
*(M) = value; \
}
#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
/*@}*/
/* CD-audio API functions: */
/**
* Returns the number of CD-ROM drives on the system, or -1 if
* SDL_Init() has not been called with the SDL_INIT_CDROM flag.
*/
extern DECLSPEC int SDLCALL SDL_CDNumDrives(void);
/**
* Returns a human-readable, system-dependent identifier for the CD-ROM.
* Example:
* - "/dev/cdrom"
* - "E:"
* - "/dev/disk/ide/1/master"
*/
extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);
/**
* Opens a CD-ROM drive for access. It returns a drive handle on success,
* or NULL if the drive was invalid or busy. This newly opened CD-ROM
* becomes the default CD used when other CD functions are passed a NULL
* CD-ROM handle.
* Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
*/
extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);
/**
* This function returns the current status of the given drive.
* If the drive has a CD in it, the table of contents of the CD and current
* play position of the CD will be stored in the SDL_CD structure.
*/
extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom);
/**
* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
* tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
* until the end of the CD. This function will skip data tracks.
* This function should only be called after calling SDL_CDStatus() to
* get track information about the CD.
* For example:
* @code
* // Play entire CD:
* if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
* SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
* // Play last track:
* if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
* SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
* }
* // Play first and second track and 10 seconds of third track:
* if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
* SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);
* @endcode
*
* @return This function returns 0, or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom,
int start_track, int start_frame, int ntracks, int nframes);
/**
* Play the given CD starting at 'start' frame for 'length' frames.
* @return It returns 0, or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);
/** Pause play
* @return returns 0, or -1 on error
*/
extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);
/** Resume play
* @return returns 0, or -1 on error
*/
extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);
/** Stop play
* @return returns 0, or -1 on error
*/
extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);
/** Eject CD-ROM
* @return returns 0, or -1 on error
*/
extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);
/** Closes the handle for the CD-ROM drive */
extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_video_h */

View File

@ -1,45 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_config_h
#define _SDL_config_h
#include "SDL_platform.h"
/* Add any platform that doesn't build using the configure system */
#if defined(__DREAMCAST__)
#include "SDL_config_dreamcast.h"
#elif defined(__MACOS__)
#include "SDL_config_macos.h"
#elif defined(__MACOSX__)
#include "SDL_config_macosx.h"
#elif defined(__SYMBIAN32__)
#include "SDL_config_symbian.h" /* must be before win32! */
#elif defined(__WIN32__)
#include "SDL_config_win32.h"
#elif defined(__OS2__)
#include "SDL_config_os2.h"
#else
#include "SDL_config_minimal.h"
#endif /* platform config */
#endif /* _SDL_config_h */

View File

@ -1,45 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_config_h
#define _SDL_config_h
#include "SDL_platform.h"
/* Add any platform that doesn't build using the configure system */
#if defined(__DREAMCAST__)
#include "SDL_config_dreamcast.h"
#elif defined(__MACOS__)
#include "SDL_config_macos.h"
#elif defined(__MACOSX__)
#include "SDL_config_macosx.h"
#elif defined(__SYMBIAN32__)
#include "SDL_config_symbian.h" /* must be before win32! */
#elif defined(__WIN32__)
#include "SDL_config_win32.h"
#elif defined(__OS2__)
#include "SDL_config_os2.h"
#else
#include "SDL_config_minimal.h"
#endif /* platform config */
#endif /* _SDL_config_h */

View File

@ -1,310 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_config_h
#define _SDL_config_h
/* This is a set of defines to configure the SDL features */
/* General platform specific identifiers */
#include "SDL_platform.h"
/* Make sure that this isn't included by Visual C++ */
#ifdef _MSC_VER
#error You should copy include/SDL_config.h.default to include/SDL_config.h
#endif
/* C language features */
#undef const
#undef inline
#undef volatile
/* C datatypes */
#undef size_t
#undef int8_t
#undef uint8_t
#undef int16_t
#undef uint16_t
#undef int32_t
#undef uint32_t
#undef int64_t
#undef uint64_t
#undef uintptr_t
#undef SDL_HAS_64BIT_TYPE
/* Endianness */
#undef SDL_BYTEORDER
/* Comment this if you want to build without any C library requirements */
#undef HAVE_LIBC
#if HAVE_LIBC
/* Useful headers */
#undef HAVE_ALLOCA_H
#undef HAVE_SYS_TYPES_H
#undef HAVE_STDIO_H
#undef STDC_HEADERS
#undef HAVE_STDLIB_H
#undef HAVE_STDARG_H
#undef HAVE_MALLOC_H
#undef HAVE_MEMORY_H
#undef HAVE_STRING_H
#undef HAVE_STRINGS_H
#undef HAVE_INTTYPES_H
#undef HAVE_STDINT_H
#undef HAVE_CTYPE_H
#undef HAVE_MATH_H
#undef HAVE_ICONV_H
#undef HAVE_SIGNAL_H
#undef HAVE_ALTIVEC_H
/* C library functions */
#undef HAVE_MALLOC
#undef HAVE_CALLOC
#undef HAVE_REALLOC
#undef HAVE_FREE
#undef HAVE_ALLOCA
#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
#undef HAVE_GETENV
#undef HAVE_PUTENV
#undef HAVE_UNSETENV
#endif
#undef HAVE_QSORT
#undef HAVE_ABS
#undef HAVE_BCOPY
#undef HAVE_MEMSET
#undef HAVE_MEMCPY
#undef HAVE_MEMMOVE
#undef HAVE_MEMCMP
#undef HAVE_STRLEN
#undef HAVE_STRLCPY
#undef HAVE_STRLCAT
#undef HAVE_STRDUP
#undef HAVE__STRREV
#undef HAVE__STRUPR
#undef HAVE__STRLWR
#undef HAVE_INDEX
#undef HAVE_RINDEX
#undef HAVE_STRCHR
#undef HAVE_STRRCHR
#undef HAVE_STRSTR
#undef HAVE_ITOA
#undef HAVE__LTOA
#undef HAVE__UITOA
#undef HAVE__ULTOA
#undef HAVE_STRTOL
#undef HAVE_STRTOUL
#undef HAVE__I64TOA
#undef HAVE__UI64TOA
#undef HAVE_STRTOLL
#undef HAVE_STRTOULL
#undef HAVE_STRTOD
#undef HAVE_ATOI
#undef HAVE_ATOF
#undef HAVE_STRCMP
#undef HAVE_STRNCMP
#undef HAVE__STRICMP
#undef HAVE_STRCASECMP
#undef HAVE__STRNICMP
#undef HAVE_STRNCASECMP
#undef HAVE_SSCANF
#undef HAVE_SNPRINTF
#undef HAVE_VSNPRINTF
#undef HAVE_ICONV
#undef HAVE_SIGACTION
#undef HAVE_SETJMP
#undef HAVE_NANOSLEEP
#undef HAVE_CLOCK_GETTIME
#undef HAVE_GETPAGESIZE
#undef HAVE_MPROTECT
#else
/* We may need some replacement for stdarg.h here */
#include <stdarg.h>
#endif /* HAVE_LIBC */
/* Allow disabling of core subsystems */
#undef SDL_AUDIO_DISABLED
#undef SDL_CDROM_DISABLED
#undef SDL_CPUINFO_DISABLED
#undef SDL_EVENTS_DISABLED
#undef SDL_FILE_DISABLED
#undef SDL_JOYSTICK_DISABLED
#undef SDL_LOADSO_DISABLED
#undef SDL_THREADS_DISABLED
#undef SDL_TIMERS_DISABLED
#undef SDL_VIDEO_DISABLED
/* Enable various audio drivers */
#undef SDL_AUDIO_DRIVER_ALSA
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
#undef SDL_AUDIO_DRIVER_ARTS
#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
#undef SDL_AUDIO_DRIVER_BAUDIO
#undef SDL_AUDIO_DRIVER_BSD
#undef SDL_AUDIO_DRIVER_COREAUDIO
#undef SDL_AUDIO_DRIVER_DART
#undef SDL_AUDIO_DRIVER_DC
#undef SDL_AUDIO_DRIVER_DISK
#undef SDL_AUDIO_DRIVER_DUMMY
#undef SDL_AUDIO_DRIVER_DMEDIA
#undef SDL_AUDIO_DRIVER_DSOUND
#undef SDL_AUDIO_DRIVER_PULSE
#undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
#undef SDL_AUDIO_DRIVER_ESD
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
#undef SDL_AUDIO_DRIVER_MINT
#undef SDL_AUDIO_DRIVER_MMEAUDIO
#undef SDL_AUDIO_DRIVER_NAS
#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
#undef SDL_AUDIO_DRIVER_OSS
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
#undef SDL_AUDIO_DRIVER_PAUD
#undef SDL_AUDIO_DRIVER_QNXNTO
#undef SDL_AUDIO_DRIVER_SNDMGR
#undef SDL_AUDIO_DRIVER_SUNAUDIO
#undef SDL_AUDIO_DRIVER_WAVEOUT
/* Enable various cdrom drivers */
#undef SDL_CDROM_AIX
#undef SDL_CDROM_BEOS
#undef SDL_CDROM_BSDI
#undef SDL_CDROM_DC
#undef SDL_CDROM_DUMMY
#undef SDL_CDROM_FREEBSD
#undef SDL_CDROM_LINUX
#undef SDL_CDROM_MACOS
#undef SDL_CDROM_MACOSX
#undef SDL_CDROM_MINT
#undef SDL_CDROM_OPENBSD
#undef SDL_CDROM_OS2
#undef SDL_CDROM_OSF
#undef SDL_CDROM_QNX
#undef SDL_CDROM_WIN32
/* Enable various input drivers */
#undef SDL_INPUT_LINUXEV
#undef SDL_INPUT_TSLIB
#undef SDL_JOYSTICK_BEOS
#undef SDL_JOYSTICK_DC
#undef SDL_JOYSTICK_DUMMY
#undef SDL_JOYSTICK_IOKIT
#undef SDL_JOYSTICK_LINUX
#undef SDL_JOYSTICK_MACOS
#undef SDL_JOYSTICK_MINT
#undef SDL_JOYSTICK_OS2
#undef SDL_JOYSTICK_RISCOS
#undef SDL_JOYSTICK_WINMM
#undef SDL_JOYSTICK_USBHID
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
/* Enable various shared object loading systems */
#undef SDL_LOADSO_BEOS
#undef SDL_LOADSO_DLCOMPAT
#undef SDL_LOADSO_DLOPEN
#undef SDL_LOADSO_DUMMY
#undef SDL_LOADSO_LDG
#undef SDL_LOADSO_MACOS
#undef SDL_LOADSO_OS2
#undef SDL_LOADSO_WIN32
/* Enable various threading systems */
#undef SDL_THREAD_BEOS
#undef SDL_THREAD_DC
#undef SDL_THREAD_OS2
#undef SDL_THREAD_PTH
#undef SDL_THREAD_PTHREAD
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
#undef SDL_THREAD_SPROC
#undef SDL_THREAD_WIN32
/* Enable various timer systems */
#undef SDL_TIMER_BEOS
#undef SDL_TIMER_DC
#undef SDL_TIMER_DUMMY
#undef SDL_TIMER_MACOS
#undef SDL_TIMER_MINT
#undef SDL_TIMER_OS2
#undef SDL_TIMER_RISCOS
#undef SDL_TIMER_UNIX
#undef SDL_TIMER_WIN32
#undef SDL_TIMER_WINCE
/* Enable various video drivers */
#undef SDL_VIDEO_DRIVER_AALIB
#undef SDL_VIDEO_DRIVER_BWINDOW
#undef SDL_VIDEO_DRIVER_CACA
#undef SDL_VIDEO_DRIVER_DC
#undef SDL_VIDEO_DRIVER_DDRAW
#undef SDL_VIDEO_DRIVER_DGA
#undef SDL_VIDEO_DRIVER_DIRECTFB
#undef SDL_VIDEO_DRIVER_DRAWSPROCKET
#undef SDL_VIDEO_DRIVER_DUMMY
#undef SDL_VIDEO_DRIVER_FBCON
#undef SDL_VIDEO_DRIVER_GAPI
#undef SDL_VIDEO_DRIVER_GEM
#undef SDL_VIDEO_DRIVER_GGI
#undef SDL_VIDEO_DRIVER_IPOD
#undef SDL_VIDEO_DRIVER_NANOX
#undef SDL_VIDEO_DRIVER_OS2FS
#undef SDL_VIDEO_DRIVER_PHOTON
#undef SDL_VIDEO_DRIVER_PICOGUI
#undef SDL_VIDEO_DRIVER_PS2GS
#undef SDL_VIDEO_DRIVER_PS3
#undef SDL_VIDEO_DRIVER_QTOPIA
#undef SDL_VIDEO_DRIVER_QUARTZ
#undef SDL_VIDEO_DRIVER_RISCOS
#undef SDL_VIDEO_DRIVER_SVGALIB
#undef SDL_VIDEO_DRIVER_TOOLBOX
#undef SDL_VIDEO_DRIVER_VGL
#undef SDL_VIDEO_DRIVER_WINDIB
#undef SDL_VIDEO_DRIVER_WSCONS
#undef SDL_VIDEO_DRIVER_X11
#undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
#undef SDL_VIDEO_DRIVER_X11_VIDMODE
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
#undef SDL_VIDEO_DRIVER_X11_XME
#undef SDL_VIDEO_DRIVER_X11_XRANDR
#undef SDL_VIDEO_DRIVER_X11_XV
#undef SDL_VIDEO_DRIVER_XBIOS
/* Enable OpenGL support */
#undef SDL_VIDEO_OPENGL
#undef SDL_VIDEO_OPENGL_GLX
#undef SDL_VIDEO_OPENGL_WGL
#undef SDL_VIDEO_OPENGL_OSMESA
#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
/* Disable screensaver */
#undef SDL_VIDEO_DISABLE_SCREENSAVER
/* Enable assembly routines */
#undef SDL_ASSEMBLY_ROUTINES
#undef SDL_HERMES_BLITTERS
#undef SDL_ALTIVEC_BLITTERS
#endif /* _SDL_config_h */

View File

@ -1,106 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_config_dreamcast_h
#define _SDL_config_dreamcast_h
#include "SDL_platform.h"
/* This is a set of defines to configure the SDL features */
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;
typedef unsigned long uintptr_t;
#define SDL_HAS_64BIT_TYPE 1
/* Useful headers */
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STRING_H 1
#define HAVE_CTYPE_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_GETENV 1
#define HAVE_PUTENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRDUP 1
#define HAVE_INDEX 1
#define HAVE_RINDEX 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 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_STRICMP 1
#define HAVE_STRCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_DC 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various cdrom drivers */
#define SDL_CDROM_DC 1
/* Enable various input drivers */
#define SDL_JOYSTICK_DC 1
/* Enable various shared object loading systems */
#define SDL_LOADSO_DUMMY 1
/* Enable various threading systems */
#define SDL_THREAD_DC 1
/* Enable various timer systems */
#define SDL_TIMER_DC 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DC 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#endif /* _SDL_config_dreamcast_h */

View File

@ -1,112 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#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 */

View File

@ -1,150 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_config_macosx_h
#define _SDL_config_macosx_h
#include "SDL_platform.h"
/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
#include <AvailabilityMacros.h>
/* This is a set of defines to configure the SDL features */
#define SDL_HAS_64BIT_TYPE 1
/* Useful headers */
/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
#define HAVE_ALLOCA_H 1
#endif
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STRING_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_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_GETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRDUP 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_COREAUDIO 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various cdrom drivers */
#define SDL_CDROM_MACOSX 1
/* Enable various input drivers */
#define SDL_JOYSTICK_IOKIT 1
/* Enable various shared object loading systems */
#ifdef __ppc__
/* For Mac OS X 10.2 compatibility */
#define SDL_LOADSO_DLCOMPAT 1
#else
#define SDL_LOADSO_DLOPEN 1
#endif
/* Enable various threading systems */
#define SDL_THREAD_PTHREAD 1
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
/* Enable various timer systems */
#define SDL_TIMER_UNIX 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1
#if ((defined TARGET_API_MAC_CARBON) && (TARGET_API_MAC_CARBON))
#define SDL_VIDEO_DRIVER_TOOLBOX 1
#else
#define SDL_VIDEO_DRIVER_QUARTZ 1
#endif
#define SDL_VIDEO_DRIVER_DGA 1
#define SDL_VIDEO_DRIVER_X11 1
#define SDL_VIDEO_DRIVER_X11_DGAMOUSE 1
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER "/usr/X11R6/lib/libXrender.1.dylib"
#define SDL_VIDEO_DRIVER_X11_VIDMODE 1
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
#define SDL_VIDEO_DRIVER_X11_XME 1
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
#define SDL_VIDEO_DRIVER_X11_XV 1
/* Enable OpenGL support */
#define SDL_VIDEO_OPENGL 1
#define SDL_VIDEO_OPENGL_GLX 1
/* Disable screensaver */
#define SDL_VIDEO_DISABLE_SCREENSAVER 1
/* Enable assembly routines */
#define SDL_ASSEMBLY_ROUTINES 1
#ifdef __ppc__
#define SDL_ALTIVEC_BLITTERS 1
#endif
#endif /* _SDL_config_macosx_h */

View File

@ -1,62 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_config_minimal_h
#define _SDL_config_minimal_h
#include "SDL_platform.h"
/* This is the minimal configuration that can be used to build SDL */
#include <stdarg.h>
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 unsigned int size_t;
typedef unsigned long uintptr_t;
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
#define SDL_CDROM_DISABLED 1
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
#define SDL_JOYSTICK_DISABLED 1
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
/* Enable the stub thread support (src/thread/generic/\*.c) */
#define SDL_THREADS_DISABLED 1
/* Enable the stub timer support (src/timer/dummy/\*.c) */
#define SDL_TIMERS_DISABLED 1
/* Enable the dummy video driver (src/video/dummy/\*.c) */
#define SDL_VIDEO_DRIVER_DUMMY 1
#endif /* _SDL_config_minimal_h */

View File

@ -1,115 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_config_nds_h
#define _SDL_config_nds_h
#include "SDL_platform.h"
/* This is a set of defines to configure the SDL features */
/* General platform specific identifiers */
#include "SDL_platform.h"
/* C datatypes */
#define SDL_HAS_64BIT_TYPE 1
/* Endianness */
#define SDL_BYTEORDER 1234
/* Useful headers */
#define HAVE_ALLOCA_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STDLIB_H 1
#define HAVE_STDARG_H 1
#define HAVE_MALLOC_H 1
#define HAVE_STRING_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
#define HAVE_ICONV_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_GETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRDUP 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_SETJMP 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_NDS 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
#define SDL_CDROM_DISABLED 1
/* Enable various input drivers */
#define SDL_JOYSTICK_NDS 1
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
/* Enable the stub thread support (src/thread/generic/\*.c) */
#define SDL_THREADS_DISABLED 1
/* Enable various timer systems */
#define SDL_TIMER_NDS 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_NDS 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#endif /* _SDL_config_nds_h */

View File

@ -1,141 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_config_os2_h
#define _SDL_config_os2_h
#include "SDL_platform.h"
/* This is a set of defines to configure the SDL features */
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 unsigned int size_t;
typedef unsigned long uintptr_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
#define SDL_HAS_64BIT_TYPE 1
/* Use Watcom's LIBC */
#define HAVE_LIBC 1
/* Useful headers */
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STDLIB_H 1
#define HAVE_STDARG_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRING_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_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_GETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRDUP 1
#define HAVE__STRREV 1
#define HAVE__STRUPR 1
#define HAVE__STRLWR 1
#define HAVE_INDEX 1
#define HAVE_RINDEX 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_ITOA 1
#define HAVE__LTOA 1
#define HAVE__UITOA 1
#define HAVE__ULTOA 1
#define HAVE_STRTOL 1
#define HAVE__I64TOA 1
#define HAVE__UI64TOA 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_STRCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_SETJMP 1
#define HAVE_CLOCK_GETTIME 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_DART 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various cdrom drivers */
#define SDL_CDROM_OS2 1
/* Enable various input drivers */
#define SDL_JOYSTICK_OS2 1
/* Enable various shared object loading systems */
#define SDL_LOADSO_OS2 1
/* Enable various threading systems */
#define SDL_THREAD_OS2 1
/* Enable various timer systems */
#define SDL_TIMER_OS2 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_OS2FS 1
/* Enable OpenGL support */
/* Nothing here yet for OS/2... :( */
/* Enable assembly routines where available */
#define SDL_ASSEMBLY_ROUTINES 1
#endif /* _SDL_config_os2_h */

View File

@ -1,146 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/*
Symbian version Markus Mertama
*/
#ifndef _SDL_CONFIG_SYMBIAN_H
#define _SDL_CONFIG_SYMBIAN_H
#include "SDL_platform.h"
/* This is the minimal configuration that can be used to build SDL */
#include <stdarg.h>
#include <stddef.h>
#ifdef __GCCE__
#define SYMBIAN32_GCCE
#endif
#ifndef _SIZE_T_DEFINED
typedef unsigned int size_t;
#endif
#ifndef _INTPTR_T_DECLARED
typedef unsigned int uintptr_t;
#endif
#ifndef _INT8_T_DECLARED
typedef signed char int8_t;
#endif
#ifndef _UINT8_T_DECLARED
typedef unsigned char uint8_t;
#endif
#ifndef _INT16_T_DECLARED
typedef signed short int16_t;
#endif
#ifndef _UINT16_T_DECLARED
typedef unsigned short uint16_t;
#endif
#ifndef _INT32_T_DECLARED
typedef signed int int32_t;
#endif
#ifndef _UINT32_T_DECLARED
typedef unsigned int uint32_t;
#endif
#ifndef _INT64_T_DECLARED
typedef signed long long int64_t;
#endif
#ifndef _UINT64_T_DECLARED
typedef unsigned long long uint64_t;
#endif
#define SDL_AUDIO_DRIVER_EPOCAUDIO 1
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
#define SDL_CDROM_DISABLED 1
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
#define SDL_JOYSTICK_DISABLED 1
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
#define SDL_THREAD_SYMBIAN 1
#define SDL_VIDEO_DRIVER_EPOC 1
#define SDL_VIDEO_OPENGL 0
#define SDL_HAS_64BIT_TYPE 1
#define HAVE_LIBC 1
#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_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__STRUPR 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_ITOA 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
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#endif /* _SDL_CONFIG_SYMBIAN_H */

View File

@ -1,183 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#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 */
#if defined(__GNUC__) || defined(__DMC__)
#define HAVE_STDINT_H 1
#elif defined(_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
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
#define DWORD_PTR DWORD
#endif
#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
#define LONG_PTR LONG
#endif
#else /* !__GNUC__ && !_MSC_VER */
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 /* __GNUC__ || _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
/* Disable screensaver */
#define SDL_VIDEO_DISABLE_SCREENSAVER 1
/* Enable assembly routines (Win64 doesn't have inline asm) */
#ifndef _WIN64
#define SDL_ASSEMBLY_ROUTINES 1
#endif
#endif /* _SDL_config_win32_h */

View File

@ -1,22 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/

View File

@ -1,69 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/**
* @file SDL_cpuinfo.h
* CPU feature detection for SDL
*/
#ifndef _SDL_cpuinfo_h
#define _SDL_cpuinfo_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/** This function returns true if the CPU has the RDTSC instruction */
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
/** This function returns true if the CPU has MMX features */
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
/** This function returns true if the CPU has MMX Ext. features */
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
/** This function returns true if the CPU has 3DNow features */
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
/** This function returns true if the CPU has 3DNow! Ext. features */
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
/** This function returns true if the CPU has SSE features */
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
/** This function returns true if the CPU has SSE2 features */
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
/** This function returns true if the CPU has AltiVec features */
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_cpuinfo_h */

View File

@ -1,209 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/**
* @file SDL_endian.h
* Functions for reading and writing endian-specific values
*/
#ifndef _SDL_endian_h
#define _SDL_endian_h
#include "SDL_stdinc.h"
/** @name SDL_ENDIANs
* The two types of endianness
*/
/*@{*/
#define SDL_LIL_ENDIAN 1234
#define SDL_BIG_ENDIAN 4321
/*@}*/
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MISPEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
defined(__sparc__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
#endif /* !SDL_BYTEORDER */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name SDL_Swap Functions
* Use inline functions for compilers that support them, and static
* functions for those that do not. Because these functions become
* static for compilers that do not support inline functions, this
* header should only be included in files that actually use them.
*/
/*@{*/
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
static __inline__ Uint16 SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x));
return x;
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint16 SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x));
return x;
}
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static __inline__ Uint16 SDL_Swap16(Uint16 x)
{
Uint16 result;
__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
return result;
}
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
static __inline__ Uint16 SDL_Swap16(Uint16 x)
{
__asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc");
return x;
}
#else
static __inline__ Uint16 SDL_Swap16(Uint16 x) {
return((x<<8)|(x>>8));
}
#endif
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
static __inline__ Uint32 SDL_Swap32(Uint32 x)
{
__asm__("bswap %0" : "=r" (x) : "0" (x));
return x;
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint32 SDL_Swap32(Uint32 x)
{
__asm__("bswapl %0" : "=r" (x) : "0" (x));
return x;
}
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static __inline__ Uint32 SDL_Swap32(Uint32 x)
{
Uint32 result;
__asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
__asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x));
__asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
return result;
}
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
static __inline__ Uint32 SDL_Swap32(Uint32 x)
{
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc");
return x;
}
#else
static __inline__ Uint32 SDL_Swap32(Uint32 x) {
return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
}
#endif
#ifdef SDL_HAS_64BIT_TYPE
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
static __inline__ Uint64 SDL_Swap64(Uint64 x)
{
union {
struct { Uint32 a,b; } s;
Uint64 u;
} v;
v.u = x;
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
: "=r" (v.s.a), "=r" (v.s.b)
: "0" (v.s.a), "1" (v.s.b));
return v.u;
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint64 SDL_Swap64(Uint64 x)
{
__asm__("bswapq %0" : "=r" (x) : "0" (x));
return x;
}
#else
static __inline__ Uint64 SDL_Swap64(Uint64 x)
{
Uint32 hi, lo;
/* Separate into high and low 32-bit values and swap them */
lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
x >>= 32;
hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
x = SDL_Swap32(lo);
x <<= 32;
x |= SDL_Swap32(hi);
return(x);
}
#endif
#else
/* This is mainly to keep compilers from complaining in SDL code.
* If there is no real 64-bit datatype, then compilers will complain about
* the fake 64-bit datatype that SDL provides when it compiles user code.
*/
#define SDL_Swap64(X) (X)
#endif /* SDL_HAS_64BIT_TYPE */
/*@}*/
/**
* @name SDL_SwapLE and SDL_SwapBE Functions
* Byteswap item from the specified endianness to the native endianness
*/
/*@{*/
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define SDL_SwapLE16(X) (X)
#define SDL_SwapLE32(X) (X)
#define SDL_SwapLE64(X) (X)
#define SDL_SwapBE16(X) SDL_Swap16(X)
#define SDL_SwapBE32(X) SDL_Swap32(X)
#define SDL_SwapBE64(X) SDL_Swap64(X)
#else
#define SDL_SwapLE16(X) SDL_Swap16(X)
#define SDL_SwapLE32(X) SDL_Swap32(X)
#define SDL_SwapLE64(X) SDL_Swap64(X)
#define SDL_SwapBE16(X) (X)
#define SDL_SwapBE32(X) (X)
#define SDL_SwapBE64(X) (X)
#endif
/*@}*/
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_endian_h */

View File

@ -1,72 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/**
* @file SDL_error.h
* Simple error message routines for SDL
*/
#ifndef _SDL_error_h
#define _SDL_error_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Public functions
*/
/*@{*/
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
extern DECLSPEC char * SDLCALL SDL_GetError(void);
extern DECLSPEC void SDLCALL SDL_ClearError(void);
/*@}*/
/**
* @name Private functions
* @internal Private error message function - used internally
*/
/*@{*/
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
typedef enum {
SDL_ENOMEM,
SDL_EFREAD,
SDL_EFWRITE,
SDL_EFSEEK,
SDL_UNSUPPORTED,
SDL_LASTERROR
} SDL_errorcode;
extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
/*@}*/
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_error_h */

View File

@ -1,356 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/**
* @file SDL_events.h
* Include file for SDL event handling
*/
#ifndef _SDL_events_h
#define _SDL_events_h
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_active.h"
#include "SDL_keyboard.h"
#include "SDL_mouse.h"
#include "SDL_joystick.h"
#include "SDL_quit.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/** @name General keyboard/mouse state definitions */
/*@{*/
#define SDL_RELEASED 0
#define SDL_PRESSED 1
/*@}*/
/** Event enumerations */
typedef enum {
SDL_NOEVENT = 0, /**< Unused (do not remove) */
SDL_ACTIVEEVENT, /**< Application loses/gains visibility */
SDL_KEYDOWN, /**< Keys pressed */
SDL_KEYUP, /**< Keys released */
SDL_MOUSEMOTION, /**< Mouse moved */
SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
SDL_MOUSEBUTTONUP, /**< Mouse button released */
SDL_JOYAXISMOTION, /**< Joystick axis motion */
SDL_JOYBALLMOTION, /**< Joystick trackball motion */
SDL_JOYHATMOTION, /**< Joystick hat position change */
SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
SDL_JOYBUTTONUP, /**< Joystick button released */
SDL_QUIT, /**< User-requested quit */
SDL_SYSWMEVENT, /**< System specific event */
SDL_EVENT_RESERVEDA, /**< Reserved for future use.. */
SDL_EVENT_RESERVEDB, /**< Reserved for future use.. */
SDL_VIDEORESIZE, /**< User resized video mode */
SDL_VIDEOEXPOSE, /**< Screen needs to be redrawn */
SDL_EVENT_RESERVED2, /**< Reserved for future use.. */
SDL_EVENT_RESERVED3, /**< Reserved for future use.. */
SDL_EVENT_RESERVED4, /**< Reserved for future use.. */
SDL_EVENT_RESERVED5, /**< Reserved for future use.. */
SDL_EVENT_RESERVED6, /**< Reserved for future use.. */
SDL_EVENT_RESERVED7, /**< Reserved for future use.. */
/** Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
SDL_USEREVENT = 24,
/** This last event is only for bounding internal arrays
* It is the number of bits in the event mask datatype -- Uint32
*/
SDL_NUMEVENTS = 32
} SDL_EventType;
/** @name Predefined event masks */
/*@{*/
#define SDL_EVENTMASK(X) (1<<(X))
typedef enum {
SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)|
SDL_EVENTMASK(SDL_KEYUP),
SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
SDL_EVENTMASK(SDL_JOYBALLMOTION)|
SDL_EVENTMASK(SDL_JOYHATMOTION)|
SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
SDL_EVENTMASK(SDL_JOYBUTTONUP),
SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
} SDL_EventMask ;
#define SDL_ALLEVENTS 0xFFFFFFFF
/*@}*/
/** Application visibility event structure */
typedef struct SDL_ActiveEvent {
Uint8 type; /**< SDL_ACTIVEEVENT */
Uint8 gain; /**< Whether given states were gained or lost (1/0) */
Uint8 state; /**< A mask of the focus states */
} SDL_ActiveEvent;
/** Keyboard event structure */
typedef struct SDL_KeyboardEvent {
Uint8 type; /**< SDL_KEYDOWN or SDL_KEYUP */
Uint8 which; /**< The keyboard device index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
SDL_keysym keysym;
} SDL_KeyboardEvent;
/** Mouse motion event structure */
typedef struct SDL_MouseMotionEvent {
Uint8 type; /**< SDL_MOUSEMOTION */
Uint8 which; /**< The mouse device index */
Uint8 state; /**< The current button state */
Uint16 x, y; /**< The X/Y coordinates of the mouse */
Sint16 xrel; /**< The relative motion in the X direction */
Sint16 yrel; /**< The relative motion in the Y direction */
} SDL_MouseMotionEvent;
/** Mouse button event structure */
typedef struct SDL_MouseButtonEvent {
Uint8 type; /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
Uint8 which; /**< The mouse device index */
Uint8 button; /**< The mouse button index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
Uint16 x, y; /**< The X/Y coordinates of the mouse at press time */
} SDL_MouseButtonEvent;
/** Joystick axis motion event structure */
typedef struct SDL_JoyAxisEvent {
Uint8 type; /**< SDL_JOYAXISMOTION */
Uint8 which; /**< The joystick device index */
Uint8 axis; /**< The joystick axis index */
Sint16 value; /**< The axis value (range: -32768 to 32767) */
} SDL_JoyAxisEvent;
/** Joystick trackball motion event structure */
typedef struct SDL_JoyBallEvent {
Uint8 type; /**< SDL_JOYBALLMOTION */
Uint8 which; /**< The joystick device index */
Uint8 ball; /**< The joystick trackball index */
Sint16 xrel; /**< The relative motion in the X direction */
Sint16 yrel; /**< The relative motion in the Y direction */
} SDL_JoyBallEvent;
/** Joystick hat position change event structure */
typedef struct SDL_JoyHatEvent {
Uint8 type; /**< SDL_JOYHATMOTION */
Uint8 which; /**< The joystick device index */
Uint8 hat; /**< The joystick hat index */
Uint8 value; /**< The hat position value:
* SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
* SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
* SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
* Note that zero means the POV is centered.
*/
} SDL_JoyHatEvent;
/** Joystick button event structure */
typedef struct SDL_JoyButtonEvent {
Uint8 type; /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
Uint8 which; /**< The joystick device index */
Uint8 button; /**< The joystick button index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */
} SDL_JoyButtonEvent;
/** The "window resized" event
* When you get this event, you are responsible for setting a new video
* mode with the new width and height.
*/
typedef struct SDL_ResizeEvent {
Uint8 type; /**< SDL_VIDEORESIZE */
int w; /**< New width */
int h; /**< New height */
} SDL_ResizeEvent;
/** The "screen redraw" event */
typedef struct SDL_ExposeEvent {
Uint8 type; /**< SDL_VIDEOEXPOSE */
} SDL_ExposeEvent;
/** The "quit requested" event */
typedef struct SDL_QuitEvent {
Uint8 type; /**< SDL_QUIT */
} SDL_QuitEvent;
/** A user-defined event type */
typedef struct SDL_UserEvent {
Uint8 type; /**< SDL_USEREVENT through SDL_NUMEVENTS-1 */
int code; /**< User defined event code */
void *data1; /**< User defined data pointer */
void *data2; /**< User defined data pointer */
} SDL_UserEvent;
/** If you want to use this event, you should include SDL_syswm.h */
struct SDL_SysWMmsg;
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
typedef struct SDL_SysWMEvent {
Uint8 type;
SDL_SysWMmsg *msg;
} SDL_SysWMEvent;
/** General event structure */
typedef union SDL_Event {
Uint8 type;
SDL_ActiveEvent active;
SDL_KeyboardEvent key;
SDL_MouseMotionEvent motion;
SDL_MouseButtonEvent button;
SDL_JoyAxisEvent jaxis;
SDL_JoyBallEvent jball;
SDL_JoyHatEvent jhat;
SDL_JoyButtonEvent jbutton;
SDL_ResizeEvent resize;
SDL_ExposeEvent expose;
SDL_QuitEvent quit;
SDL_UserEvent user;
SDL_SysWMEvent syswm;
} SDL_Event;
/* Function prototypes */
/** Pumps the event loop, gathering events from the input devices.
* This function updates the event queue and internal input device state.
* This should only be run in the thread that sets the video mode.
*/
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
typedef enum {
SDL_ADDEVENT,
SDL_PEEKEVENT,
SDL_GETEVENT
} SDL_eventaction;
/**
* Checks the event queue for messages and optionally returns them.
*
* If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
* the back of the event queue.
* If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
* of the event queue, matching 'mask', will be returned and will not
* be removed from the queue.
* If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
* of the event queue, matching 'mask', will be returned and will be
* removed from the queue.
*
* @return
* This function returns the number of events actually stored, or -1
* if there was an error.
*
* This function is thread-safe.
*/
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
SDL_eventaction action, Uint32 mask);
/** Polls for currently pending events, and returns 1 if there are any pending
* events, or 0 if there are none available. If 'event' is not NULL, the next
* event is removed from the queue and stored in that area.
*/
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
/** Waits indefinitely for the next available event, returning 1, or 0 if there
* was an error while waiting for events. If 'event' is not NULL, the next
* event is removed from the queue and stored in that area.
*/
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
/** Add an event to the event queue.
* This function returns 0 on success, or -1 if the event queue was full
* or there was some other error.
*/
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
/** @name Event Filtering */
/*@{*/
typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
/**
* This function sets up a filter to process all events before they
* change internal state and are posted to the internal event queue.
*
* The filter is protypted as:
* @code typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event); @endcode
*
* If the filter returns 1, then the event will be added to the internal queue.
* If it returns 0, then the event will be dropped from the queue, but the
* internal state will still be updated. This allows selective filtering of
* dynamically arriving events.
*
* @warning Be very careful of what you do in the event filter function, as
* it may run in a different thread!
*
* There is one caveat when dealing with the SDL_QUITEVENT event type. The
* event filter is only called when the window manager desires to close the
* application window. If the event filter returns 1, then the window will
* be closed, otherwise the window will remain open if possible.
* If the quit event is generated by an interrupt signal, it will bypass the
* internal queue and be delivered to the application at the next event poll.
*/
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
/**
* Return the current event filter - can be used to "chain" filters.
* If there is no event filter set, this function returns NULL.
*/
extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
/*@}*/
/** @name Event State */
/*@{*/
#define SDL_QUERY -1
#define SDL_IGNORE 0
#define SDL_DISABLE 0
#define SDL_ENABLE 1
/*@}*/
/**
* This function allows you to set the state of processing certain events.
* If 'state' is set to SDL_IGNORE, that event will be automatically dropped
* from the event queue and will not event be filtered.
* If 'state' is set to SDL_ENABLE, that event will be processed normally.
* If 'state' is set to SDL_QUERY, SDL_EventState() will return the
* current processing state of the specified event.
*/
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_events_h */

View File

@ -1,28 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_getenv.h
* @deprecated Use SDL_stdinc.h instead
*/
/* DEPRECATED */
#include "SDL_stdinc.h"

View File

@ -1,187 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_joystick.h
* 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
/** @file SDL_joystick.h
* @note 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.
*
* @param[in] device_index
* 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.
*
* @return 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.
*
* @param[in] state 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
*
* @param[in] axis The axis indices start at index 0.
*
* @return The state is a value ranging from -32768 to 32767.
*/
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
/**
* @name Hat Positions
* The return value of SDL_JoystickGetHat() 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)
/*@}*/
/**
* Get the current state of a POV hat on a joystick
*
* @param[in] hat 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
*
* @param[in] ball The ball indices start at index 0.
*
* @return This returns 0, or -1 if you passed it invalid parameters.
*/
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
*
* @param[in] button 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 */

View File

@ -1,135 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_keyboard.h
* Include file for SDL keyboard event handling
*/
#ifndef _SDL_keyboard_h
#define _SDL_keyboard_h
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_keysym.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/** Keysym structure
*
* - The scancode is hardware dependent, and should not be used by general
* applications. If no hardware scancode is available, it will be 0.
*
* - The 'unicode' translated character is only available when character
* translation is enabled by the SDL_EnableUNICODE() API. If non-zero,
* this is a UNICODE character corresponding to the keypress. If the
* high 9 bits of the character are 0, then this maps to the equivalent
* ASCII character:
* @code
* char ch;
* if ( (keysym.unicode & 0xFF80) == 0 ) {
* ch = keysym.unicode & 0x7F;
* } else {
* An international character..
* }
* @endcode
*/
typedef struct SDL_keysym {
Uint8 scancode; /**< hardware specific scancode */
SDLKey sym; /**< SDL virtual keysym */
SDLMod mod; /**< current key modifiers */
Uint16 unicode; /**< translated character */
} SDL_keysym;
/** This is the mask which refers to all hotkey bindings */
#define SDL_ALL_HOTKEYS 0xFFFFFFFF
/* Function prototypes */
/**
* Enable/Disable UNICODE translation of keyboard input.
*
* This translation has some overhead, so translation defaults off.
*
* @param[in] enable
* If 'enable' is 1, translation is enabled.
* If 'enable' is 0, translation is disabled.
* If 'enable' is -1, the translation state is not changed.
*
* @return It returns the previous state of keyboard translation.
*/
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
#define SDL_DEFAULT_REPEAT_DELAY 500
#define SDL_DEFAULT_REPEAT_INTERVAL 30
/**
* Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
*
* @param[in] delay
* 'delay' is the initial delay in ms between the time when a key is
* pressed, and keyboard repeat begins.
*
* @param[in] interval
* 'interval' is the time in ms between keyboard repeat events.
*
* If 'delay' is set to 0, keyboard repeat is disabled.
*/
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
/**
* Get a snapshot of the current state of the keyboard.
* Returns an array of keystates, indexed by the SDLK_* syms.
* Usage:
* @code
* Uint8 *keystate = SDL_GetKeyState(NULL);
* if ( keystate[SDLK_RETURN] ) //... \<RETURN> is pressed.
* @endcode
*/
extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys);
/**
* Get the current key modifier state
*/
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
/**
* Set the current key modifier state.
* This does not change the keyboard state, only the key modifier flags.
*/
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
/**
* Get the name of an SDL virtual keysym
*/
extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_keyboard_h */

View File

@ -1,326 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_keysym_h
#define _SDL_keysym_h
/** What we really want is a mapping of every raw key on the keyboard.
* To support international keyboards, we use the range 0xA1 - 0xFF
* as international virtual keycodes. We'll follow in the footsteps of X11...
* @brief The names of the keys
*/
typedef enum {
/** @name ASCII mapped keysyms
* The keyboard syms have been cleverly chosen to map to ASCII
*/
/*@{*/
SDLK_UNKNOWN = 0,
SDLK_FIRST = 0,
SDLK_BACKSPACE = 8,
SDLK_TAB = 9,
SDLK_CLEAR = 12,
SDLK_RETURN = 13,
SDLK_PAUSE = 19,
SDLK_ESCAPE = 27,
SDLK_SPACE = 32,
SDLK_EXCLAIM = 33,
SDLK_QUOTEDBL = 34,
SDLK_HASH = 35,
SDLK_DOLLAR = 36,
SDLK_AMPERSAND = 38,
SDLK_QUOTE = 39,
SDLK_LEFTPAREN = 40,
SDLK_RIGHTPAREN = 41,
SDLK_ASTERISK = 42,
SDLK_PLUS = 43,
SDLK_COMMA = 44,
SDLK_MINUS = 45,
SDLK_PERIOD = 46,
SDLK_SLASH = 47,
SDLK_0 = 48,
SDLK_1 = 49,
SDLK_2 = 50,
SDLK_3 = 51,
SDLK_4 = 52,
SDLK_5 = 53,
SDLK_6 = 54,
SDLK_7 = 55,
SDLK_8 = 56,
SDLK_9 = 57,
SDLK_COLON = 58,
SDLK_SEMICOLON = 59,
SDLK_LESS = 60,
SDLK_EQUALS = 61,
SDLK_GREATER = 62,
SDLK_QUESTION = 63,
SDLK_AT = 64,
/*
Skip uppercase letters
*/
SDLK_LEFTBRACKET = 91,
SDLK_BACKSLASH = 92,
SDLK_RIGHTBRACKET = 93,
SDLK_CARET = 94,
SDLK_UNDERSCORE = 95,
SDLK_BACKQUOTE = 96,
SDLK_a = 97,
SDLK_b = 98,
SDLK_c = 99,
SDLK_d = 100,
SDLK_e = 101,
SDLK_f = 102,
SDLK_g = 103,
SDLK_h = 104,
SDLK_i = 105,
SDLK_j = 106,
SDLK_k = 107,
SDLK_l = 108,
SDLK_m = 109,
SDLK_n = 110,
SDLK_o = 111,
SDLK_p = 112,
SDLK_q = 113,
SDLK_r = 114,
SDLK_s = 115,
SDLK_t = 116,
SDLK_u = 117,
SDLK_v = 118,
SDLK_w = 119,
SDLK_x = 120,
SDLK_y = 121,
SDLK_z = 122,
SDLK_DELETE = 127,
/* End of ASCII mapped keysyms */
/*@}*/
/** @name International keyboard syms */
/*@{*/
SDLK_WORLD_0 = 160, /* 0xA0 */
SDLK_WORLD_1 = 161,
SDLK_WORLD_2 = 162,
SDLK_WORLD_3 = 163,
SDLK_WORLD_4 = 164,
SDLK_WORLD_5 = 165,
SDLK_WORLD_6 = 166,
SDLK_WORLD_7 = 167,
SDLK_WORLD_8 = 168,
SDLK_WORLD_9 = 169,
SDLK_WORLD_10 = 170,
SDLK_WORLD_11 = 171,
SDLK_WORLD_12 = 172,
SDLK_WORLD_13 = 173,
SDLK_WORLD_14 = 174,
SDLK_WORLD_15 = 175,
SDLK_WORLD_16 = 176,
SDLK_WORLD_17 = 177,
SDLK_WORLD_18 = 178,
SDLK_WORLD_19 = 179,
SDLK_WORLD_20 = 180,
SDLK_WORLD_21 = 181,
SDLK_WORLD_22 = 182,
SDLK_WORLD_23 = 183,
SDLK_WORLD_24 = 184,
SDLK_WORLD_25 = 185,
SDLK_WORLD_26 = 186,
SDLK_WORLD_27 = 187,
SDLK_WORLD_28 = 188,
SDLK_WORLD_29 = 189,
SDLK_WORLD_30 = 190,
SDLK_WORLD_31 = 191,
SDLK_WORLD_32 = 192,
SDLK_WORLD_33 = 193,
SDLK_WORLD_34 = 194,
SDLK_WORLD_35 = 195,
SDLK_WORLD_36 = 196,
SDLK_WORLD_37 = 197,
SDLK_WORLD_38 = 198,
SDLK_WORLD_39 = 199,
SDLK_WORLD_40 = 200,
SDLK_WORLD_41 = 201,
SDLK_WORLD_42 = 202,
SDLK_WORLD_43 = 203,
SDLK_WORLD_44 = 204,
SDLK_WORLD_45 = 205,
SDLK_WORLD_46 = 206,
SDLK_WORLD_47 = 207,
SDLK_WORLD_48 = 208,
SDLK_WORLD_49 = 209,
SDLK_WORLD_50 = 210,
SDLK_WORLD_51 = 211,
SDLK_WORLD_52 = 212,
SDLK_WORLD_53 = 213,
SDLK_WORLD_54 = 214,
SDLK_WORLD_55 = 215,
SDLK_WORLD_56 = 216,
SDLK_WORLD_57 = 217,
SDLK_WORLD_58 = 218,
SDLK_WORLD_59 = 219,
SDLK_WORLD_60 = 220,
SDLK_WORLD_61 = 221,
SDLK_WORLD_62 = 222,
SDLK_WORLD_63 = 223,
SDLK_WORLD_64 = 224,
SDLK_WORLD_65 = 225,
SDLK_WORLD_66 = 226,
SDLK_WORLD_67 = 227,
SDLK_WORLD_68 = 228,
SDLK_WORLD_69 = 229,
SDLK_WORLD_70 = 230,
SDLK_WORLD_71 = 231,
SDLK_WORLD_72 = 232,
SDLK_WORLD_73 = 233,
SDLK_WORLD_74 = 234,
SDLK_WORLD_75 = 235,
SDLK_WORLD_76 = 236,
SDLK_WORLD_77 = 237,
SDLK_WORLD_78 = 238,
SDLK_WORLD_79 = 239,
SDLK_WORLD_80 = 240,
SDLK_WORLD_81 = 241,
SDLK_WORLD_82 = 242,
SDLK_WORLD_83 = 243,
SDLK_WORLD_84 = 244,
SDLK_WORLD_85 = 245,
SDLK_WORLD_86 = 246,
SDLK_WORLD_87 = 247,
SDLK_WORLD_88 = 248,
SDLK_WORLD_89 = 249,
SDLK_WORLD_90 = 250,
SDLK_WORLD_91 = 251,
SDLK_WORLD_92 = 252,
SDLK_WORLD_93 = 253,
SDLK_WORLD_94 = 254,
SDLK_WORLD_95 = 255, /* 0xFF */
/*@}*/
/** @name Numeric keypad */
/*@{*/
SDLK_KP0 = 256,
SDLK_KP1 = 257,
SDLK_KP2 = 258,
SDLK_KP3 = 259,
SDLK_KP4 = 260,
SDLK_KP5 = 261,
SDLK_KP6 = 262,
SDLK_KP7 = 263,
SDLK_KP8 = 264,
SDLK_KP9 = 265,
SDLK_KP_PERIOD = 266,
SDLK_KP_DIVIDE = 267,
SDLK_KP_MULTIPLY = 268,
SDLK_KP_MINUS = 269,
SDLK_KP_PLUS = 270,
SDLK_KP_ENTER = 271,
SDLK_KP_EQUALS = 272,
/*@}*/
/** @name Arrows + Home/End pad */
/*@{*/
SDLK_UP = 273,
SDLK_DOWN = 274,
SDLK_RIGHT = 275,
SDLK_LEFT = 276,
SDLK_INSERT = 277,
SDLK_HOME = 278,
SDLK_END = 279,
SDLK_PAGEUP = 280,
SDLK_PAGEDOWN = 281,
/*@}*/
/** @name Function keys */
/*@{*/
SDLK_F1 = 282,
SDLK_F2 = 283,
SDLK_F3 = 284,
SDLK_F4 = 285,
SDLK_F5 = 286,
SDLK_F6 = 287,
SDLK_F7 = 288,
SDLK_F8 = 289,
SDLK_F9 = 290,
SDLK_F10 = 291,
SDLK_F11 = 292,
SDLK_F12 = 293,
SDLK_F13 = 294,
SDLK_F14 = 295,
SDLK_F15 = 296,
/*@}*/
/** @name Key state modifier keys */
/*@{*/
SDLK_NUMLOCK = 300,
SDLK_CAPSLOCK = 301,
SDLK_SCROLLOCK = 302,
SDLK_RSHIFT = 303,
SDLK_LSHIFT = 304,
SDLK_RCTRL = 305,
SDLK_LCTRL = 306,
SDLK_RALT = 307,
SDLK_LALT = 308,
SDLK_RMETA = 309,
SDLK_LMETA = 310,
SDLK_LSUPER = 311, /**< Left "Windows" key */
SDLK_RSUPER = 312, /**< Right "Windows" key */
SDLK_MODE = 313, /**< "Alt Gr" key */
SDLK_COMPOSE = 314, /**< Multi-key compose key */
/*@}*/
/** @name Miscellaneous function keys */
/*@{*/
SDLK_HELP = 315,
SDLK_PRINT = 316,
SDLK_SYSREQ = 317,
SDLK_BREAK = 318,
SDLK_MENU = 319,
SDLK_POWER = 320, /**< Power Macintosh power key */
SDLK_EURO = 321, /**< Some european keyboards */
SDLK_UNDO = 322, /**< Atari keyboard has Undo */
/*@}*/
/* Add any other keys here */
SDLK_LAST
} SDLKey;
/** Enumeration of valid key mods (possibly OR'd together) */
typedef enum {
KMOD_NONE = 0x0000,
KMOD_LSHIFT= 0x0001,
KMOD_RSHIFT= 0x0002,
KMOD_LCTRL = 0x0040,
KMOD_RCTRL = 0x0080,
KMOD_LALT = 0x0100,
KMOD_RALT = 0x0200,
KMOD_LMETA = 0x0400,
KMOD_RMETA = 0x0800,
KMOD_NUM = 0x1000,
KMOD_CAPS = 0x2000,
KMOD_MODE = 0x4000,
KMOD_RESERVED = 0x8000
} SDLMod;
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
#endif /* _SDL_keysym_h */

View File

@ -1,78 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_loadso.h
* System dependent library loading routines
*/
/** @file SDL_loadso.h
* Some things to keep in mind:
* - These functions only work on C function names. Other languages may
* have name mangling and intrinsic language support that varies from
* compiler to compiler.
* - Make sure you declare your function pointers with the same calling
* convention as the actual library function. Your code will crash
* mysteriously if you do not do this.
* - Avoid namespace collisions. If you load a symbol from the library,
* it is not defined whether or not it goes into the global symbol
* namespace for the application. If it does and it conflicts with
* symbols in your code or other shared libraries, you will not get
* the results you expect. :)
*/
#ifndef _SDL_loadso_h
#define _SDL_loadso_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 function dynamically loads a shared object and returns a pointer
* to the object handle (or NULL if there was an error).
* The 'sofile' parameter is a system dependent name of the object file.
*/
extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
/**
* Given an object handle, this function looks up the address of the
* named function in the shared object and returns it. This address
* is no longer valid after calling SDL_UnloadObject().
*/
extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name);
/** Unload a shared object from memory */
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_loadso_h */

View File

@ -1,106 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_main_h
#define _SDL_main_h
#include "SDL_stdinc.h"
/** @file SDL_main.h
* Redefine main() on Win32 and MacOS so that it is called by winmain.c
*/
#if defined(__WIN32__) || \
(defined(__MWERKS__) && !defined(__BEOS__)) || \
defined(__MACOS__) || defined(__MACOSX__) || \
defined(__SYMBIAN32__) || defined(QWS)
#ifdef __cplusplus
#define C_LINKAGE "C"
#else
#define C_LINKAGE
#endif /* __cplusplus */
/** The application's main() function must be called with C linkage,
* and should be declared like this:
* @code
* #ifdef __cplusplus
* extern "C"
* #endif
* int main(int argc, char *argv[])
* {
* }
* @endcode
*/
#define main SDL_main
/** The prototype for the application's main() function */
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
/** @name From the SDL library code -- needed for registering the app on Win32 */
/*@{*/
#ifdef __WIN32__
#include "begin_code.h"
#ifdef __cplusplus
extern "C" {
#endif
/** This should be called from your WinMain() function, if any */
extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
/** This can also be called, but is no longer necessary */
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
/** This can also be called, but is no longer necessary (SDL_Quit calls it) */
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif
/*@}*/
/** @name From the SDL library code -- needed for registering QuickDraw on MacOS */
/*@{*/
#if defined(__MACOS__)
#include "begin_code.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Forward declaration so we don't need to include QuickDraw.h */
struct QDGlobals;
/** This should be called from your main() function, if any */
extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif
/*@}*/
#endif /* Need to redefine main()? */
#endif /* _SDL_main_h */

View File

@ -1,143 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_mouse.h
* Include file for SDL mouse event handling
*/
#ifndef _SDL_mouse_h
#define _SDL_mouse_h
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_video.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
typedef struct WMcursor WMcursor; /**< Implementation dependent */
typedef struct SDL_Cursor {
SDL_Rect area; /**< The area of the mouse cursor */
Sint16 hot_x, hot_y; /**< The "tip" of the cursor */
Uint8 *data; /**< B/W cursor data */
Uint8 *mask; /**< B/W cursor mask */
Uint8 *save[2]; /**< Place to save cursor area */
WMcursor *wm_cursor; /**< Window-manager cursor */
} SDL_Cursor;
/* Function prototypes */
/**
* Retrieve the current state of the mouse.
* The current button state is returned as a button bitmask, which can
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
* current mouse cursor position. You can pass NULL for either x or y.
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
/**
* Retrieve the current state of the mouse.
* The current button state is returned as a button bitmask, which can
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
* mouse deltas since the last call to SDL_GetRelativeMouseState().
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
/**
* Set the position of the mouse cursor (generates a mouse motion event)
*/
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
/**
* Create a cursor using the specified data and mask (in MSB format).
* The cursor width must be a multiple of 8 bits.
*
* The cursor is created in black and white according to the following:
* data mask resulting pixel on screen
* 0 1 White
* 1 1 Black
* 0 0 Transparent
* 1 0 Inverted color if possible, black if not.
*
* Cursors created with this function must be freed with SDL_FreeCursor().
*/
extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
/**
* Set the currently active cursor to the specified one.
* If the cursor is currently visible, the change will be immediately
* represented on the display.
*/
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
/**
* Returns the currently active cursor.
*/
extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
/**
* Deallocates a cursor created with SDL_CreateCursor().
*/
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
/**
* Toggle whether or not the cursor is shown on the screen.
* The cursor start off displayed, but can be turned off.
* SDL_ShowCursor() returns 1 if the cursor was being displayed
* before the call, or 0 if it was not. You can query the current
* state by passing a 'toggle' value of -1.
*/
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
/*@{*/
/** Used as a mask when testing buttons in buttonstate
* Button 1: Left mouse button
* Button 2: Middle mouse button
* Button 3: Right mouse button
* Button 4: Mouse wheel up (may also be a real button)
* Button 5: Mouse wheel down (may also be a real button)
*/
#define SDL_BUTTON(X) (1 << ((X)-1))
#define SDL_BUTTON_LEFT 1
#define SDL_BUTTON_MIDDLE 2
#define SDL_BUTTON_RIGHT 3
#define SDL_BUTTON_WHEELUP 4
#define SDL_BUTTON_WHEELDOWN 5
#define SDL_BUTTON_X1 6
#define SDL_BUTTON_X2 7
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
/*@}*/
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_mouse_h */

View File

@ -1,177 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_mutex_h
#define _SDL_mutex_h
/** @file SDL_mutex.h
* Functions to provide thread synchronization primitives
*
* @note These are independent of the other SDL routines.
*/
#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
/** Synchronization functions which can time out return this value
* if they time out.
*/
#define SDL_MUTEX_TIMEDOUT 1
/** This is the timeout value which corresponds to never time out */
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** @name Mutex functions */ /*@{*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** The SDL mutex structure, defined in SDL_mutex.c */
struct SDL_mutex;
typedef struct SDL_mutex SDL_mutex;
/** Create a mutex, initialized unlocked */
extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
#define SDL_LockMutex(m) SDL_mutexP(m)
/** Lock the mutex
* @return 0, or -1 on error
*/
extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
#define SDL_UnlockMutex(m) SDL_mutexV(m)
/** Unlock the mutex
* @return 0, or -1 on error
*
* It is an error to unlock a mutex that has not been locked by
* the current thread, and doing so results in undefined behavior.
*/
extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex);
/** Destroy a mutex */
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex);
/*@}*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** @name Semaphore functions */ /*@{*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** The SDL semaphore structure, defined in SDL_sem.c */
struct SDL_semaphore;
typedef struct SDL_semaphore SDL_sem;
/** Create a semaphore, initialized with value, returns NULL on failure. */
extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
/** Destroy a semaphore */
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
/**
* This function suspends the calling thread until the semaphore pointed
* to by sem has a positive count. It then atomically decreases the semaphore
* count.
*/
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
/** Non-blocking variant of SDL_SemWait().
* @return 0 if the wait succeeds,
* SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem);
/** Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if
* the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in
* the allotted time, and -1 on error.
*
* On some platforms this function is implemented by looping with a delay
* of 1 ms, and so should be avoided if possible.
*/
extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms);
/** Atomically increases the semaphore's count (not blocking).
* @return 0, or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem);
/** Returns the current count of the semaphore */
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem);
/*@}*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** @name Condition_variable_functions */ /*@{*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*@{*/
/** The SDL condition variable structure, defined in SDL_cond.c */
struct SDL_cond;
typedef struct SDL_cond SDL_cond;
/*@}*/
/** Create a condition variable */
extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void);
/** Destroy a condition variable */
extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond);
/** Restart one of the threads that are waiting on the condition variable,
* @return 0 or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond);
/** Restart all threads that are waiting on the condition variable,
* @return 0 or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
/** Wait on the condition variable, unlocking the provided mutex.
* The mutex must be locked before entering this function!
* The mutex is re-locked once the condition variable is signaled.
* @return 0 when it is signaled, or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);
/** Waits for at most 'ms' milliseconds, and returns 0 if the condition
* variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
* signaled in the allotted time, and -1 on error.
* On some platforms this function is implemented by looping with a delay
* of 1 ms, and so should be avoided if possible.
*/
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);
/*@}*/
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_mutex_h */

View File

@ -1,11 +0,0 @@
#ifndef _SDLname_h_
#define _SDLname_h_
#if defined(__STDC__) || defined(__cplusplus)
#define NeedFunctionPrototypes 1
#endif
#define SDL_NAME(X) SDL_##X
#endif /* _SDLname_h_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,110 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_platform.h
* Try to get a standard set of platform defines
*/
#ifndef _SDL_platform_h
#define _SDL_platform_h
#if defined(_AIX)
#undef __AIX__
#define __AIX__ 1
#endif
#if defined(__BEOS__)
#undef __BEOS__
#define __BEOS__ 1
#endif
#if defined(__HAIKU__)
#undef __HAIKU__
#define __HAIKU__ 1
#endif
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
#undef __BSDI__
#define __BSDI__ 1
#endif
#if defined(_arch_dreamcast)
#undef __DREAMCAST__
#define __DREAMCAST__ 1
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#undef __FREEBSD__
#define __FREEBSD__ 1
#endif
#if defined(__HAIKU__)
#undef __HAIKU__
#define __HAIKU__ 1
#endif
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
#undef __HPUX__
#define __HPUX__ 1
#endif
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
#undef __IRIX__
#define __IRIX__ 1
#endif
#if defined(linux) || defined(__linux) || defined(__linux__)
#undef __LINUX__
#define __LINUX__ 1
#endif
#if defined(__APPLE__)
#undef __MACOSX__
#define __MACOSX__ 1
#elif defined(macintosh)
#undef __MACOS__
#define __MACOS__ 1
#endif
#if defined(__NetBSD__)
#undef __NETBSD__
#define __NETBSD__ 1
#endif
#if defined(__OpenBSD__)
#undef __OPENBSD__
#define __OPENBSD__ 1
#endif
#if defined(__OS2__)
#undef __OS2__
#define __OS2__ 1
#endif
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
#undef __OSF__
#define __OSF__ 1
#endif
#if defined(__QNXNTO__)
#undef __QNXNTO__
#define __QNXNTO__ 1
#endif
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
#undef __RISCOS__
#define __RISCOS__ 1
#endif
#if defined(__SVR4)
#undef __SOLARIS__
#define __SOLARIS__ 1
#endif
#if defined(WIN32) || defined(_WIN32)
#undef __WIN32__
#define __WIN32__ 1
#endif
#endif /* _SDL_platform_h */

View File

@ -1,55 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_quit.h
* Include file for SDL quit event handling
*/
#ifndef _SDL_quit_h
#define _SDL_quit_h
#include "SDL_stdinc.h"
#include "SDL_error.h"
/** @file SDL_quit.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.
*/
/** @file SDL_quit.h
* 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 */

View File

@ -1,155 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_rwops.h
* 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 'maxnum' objects each of size 'size' 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 {
#if defined(__WIN32__) && !defined(__SYMBIAN32__)
struct {
int append;
void *h;
struct {
void *data;
int size;
int left;
} buffer;
} 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;
/** @name 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);
/*@}*/
/** @name Seek Reference Points */
/*@{*/
#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 */
/*@}*/
/** @name 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)
/*@}*/
/** @name 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);
/*@}*/
/** @name 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 */

View File

@ -1,620 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_stdinc.h
* 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
#if defined(HAVE_ICONV) && defined(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)
/* Use proper C++ casts when compiled as C++ to be compatible with the option
-Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above. */
#ifdef __cplusplus
#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
#define SDL_static_cast(type, expression) static_cast<type>(expression)
#else
#define SDL_reinterpret_cast(type, expression) ((type)(expression))
#define SDL_static_cast(type, expression) ((type)(expression))
#endif
/** @name Basic data types */
/*@{*/
typedef enum {
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;
#ifndef SYMBIAN32_GCCE
typedef uint64_t Uint64;
#endif
#else
/* This is really just a hack to prevent the compiler from complaining */
typedef struct {
Uint32 hi;
Uint32 lo;
} Uint64, Sint64;
#endif
/*@}*/
/** @name 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);
/*@}*/
/** @name Enum Size Check
* 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;
#ifndef __NDS__
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
#endif
/*@}*/
#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(__BORLANDC__)
# include <malloc.h>
# elif defined(__DMC__)
# include <stdlib.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" (SDL_static_cast(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 = SDL_static_cast(Uint32 *, dst); \
Uint32 _val = (val); \
if (len == 0) break; \
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
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
#if defined(__MACH__) && defined(__APPLE__)
#define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
#elif 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" (SDL_static_cast(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
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
#if defined(__MACH__) && defined(__APPLE__)
#define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
#elif 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" (SDL_static_cast(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 = SDL_static_cast(char *, dst); \
char *srcp = SDL_static_cast(char *, src); \
int n = (len); \
if ( n >= 4 ) { \
__asm__ __volatile__ ( \
"std\n\t" \
"rep ; movsl\n\t" \
"cld\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
/** @name SDL_ICONV Error Codes
* 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
/*@}*/
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
#define SDL_iconv_t iconv_t
#define SDL_iconv_open iconv_open
#define SDL_iconv_close iconv_close
#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);
#endif
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
/** 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, const char *inbuf, size_t inbytesleft);
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "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 */

View File

@ -1,225 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_syswm.h
* 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
/** @file SDL_syswm.h
* 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,
* but not the gfxdisplay 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);
/*@}*/
/** @name Introduced in SDL 1.0.2 */
/*@{*/
Window fswindow; /**< The X11 fullscreen window */
Window wmwindow; /**< The X11 managed input window */
/*@}*/
/** @name Introduced in SDL 1.2.12 */
/*@{*/
Display *gfxdisplay; /**< The X11 display to which rendering is done */
/*@}*/
} 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:
* @code
* SDL_SysWMInfo info;
* SDL_VERSION(&info.version);
* if ( SDL_GetWMInfo(&info) ) { ... }
* @endcode
*/
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 */

View File

@ -1,120 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_thread_h
#define _SDL_thread_h
/** @file SDL_thread.h
* Header for the SDL thread management routines
*
* @note 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__)) && !defined(__SYMBIAN32__)
/**
* 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 (SDLCALL *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 */

View File

@ -1,125 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#ifndef _SDL_timer_h
#define _SDL_timer_h
/** @file SDL_timer.h
* Header for the SDL time management routines
*/
#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 OS scheduler timeslice, in milliseconds */
#define SDL_TIMESLICE 10
/** This is the maximum resolution of the SDL timer on all platforms */
#define TIMER_RESOLUTION 10 /**< Experimentally determined */
/**
* Get the number of milliseconds since the SDL library initialization.
* Note that this value wraps if the program runs for more than ~49 days.
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
/** Wait a specified number of milliseconds before returning */
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
/** Function prototype for the timer callback function */
typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval);
/**
* Set a callback to run after the specified number of milliseconds has
* elapsed. The callback function is passed the current timer interval
* and returns the next timer interval. If the returned value is the
* same as the one passed in, the periodic alarm continues, otherwise a
* new alarm is scheduled. If the callback returns 0, the periodic alarm
* is cancelled.
*
* To cancel a currently running timer, call SDL_SetTimer(0, NULL);
*
* The timer callback function may run in a different thread than your
* main code, and so shouldn't call any functions from within itself.
*
* The maximum resolution of this timer is 10 ms, which means that if
* you request a 16 ms timer, your callback will run approximately 20 ms
* later on an unloaded system. If you wanted to set a flag signaling
* a frame update at 30 frames per second (every 33 ms), you might set a
* timer for 30 ms:
* @code SDL_SetTimer((33/10)*10, flag_update); @endcode
*
* If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init().
*
* Under UNIX, you should not use raise or use SIGALRM and this function
* in the same program, as it is implemented using setitimer(). You also
* should not use this function in multi-threaded applications as signals
* to multi-threaded apps have undefined behavior in some implementations.
*
* This function returns 0 if successful, or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);
/** @name New timer API
* New timer API, supports multiple timers
* Written by Stephane Peter <megastep@lokigames.com>
*/
/*@{*/
/**
* Function prototype for the new timer callback function.
* The callback function is passed the current timer interval and returns
* the next timer interval. If the returned value is the same as the one
* passed in, the periodic alarm continues, otherwise a new alarm is
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
*/
typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param);
/** Definition of the timer ID type */
typedef struct _SDL_TimerID *SDL_TimerID;
/** Add a new timer to the pool of timers already running.
* Returns a timer ID, or NULL when an error occurs.
*/
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);
/**
* Remove one of the multiple timers knowing its ID.
* Returns a boolean value indicating success.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
/*@}*/
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_timer_h */

View File

@ -1,28 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_types.h
* @deprecated Use SDL_stdinc.h instead.
*/
/* DEPRECATED */
#include "SDL_stdinc.h"

View File

@ -1,91 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_version.h
* This header defines the current SDL version
*/
#ifndef _SDL_version_h
#define _SDL_version_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/** @name Version Number
* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
/*@{*/
#define SDL_MAJOR_VERSION 1
#define SDL_MINOR_VERSION 2
#define SDL_PATCHLEVEL 14
/*@}*/
typedef struct SDL_version {
Uint8 major;
Uint8 minor;
Uint8 patch;
} SDL_version;
/**
* This macro can be used to fill a version structure with the compile-time
* version of the SDL library.
*/
#define SDL_VERSION(X) \
{ \
(X)->major = SDL_MAJOR_VERSION; \
(X)->minor = SDL_MINOR_VERSION; \
(X)->patch = SDL_PATCHLEVEL; \
}
/** This macro turns the version numbers into a numeric value:
* (1,2,3) -> (1203)
* This assumes that there will never be more than 100 patchlevels
*/
#define SDL_VERSIONNUM(X, Y, Z) \
((X)*1000 + (Y)*100 + (Z))
/** This is the version number macro for the current SDL version */
#define SDL_COMPILEDVERSION \
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
/** This macro will evaluate to true if compiled with SDL at least X.Y.Z */
#define SDL_VERSION_ATLEAST(X, Y, Z) \
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
/** This function gets the version of the dynamically linked SDL library.
* it should NOT be used to fill a version structure, instead you should
* use the SDL_Version() macro.
*/
extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_version_h */

View File

@ -1,951 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
/** @file SDL_video.h
* Header file for access to the SDL raw framebuffer window
*/
#ifndef _SDL_video_h
#define _SDL_video_h
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_rwops.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/** @name Transparency definitions
* These define alpha as the opacity of a surface
*/
/*@{*/
#define SDL_ALPHA_OPAQUE 255
#define SDL_ALPHA_TRANSPARENT 0
/*@}*/
/** @name Useful data types */
/*@{*/
typedef struct SDL_Rect {
Sint16 x, y;
Uint16 w, h;
} SDL_Rect;
typedef struct SDL_Color {
Uint8 r;
Uint8 g;
Uint8 b;
Uint8 unused;
} SDL_Color;
#define SDL_Colour SDL_Color
typedef struct SDL_Palette {
int ncolors;
SDL_Color *colors;
} SDL_Palette;
/*@}*/
/** Everything in the pixel format structure is read-only */
typedef struct SDL_PixelFormat {
SDL_Palette *palette;
Uint8 BitsPerPixel;
Uint8 BytesPerPixel;
Uint8 Rloss;
Uint8 Gloss;
Uint8 Bloss;
Uint8 Aloss;
Uint8 Rshift;
Uint8 Gshift;
Uint8 Bshift;
Uint8 Ashift;
Uint32 Rmask;
Uint32 Gmask;
Uint32 Bmask;
Uint32 Amask;
/** RGB color key information */
Uint32 colorkey;
/** Alpha value information (per-surface alpha) */
Uint8 alpha;
} SDL_PixelFormat;
/** This structure should be treated as read-only, except for 'pixels',
* which, if not NULL, contains the raw pixel data for the surface.
*/
typedef struct SDL_Surface {
Uint32 flags; /**< Read-only */
SDL_PixelFormat *format; /**< Read-only */
int w, h; /**< Read-only */
Uint16 pitch; /**< Read-only */
void *pixels; /**< Read-write */
int offset; /**< Private */
/** Hardware-specific surface info */
struct private_hwdata *hwdata;
/** clipping information */
SDL_Rect clip_rect; /**< Read-only */
Uint32 unused1; /**< for binary compatibility */
/** Allow recursive locks */
Uint32 locked; /**< Private */
/** info for fast blit mapping to other surfaces */
struct SDL_BlitMap *map; /**< Private */
/** format version, bumped at every change to invalidate blit maps */
unsigned int format_version; /**< Private */
/** Reference count -- used when freeing surface */
int refcount; /**< Read-mostly */
} SDL_Surface;
/** @name SDL_Surface Flags
* These are the currently supported flags for the SDL_surface
*/
/*@{*/
/** Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */
/*@{*/
#define SDL_SWSURFACE 0x00000000 /**< Surface is in system memory */
#define SDL_HWSURFACE 0x00000001 /**< Surface is in video memory */
#define SDL_ASYNCBLIT 0x00000004 /**< Use asynchronous blits if possible */
/*@}*/
/** Available for SDL_SetVideoMode() */
/*@{*/
#define SDL_ANYFORMAT 0x10000000 /**< Allow any video depth/pixel-format */
#define SDL_HWPALETTE 0x20000000 /**< Surface has exclusive palette */
#define SDL_DOUBLEBUF 0x40000000 /**< Set up double-buffered video mode */
#define SDL_FULLSCREEN 0x80000000 /**< Surface is a full screen display */
#define SDL_OPENGL 0x00000002 /**< Create an OpenGL rendering context */
#define SDL_OPENGLBLIT 0x0000000A /**< Create an OpenGL rendering context and use it for blitting */
#define SDL_RESIZABLE 0x00000010 /**< This video mode may be resized */
#define SDL_NOFRAME 0x00000020 /**< No window caption or edge frame */
/*@}*/
/** Used internally (read-only) */
/*@{*/
#define SDL_HWACCEL 0x00000100 /**< Blit uses hardware acceleration */
#define SDL_SRCCOLORKEY 0x00001000 /**< Blit uses a source color key */
#define SDL_RLEACCELOK 0x00002000 /**< Private flag */
#define SDL_RLEACCEL 0x00004000 /**< Surface is RLE encoded */
#define SDL_SRCALPHA 0x00010000 /**< Blit uses source alpha blending */
#define SDL_PREALLOC 0x01000000 /**< Surface uses preallocated memory */
/*@}*/
/*@}*/
/** Evaluates to true if the surface needs to be locked before access */
#define SDL_MUSTLOCK(surface) \
(surface->offset || \
((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0))
/** typedef for private surface blitting functions */
typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect,
struct SDL_Surface *dst, SDL_Rect *dstrect);
/** Useful for determining the video hardware capabilities */
typedef struct SDL_VideoInfo {
Uint32 hw_available :1; /**< Flag: Can you create hardware surfaces? */
Uint32 wm_available :1; /**< Flag: Can you talk to a window manager? */
Uint32 UnusedBits1 :6;
Uint32 UnusedBits2 :1;
Uint32 blit_hw :1; /**< Flag: Accelerated blits HW --> HW */
Uint32 blit_hw_CC :1; /**< Flag: Accelerated blits with Colorkey */
Uint32 blit_hw_A :1; /**< Flag: Accelerated blits with Alpha */
Uint32 blit_sw :1; /**< Flag: Accelerated blits SW --> HW */
Uint32 blit_sw_CC :1; /**< Flag: Accelerated blits with Colorkey */
Uint32 blit_sw_A :1; /**< Flag: Accelerated blits with Alpha */
Uint32 blit_fill :1; /**< Flag: Accelerated color fill */
Uint32 UnusedBits3 :16;
Uint32 video_mem; /**< The total amount of video memory (in K) */
SDL_PixelFormat *vfmt; /**< Value: The format of the video surface */
int current_w; /**< Value: The current video mode width */
int current_h; /**< Value: The current video mode height */
} SDL_VideoInfo;
/** @name Overlay Formats
* The most common video overlay formats.
* For an explanation of these pixel formats, see:
* http://www.webartz.com/fourcc/indexyuv.htm
*
* For information on the relationship between color spaces, see:
* http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
*/
/*@{*/
#define SDL_YV12_OVERLAY 0x32315659 /**< Planar mode: Y + V + U (3 planes) */
#define SDL_IYUV_OVERLAY 0x56555949 /**< Planar mode: Y + U + V (3 planes) */
#define SDL_YUY2_OVERLAY 0x32595559 /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
#define SDL_UYVY_OVERLAY 0x59565955 /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
#define SDL_YVYU_OVERLAY 0x55595659 /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
/*@}*/
/** The YUV hardware video overlay */
typedef struct SDL_Overlay {
Uint32 format; /**< Read-only */
int w, h; /**< Read-only */
int planes; /**< Read-only */
Uint16 *pitches; /**< Read-only */
Uint8 **pixels; /**< Read-write */
/** @name Hardware-specific surface info */
/*@{*/
struct private_yuvhwfuncs *hwfuncs;
struct private_yuvhwdata *hwdata;
/*@{*/
/** @name Special flags */
/*@{*/
Uint32 hw_overlay :1; /**< Flag: This overlay hardware accelerated? */
Uint32 UnusedBits :31;
/*@}*/
} SDL_Overlay;
/** Public enumeration for setting the OpenGL window attributes. */
typedef enum {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL,
SDL_GL_SWAP_CONTROL
} SDL_GLattr;
/** @name flags for SDL_SetPalette() */
/*@{*/
#define SDL_LOGPAL 0x01
#define SDL_PHYSPAL 0x02
/*@}*/
/* Function prototypes */
/**
* @name Video Init and Quit
* These functions are used internally, and should not be used unless you
* have a specific need to specify the video driver you want to use.
* You should normally use SDL_Init() or SDL_InitSubSystem().
*/
/*@{*/
/**
* Initializes the video subsystem. Sets up a connection
* to the window manager, etc, and determines the current video mode and
* pixel format, but does not initialize a window or graphics mode.
* Note that event handling is activated by this routine.
*
* If you use both sound and video in your application, you need to call
* SDL_Init() before opening the sound device, otherwise under Win32 DirectX,
* you won't be able to set full-screen display modes.
*/
extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags);
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
/*@}*/
/**
* This function fills the given character buffer with the name of the
* video driver, and returns a pointer to it if the video driver has
* been initialized. It returns NULL if no driver has been initialized.
*/
extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
/**
* This function returns a pointer to the current display surface.
* If SDL is doing format conversion on the display surface, this
* function returns the publicly visible surface, not the real video
* surface.
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void);
/**
* This function returns a read-only pointer to information about the
* video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt'
* member of the returned structure will contain the pixel format of the
* "best" video mode.
*/
extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void);
/**
* Check to see if a particular video mode is supported.
* It returns 0 if the requested mode is not supported under any bit depth,
* or returns the bits-per-pixel of the closest available mode with the
* given width and height. If this bits-per-pixel is different from the
* one used when setting the video mode, SDL_SetVideoMode() will succeed,
* but will emulate the requested bits-per-pixel with a shadow surface.
*
* The arguments to SDL_VideoModeOK() are the same ones you would pass to
* SDL_SetVideoMode()
*/
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
/**
* Return a pointer to an array of available screen dimensions for the
* given format and video flags, sorted largest to smallest. Returns
* NULL if there are no dimensions available for a particular format,
* or (SDL_Rect **)-1 if any dimension is okay for the given format.
*
* If 'format' is NULL, the mode list will be for the format given
* by SDL_GetVideoInfo()->vfmt
*/
extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
/**
* Set up a video mode with the specified width, height and bits-per-pixel.
*
* If 'bpp' is 0, it is treated as the current display bits per pixel.
*
* If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the
* requested bits-per-pixel, but will return whatever video pixel format is
* available. The default is to emulate the requested pixel format if it
* is not natively available.
*
* If SDL_HWSURFACE is set in 'flags', the video surface will be placed in
* video memory, if possible, and you may have to call SDL_LockSurface()
* in order to access the raw framebuffer. Otherwise, the video surface
* will be created in system memory.
*
* If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle
* updates asynchronously, but you must always lock before accessing pixels.
* SDL will wait for updates to complete before returning from the lock.
*
* If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee
* that the colors set by SDL_SetColors() will be the colors you get.
* Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all
* of the colors exactly the way they are requested, and you should look
* at the video surface structure to determine the actual palette.
* If SDL cannot guarantee that the colors you request can be set,
* i.e. if the colormap is shared, then the video surface may be created
* under emulation in system memory, overriding the SDL_HWSURFACE flag.
*
* If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set
* a fullscreen video mode. The default is to create a windowed mode
* if the current graphics system has a window manager.
* If the SDL library is able to set a fullscreen video mode, this flag
* will be set in the surface that is returned.
*
* If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up
* two surfaces in video memory and swap between them when you call
* SDL_Flip(). This is usually slower than the normal single-buffering
* scheme, but prevents "tearing" artifacts caused by modifying video
* memory while the monitor is refreshing. It should only be used by
* applications that redraw the entire screen on every update.
*
* If SDL_RESIZABLE is set in 'flags', the SDL library will allow the
* window manager, if any, to resize the window at runtime. When this
* occurs, SDL will send a SDL_VIDEORESIZE event to you application,
* and you must respond to the event by re-calling SDL_SetVideoMode()
* with the requested size (or another size that suits the application).
*
* If SDL_NOFRAME is set in 'flags', the SDL library will create a window
* without any title bar or frame decoration. Fullscreen video modes have
* this flag set automatically.
*
* This function returns the video framebuffer surface, or NULL if it fails.
*
* If you rely on functionality provided by certain video flags, check the
* flags of the returned surface to make sure that functionality is available.
* SDL will fall back to reduced functionality if the exact flags you wanted
* are not available.
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode
(int width, int height, int bpp, Uint32 flags);
/** @name SDL_Update Functions
* These functions should not be called while 'screen' is locked.
*/
/*@{*/
/**
* Makes sure the given list of rectangles is updated on the given screen.
*/
extern DECLSPEC void SDLCALL SDL_UpdateRects
(SDL_Surface *screen, int numrects, SDL_Rect *rects);
/**
* If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
* screen.
*/
extern DECLSPEC void SDLCALL SDL_UpdateRect
(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
/*@}*/
/**
* On hardware that supports double-buffering, this function sets up a flip
* and returns. The hardware will wait for vertical retrace, and then swap
* video buffers before the next video surface blit or lock will return.
* On hardware that doesn not support double-buffering, this is equivalent
* to calling SDL_UpdateRect(screen, 0, 0, 0, 0);
* The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when
* setting the video mode for this function to perform hardware flipping.
* This function returns 0 if successful, or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen);
/**
* Set the gamma correction for each of the color channels.
* The gamma values range (approximately) between 0.1 and 10.0
*
* If this function isn't supported directly by the hardware, it will
* be emulated using gamma ramps, if available. If successful, this
* function returns 0, otherwise it returns -1.
*/
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
/**
* Set the gamma translation table for the red, green, and blue channels
* of the video hardware. Each table is an array of 256 16-bit quantities,
* representing a mapping between the input and output for that channel.
* The input is the index into the array, and the output is the 16-bit
* gamma value at that index, scaled to the output color precision.
*
* You may pass NULL for any of the channels to leave it unchanged.
* If the call succeeds, it will return 0. If the display driver or
* hardware does not support gamma translation, or otherwise fails,
* this function will return -1.
*/
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue);
/**
* Retrieve the current values of the gamma translation tables.
*
* You must pass in valid pointers to arrays of 256 16-bit quantities.
* Any of the pointers may be NULL to ignore that channel.
* If the call succeeds, it will return 0. If the display driver or
* hardware does not support gamma translation, or otherwise fails,
* this function will return -1.
*/
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue);
/**
* Sets a portion of the colormap for the given 8-bit surface. If 'surface'
* is not a palettized surface, this function does nothing, returning 0.
* If all of the colors were set as passed to SDL_SetColors(), it will
* return 1. If not all the color entries were set exactly as given,
* it will return 0, and you should look at the surface palette to
* determine the actual color palette.
*
* When 'surface' is the surface associated with the current display, the
* display colormap will be updated with the requested colors. If
* SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
* will always return 1, and the palette is guaranteed to be set the way
* you desire, even if the window colormap has to be warped or run under
* emulation.
*/
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface,
SDL_Color *colors, int firstcolor, int ncolors);
/**
* Sets a portion of the colormap for a given 8-bit surface.
* 'flags' is one or both of:
* SDL_LOGPAL -- set logical palette, which controls how blits are mapped
* to/from the surface,
* SDL_PHYSPAL -- set physical palette, which controls how pixels look on
* the screen
* Only screens have physical palettes. Separate change of physical/logical
* palettes is only possible if the screen has SDL_HWPALETTE set.
*
* The return value is 1 if all colours could be set as requested, and 0
* otherwise.
*
* SDL_SetColors() is equivalent to calling this function with
* flags = (SDL_LOGPAL|SDL_PHYSPAL).
*/
extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags,
SDL_Color *colors, int firstcolor,
int ncolors);
/**
* Maps an RGB triple to an opaque pixel value for a given pixel format
*/
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
(const SDL_PixelFormat * const format,
const Uint8 r, const Uint8 g, const Uint8 b);
/**
* Maps an RGBA quadruple to a pixel value for a given pixel format
*/
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA
(const SDL_PixelFormat * const format,
const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a);
/**
* Maps a pixel value into the RGB components for a given pixel format
*/
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
const SDL_PixelFormat * const fmt,
Uint8 *r, Uint8 *g, Uint8 *b);
/**
* Maps a pixel value into the RGBA components for a given pixel format
*/
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
const SDL_PixelFormat * const fmt,
Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
/** @sa SDL_CreateRGBSurface */
#define SDL_AllocSurface SDL_CreateRGBSurface
/**
* Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
* If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
* If the depth is greater than 8 bits, the pixel format is set using the
* flags '[RGB]mask'.
* If the function runs out of memory, it will return NULL.
*
* The 'flags' tell what kind of surface to create.
* SDL_SWSURFACE means that the surface should be created in system memory.
* SDL_HWSURFACE means that the surface should be created in video memory,
* with the same format as the display surface. This is useful for surfaces
* that will not change much, to take advantage of hardware acceleration
* when being blitted to the display surface.
* SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with
* this surface, but you must always lock it before accessing the pixels.
* SDL will wait for current blits to finish before returning from the lock.
* SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
* If the hardware supports acceleration of colorkey blits between
* two surfaces in video memory, SDL will try to place the surface in
* video memory. If this isn't possible or if there is no hardware
* acceleration available, the surface will be placed in system memory.
* SDL_SRCALPHA means that the surface will be used for alpha blits and
* if the hardware supports hardware acceleration of alpha blits between
* two surfaces in video memory, to place the surface in video memory
* if possible, otherwise it will be placed in system memory.
* If the surface is created in video memory, blits will be _much_ faster,
* but the surface format must be identical to the video surface format,
* and the only way to access the pixels member of the surface is to use
* the SDL_LockSurface() and SDL_UnlockSurface() calls.
* If the requested surface actually resides in video memory, SDL_HWSURFACE
* will be set in the flags member of the returned surface. If for some
* reason the surface could not be placed in video memory, it will not have
* the SDL_HWSURFACE flag set, and will be created in system memory instead.
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface
(Uint32 flags, int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
/** @sa SDL_CreateRGBSurface */
extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
int width, int height, int depth, int pitch,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface);
/**
* SDL_LockSurface() sets up a surface for directly accessing the pixels.
* Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
* to and read from 'surface->pixels', using the pixel format stored in
* 'surface->format'. Once you are done accessing the surface, you should
* use SDL_UnlockSurface() to release it.
*
* Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
* to 0, then you can read and write to the surface at any time, and the
* pixel format of the surface will not change. In particular, if the
* SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you
* will not need to lock the display surface before accessing it.
*
* No operating system or library calls should be made between lock/unlock
* pairs, as critical system locks may be held during this time.
*
* SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
*/
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
/**
* Load a surface from a seekable SDL data source (memory or file.)
* If 'freesrc' is non-zero, the source will be closed after being read.
* Returns the new surface, or NULL if there was an error.
* The new surface should be freed with SDL_FreeSurface().
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc);
/** Convenience macro -- load a surface from a file */
#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
/**
* Save a surface to a seekable SDL data source (memory or file.)
* If 'freedst' is non-zero, the source will be closed after being written.
* Returns 0 if successful or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
(SDL_Surface *surface, SDL_RWops *dst, int freedst);
/** Convenience macro -- save a surface to a file */
#define SDL_SaveBMP(surface, file) \
SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
/**
* Sets the color key (transparent pixel) in a blittable surface.
* If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL),
* 'key' will be the transparent pixel in the source image of a blit.
* SDL_RLEACCEL requests RLE acceleration for the surface if present,
* and removes RLE acceleration if absent.
* If 'flag' is 0, this function clears any current color key.
* This function returns 0, or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_SetColorKey
(SDL_Surface *surface, Uint32 flag, Uint32 key);
/**
* This function sets the alpha value for the entire surface, as opposed to
* using the alpha component of each pixel. This value measures the range
* of transparency of the surface, 0 being completely transparent to 255
* being completely opaque. An 'alpha' value of 255 causes blits to be
* opaque, the source pixels copied to the destination (the default). Note
* that per-surface alpha can be combined with colorkey transparency.
*
* If 'flag' is 0, alpha blending is disabled for the surface.
* If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
* OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
* surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
*
* The 'alpha' parameter is ignored for surfaces that have an alpha channel.
*/
extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
/**
* Sets the clipping rectangle for the destination surface in a blit.
*
* If the clip rectangle is NULL, clipping will be disabled.
* If the clip rectangle doesn't intersect the surface, the function will
* return SDL_FALSE and blits will be completely clipped. Otherwise the
* function returns SDL_TRUE and blits to the surface will be clipped to
* the intersection of the surface area and the clipping rectangle.
*
* Note that blits are automatically clipped to the edges of the source
* and destination surfaces.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect);
/**
* Gets the clipping rectangle for the destination surface in a blit.
* 'rect' must be a pointer to a valid rectangle which will be filled
* with the correct values.
*/
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);
/**
* Creates a new surface of the specified format, and then copies and maps
* the given surface to it so the blit of the converted surface will be as
* fast as possible. If this function fails, it returns NULL.
*
* The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those
* semantics. You can also pass SDL_RLEACCEL in the flags parameter and
* SDL will try to RLE accelerate colorkey and alpha blits in the resulting
* surface.
*
* This function is used internally by SDL_DisplayFormat().
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface
(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);
/**
* This performs a fast blit from the source surface to the destination
* surface. It assumes that the source and destination rectangles are
* the same size. If either 'srcrect' or 'dstrect' are NULL, the entire
* surface (src or dst) is copied. The final blit rectangles are saved
* in 'srcrect' and 'dstrect' after all clipping is performed.
* If the blit is successful, it returns 0, otherwise it returns -1.
*
* The blit function should not be called on a locked surface.
*
* The blit semantics for surfaces with and without alpha and colorkey
* are defined as follows:
*
* RGBA->RGB:
* SDL_SRCALPHA set:
* alpha-blend (using alpha-channel).
* SDL_SRCCOLORKEY ignored.
* SDL_SRCALPHA not set:
* copy RGB.
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* RGB values of the source colour key, ignoring alpha in the
* comparison.
*
* RGB->RGBA:
* SDL_SRCALPHA set:
* alpha-blend (using the source per-surface alpha value);
* set destination alpha to opaque.
* SDL_SRCALPHA not set:
* copy RGB, set destination alpha to source per-surface alpha value.
* both:
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* source colour key.
*
* RGBA->RGBA:
* SDL_SRCALPHA set:
* alpha-blend (using the source alpha channel) the RGB values;
* leave destination alpha untouched. [Note: is this correct?]
* SDL_SRCCOLORKEY ignored.
* SDL_SRCALPHA not set:
* copy all of RGBA to the destination.
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* RGB values of the source colour key, ignoring alpha in the
* comparison.
*
* RGB->RGB:
* SDL_SRCALPHA set:
* alpha-blend (using the source per-surface alpha value).
* SDL_SRCALPHA not set:
* copy RGB.
* both:
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* source colour key.
*
* If either of the surfaces were in video memory, and the blit returns -2,
* the video memory was lost, so it should be reloaded with artwork and
* re-blitted:
* @code
* while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
* while ( SDL_LockSurface(image) < 0 )
* Sleep(10);
* -- Write image pixels to image->pixels --
* SDL_UnlockSurface(image);
* }
* @endcode
*
* This happens under DirectX 5.0 when the system switches away from your
* fullscreen application. The lock will also fail until you have access
* to the video memory again.
*
* You should call SDL_BlitSurface() unless you know exactly how SDL
* blitting works internally and how to use the other blit functions.
*/
#define SDL_BlitSurface SDL_UpperBlit
/** This is the public blit function, SDL_BlitSurface(), and it performs
* rectangle validation and clipping before passing it to SDL_LowerBlit()
*/
extern DECLSPEC int SDLCALL SDL_UpperBlit
(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
/** This is a semi-private blit function and it performs low-level surface
* blitting only.
*/
extern DECLSPEC int SDLCALL SDL_LowerBlit
(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
/**
* This function performs a fast fill of the given rectangle with 'color'
* The given rectangle is clipped to the destination surface clip area
* and the final fill rectangle is saved in the passed in pointer.
* If 'dstrect' is NULL, the whole surface will be filled with 'color'
* The color should be a pixel of the format used by the surface, and
* can be generated by the SDL_MapRGB() function.
* This function returns 0 on success, or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_FillRect
(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
/**
* This function takes a surface and copies it to a new surface of the
* pixel format and colors of the video framebuffer, suitable for fast
* blitting onto the display surface. It calls SDL_ConvertSurface()
*
* If you want to take advantage of hardware colorkey or alpha blit
* acceleration, you should set the colorkey and alpha value before
* calling this function.
*
* If the conversion fails or runs out of memory, it returns NULL
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface);
/**
* This function takes a surface and copies it to a new surface of the
* pixel format and colors of the video framebuffer (if possible),
* suitable for fast alpha blitting onto the display surface.
* The new surface will always have an alpha channel.
*
* If you want to take advantage of hardware colorkey or alpha blit
* acceleration, you should set the colorkey and alpha value before
* calling this function.
*
* If the conversion fails or runs out of memory, it returns NULL
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** @name YUV video surface overlay functions */ /*@{*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** This function creates a video output overlay
* Calling the returned surface an overlay is something of a misnomer because
* the contents of the display surface underneath the area where the overlay
* is shown is undefined - it may be overwritten with the converted YUV data.
*/
extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height,
Uint32 format, SDL_Surface *display);
/** Lock an overlay for direct access, and unlock it when you are done */
extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay);
extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay);
/** Blit a video overlay to the display surface.
* The contents of the video surface underneath the blit destination are
* not defined.
* The width and height of the destination rectangle may be different from
* that of the overlay, but currently only 2x scaling is supported.
*/
extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);
/** Free a video overlay */
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay);
/*@}*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** @name OpenGL support functions. */ /*@{*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Dynamically load an OpenGL library, or the default one if path is NULL
*
* If you do this, you need to retrieve all of the GL functions used in
* your program from the dynamic library using SDL_GL_GetProcAddress().
*/
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
/**
* Get the address of a GL function
*/
extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc);
/**
* Set an attribute of the OpenGL subsystem before intialization.
*/
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
/**
* Get an attribute of the OpenGL subsystem from the windowing
* interface, such as glX. This is of course different from getting
* the values from SDL's internal OpenGL subsystem, which only
* stores the values you request before initialization.
*
* Developers should track the values they pass into SDL_GL_SetAttribute
* themselves if they want to retrieve these values.
*/
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value);
/**
* Swap the OpenGL buffers, if double-buffering is supported.
*/
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
/** @name OpenGL Internal Functions
* Internal functions that should not be called unless you have read
* and understood the source code for these functions.
*/
/*@{*/
extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects);
extern DECLSPEC void SDLCALL SDL_GL_Lock(void);
extern DECLSPEC void SDLCALL SDL_GL_Unlock(void);
/*@}*/
/*@}*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** @name Window Manager Functions */
/** These functions allow interaction with the window manager, if any. */ /*@{*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Sets the title and icon text of the display window (UTF-8 encoded)
*/
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon);
/**
* Gets the title and icon text of the display window (UTF-8 encoded)
*/
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
/**
* Sets the icon for the display window.
* This function must be called before the first call to SDL_SetVideoMode().
* It takes an icon surface, and a mask in MSB format.
* If 'mask' is NULL, the entire icon surface will be used as the icon.
*/
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
/**
* This function iconifies the window, and returns 1 if it succeeded.
* If the function succeeds, it generates an SDL_APPACTIVE loss event.
* This function is a noop and returns 0 in non-windowed environments.
*/
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
/**
* Toggle fullscreen mode without changing the contents of the screen.
* If the display surface does not require locking before accessing
* the pixel information, then the memory pointers will not change.
*
* If this function was able to toggle fullscreen mode (change from
* running in a window to fullscreen, or vice-versa), it will return 1.
* If it is not implemented, or fails, it returns 0.
*
* The next call to SDL_SetVideoMode() will set the mode fullscreen
* attribute based on the flags parameter - if SDL_FULLSCREEN is not
* set, then the display will be windowed by default where supported.
*
* This is currently only implemented in the X11 video driver.
*/
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface);
typedef enum {
SDL_GRAB_QUERY = -1,
SDL_GRAB_OFF = 0,
SDL_GRAB_ON = 1,
SDL_GRAB_FULLSCREEN /**< Used internally */
} SDL_GrabMode;
/**
* This function allows you to set and query the input grab state of
* the application. It returns the new input grab state.
*
* Grabbing means that the mouse is confined to the application window,
* and nearly all keyboard input is passed directly to the application,
* and not interpreted by a window manager, if any.
*/
extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
/*@}*/
/** @internal Not in public API at the moment - do not use! */
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_video_h */

View File

@ -1,191 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
/**
* @file begin_code.h
* This file sets things up for C dynamic library function definitions,
* static inlined functions, and structures aligned at 4-byte alignment.
* If you don't like ugly C preprocessor code, don't look at this file. :)
*/
/**
* @file begin_code.h
* This shouldn't be nested -- included it around code only.
*/
#ifdef _begin_code_h
#error Nested inclusion of begin_code.h
#endif
#define _begin_code_h
/**
* @def DECLSPEC
* Some compilers use a special export keyword
*/
#ifndef DECLSPEC
# if defined(__BEOS__) || defined(__HAIKU__)
# if defined(__GNUC__)
# define DECLSPEC __declspec(dllexport)
# else
# define DECLSPEC __declspec(export)
# endif
# elif defined(__WIN32__)
# ifdef __BORLANDC__
# ifdef BUILD_SDL
# define DECLSPEC
# else
# define DECLSPEC __declspec(dllimport)
# endif
# else
# define DECLSPEC __declspec(dllexport)
# endif
# elif defined(__OS2__)
# ifdef __WATCOMC__
# ifdef BUILD_SDL
# define DECLSPEC __declspec(dllexport)
# else
# define DECLSPEC
# endif
# elif defined (__GNUC__) && __GNUC__ < 4
# /* Added support for GCC-EMX <v4.x */
# /* this is needed for XFree86/OS2 developement */
# /* F. Ambacher(anakor@snafu.de) 05.2008 */
# ifdef BUILD_SDL
# define DECLSPEC __declspec(dllexport)
# else
# define DECLSPEC
# endif
# else
# define DECLSPEC
# endif
# else
# if defined(__GNUC__) && __GNUC__ >= 4
# define DECLSPEC __attribute__ ((visibility("default")))
# else
# define DECLSPEC
# endif
# endif
#endif
/**
* @def SDLCALL
* By default SDL uses the C calling convention
*/
#ifndef SDLCALL
# if defined(__WIN32__) && !defined(__GNUC__)
# define SDLCALL __cdecl
# elif defined(__OS2__)
# if defined (__GNUC__) && __GNUC__ < 4
# /* Added support for GCC-EMX <v4.x */
# /* this is needed for XFree86/OS2 developement */
# /* F. Ambacher(anakor@snafu.de) 05.2008 */
# define SDLCALL _cdecl
# else
# /* On other compilers on OS/2, we use the _System calling convention */
# /* to be compatible with every compiler */
# define SDLCALL _System
# endif
# else
# define SDLCALL
# endif
#endif /* SDLCALL */
#ifdef __SYMBIAN32__
#ifndef EKA2
#undef DECLSPEC
#define DECLSPEC
#elif !defined(__WINS__)
#undef DECLSPEC
#define DECLSPEC __declspec(dllexport)
#endif /* !EKA2 */
#endif /* __SYMBIAN32__ */
/**
* @file begin_code.h
* Force structure packing at 4 byte alignment.
* This is necessary if the header is included in code which has structure
* packing set to an alternate value, say for loading structures from disk.
* The packing is reset to the previous value in close_code.h
*/
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#pragma pack(push,4)
#elif (defined(__MWERKS__) && defined(__MACOS__))
#pragma options align=mac68k4byte
#pragma enumsalwaysint on
#endif /* Compiler needs structure packing set */
/**
* @def SDL_INLINE_OKAY
* Set up compiler-specific options for inlining functions
*/
#ifndef SDL_INLINE_OKAY
#ifdef __GNUC__
#define SDL_INLINE_OKAY
#else
/* Add any special compiler-specific cases here */
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \
defined(__WATCOMC__) || defined(__LCC__) || \
defined(__DECC) || defined(__EABI__)
#ifndef __inline__
#define __inline__ __inline
#endif
#define SDL_INLINE_OKAY
#else
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
#ifndef __inline__
#define __inline__ inline
#endif
#define SDL_INLINE_OKAY
#endif /* Not a funky compiler */
#endif /* Visual C++ */
#endif /* GNU C */
#endif /* SDL_INLINE_OKAY */
/**
* @def __inline__
* If inlining isn't supported, remove "__inline__", turning static
* inlined functions into static functions (resulting in code bloat
* in all files which include the offending header files)
*/
#ifndef SDL_INLINE_OKAY
#define __inline__
#endif
/**
* @def NULL
* Apparently this is needed by several Windows compilers
*/
#if !defined(__MACH__)
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif /* NULL */
#endif /* ! Mac OS X - breaks precompiled headers */

View File

@ -1,46 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
/**
* @file close_code.h
* This file reverses the effects of begin_code.h and should be included
* after you finish any function and structure declarations in your headers
*/
#undef _begin_code_h
/**
* @file close_code.h
* Reset structure packing at previous byte alignment
*/
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#if (defined(__MWERKS__) && defined(__MACOS__))
#pragma options align=reset
#pragma enumsalwaysint reset
#else
#pragma pack(pop)
#endif
#endif /* Compiler needs structure packing set */

View File

@ -1,946 +0,0 @@
# Doxyfile 1.2.16
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
# All text after a hash (#) is considered a comment and will be ignored
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (" ")
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
PROJECT_NAME = SDL
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 1.2.14
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = docs
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Brazilian, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Korean,
# Norwegian, Polish, Portuguese, Romanian, Russian, Slovak, Slovene,
# Spanish, Swedish and Ukrainian.
OUTPUT_LANGUAGE = English
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = NO
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
EXTRACT_LOCAL_CLASSES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these class will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
# Set to NO to disable this.
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
# the brief description of a member or function before the detailed description.
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
REPEAT_BRIEF = YES
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# Doxygen will generate a detailed section even if there is only a brief
# description.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
# members of a class in the documentation of that class as if those members were
# ordinary class members. Constructors, destructors and assignment operators of
# the base classes will not be shown.
INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = NO
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user defined part of the path. Stripping is
# only done if one of the specified strings matches the left-hand part of
# the path. It is allowed to use relative paths in the argument list.
STRIP_FROM_PATH =
# The INTERNAL_DOCS tag determines if documentation
# that is typed after a \internal command is included. If the tag is set
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = YES
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower case letters. If set to YES upper case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# users are adviced to set this option to NO.
CASE_SENSE_NAMES = YES
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
# (but less readable) file names. This can be useful is your file systems
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = NO
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = NO
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = YES
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
# comments will behave just like the Qt-style comments (thus requiring an
# explict @brief command for a brief description.
JAVADOC_AUTOBRIEF = NO
# If the DETAILS_AT_TOP tag is set to YES then Doxygen
# will output the detailed description near the top, like JavaDoc.
# If set to NO, the detailed description appears after the member
# documentation.
DETAILS_AT_TOP = NO
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# reimplements.
INHERIT_DOCS = YES
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
# will sort the (detailed) documentation of file and class members
# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
DISTRIBUTE_GROUP_DOC = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 4
# The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo
# commands in the documentation.
GENERATE_TODOLIST = YES
# The GENERATE_TESTLIST tag can be used to enable (YES) or
# disable (NO) the test list. This list is created by putting \test
# commands in the documentation.
GENERATE_TESTLIST = YES
# The GENERATE_BUGLIST tag can be used to enable (YES) or
# disable (NO) the bug list. This list is created by putting \bug
# commands in the documentation.
GENERATE_BUGLIST = YES
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
ALIASES =
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
# the initial value of a variable or define consist of for it to appear in
# the documentation. If the initializer consists of more lines than specified
# here it will be hidden. Use a value of 0 to hide initializers completely.
# The appearance of the initializer of individual variables and defines in the
# documentation can be controlled using \showinitializer or \hideinitializer
# command in the documentation regardless of this setting.
MAX_INITIALIZER_LINES = 30
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C.
# For instance some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = YES
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
# only. Doxygen will then generate output that is more tailored for Java.
# For instance namespaces will be presented as packages, qualified scopes
# will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
# at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
QUIET = NO
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
# NO is used.
WARNINGS = YES
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
# automatically be disabled.
WARN_IF_UNDOCUMENTED = YES
# The WARN_FORMAT tag determines the format of the warning messages that
# doxygen can produce. The string should contain the $file, $line, and $text
# tags, which will be replaced by the file and line number from which the
# warning originated and the warning text.
WARN_FORMAT = "$file:$line: $text"
# The WARN_LOGFILE tag can be used to specify a file to which warning
# and error messages should be written. If left blank the output is written
# to stderr.
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
# The INPUT tag can be used to specify the files and/or directories that contain
# documented source files. You may enter file names like "myfile.cpp" or
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = include
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
# *.h++ *.idl *.odl
FILE_PATTERNS = *.h
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
RECURSIVE = NO
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
# that are symbolic links (a Unix filesystem feature) are excluded from the input.
EXCLUDE_SYMLINKS = NO
# If the value of the INPUT tag contains directories, you can use the
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
# certain files from those directories.
EXCLUDE_PATTERNS =
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
EXAMPLE_PATH =
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.
EXAMPLE_PATTERNS =
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude
# commands irrespective of the value of the RECURSIVE tag.
# Possible values are YES and NO. If left blank NO is used.
EXAMPLE_RECURSIVE = NO
# The IMAGE_PATH tag can be used to specify one or more files or
# directories that contain image that are included in the documentation (see
# the \image command).
IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# by executing (via popen()) the command <filter> <input-file>, where <filter>
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
# input file. Doxygen will then use the output that the filter program writes
# to standard output.
INPUT_FILTER =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
# files to browse.
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources.
SOURCE_BROWSER = NO
# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
INLINE_SOURCES = NO
# If the REFERENCED_BY_RELATION tag is set to YES (the default)
# then for each documented function all documented
# functions referencing it will be listed.
REFERENCED_BY_RELATION = YES
# If the REFERENCES_RELATION tag is set to YES (the default)
# then for each documented function all documented entities
# called/used by that function will be listed.
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
ALPHABETICAL_INDEX = NO
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all
# classes will be put under the same header in the alphabetical index.
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
HTML_OUTPUT = html
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
# doxygen will generate files with .html extension.
HTML_FILE_EXTENSION = .html
# The HTML_HEADER tag can be used to specify a personal HTML header for
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet
HTML_STYLESHEET =
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
GENERATE_CHI = NO
# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
# controls whether a binary table of contents is generated (YES) or a
# normal table of contents (NO) in the .chm file.
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members
# to the contents of the Html help documentation and to the tree view.
TOC_EXPAND = NO
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
# top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it.
DISABLE_INDEX = NO
# This tag can be used to set the number of enum values (range [1..20])
# that doxygen will group on one line in the generated HTML documentation.
ENUM_VALUES_PER_LINE = 4
# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
# generated containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
# or Internet explorer 4.0+). Note that for large projects the tree generation
# can take a very long time. In such cases it is better to disable this feature.
# Windows users are probably better off using the HTML help feature.
GENERATE_TREEVIEW = NO
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `latex' will be used as the default path.
LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
# generate index for LaTeX. If left blank `makeindex' will be used as the
# default command name.
MAKEINDEX_CMD_NAME = makeindex
# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
# LaTeX documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_LATEX = NO
# The PAPER_TYPE tag can be used to set the paper type that is used
# by the printer. Possible values are: a4, a4wide, letter, legal and
# executive. If left blank a4wide will be used.
PAPER_TYPE = a4wide
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
# the generated latex document. The header should contain everything until
# the first chapter. If it is left blank doxygen will generate a
# standard header. Notice: only use this tag if you know what you are doing!
LATEX_HEADER =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
# contain links (just like the HTML output) instead of page references
# This makes the output suitable for online browsing using a pdf viewer.
PDF_HYPERLINKS = NO
# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
# plain latex in the generated Makefile. Set this option to YES to get a
# higher quality PDF documentation.
USE_PDFLATEX = NO
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
# command to the generated LaTeX files. This will instruct LaTeX to keep
# running if errors occur, instead of asking the user for help.
# This option is also used when generating formulas in HTML.
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
# The RTF output is optimised for Word 97 and may not look very pretty with
# other RTF readers or editors.
GENERATE_RTF = YES
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `rtf' will be used as the default path.
RTF_OUTPUT = rtf
# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
# RTF documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_RTF = NO
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
# will contain hyperlink fields. The RTF file will
# contain links (just like the HTML output) instead of page references.
# This makes the output suitable for online browsing using WORD or other
# programs which support those fields.
# Note: wordpad (write) and others do not support links.
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's
# config file, i.e. a series of assigments. You only have to provide
# replacements, missing definitions are set to their default value.
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
GENERATE_MAN = YES
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `man' will be used as the default path.
MAN_OUTPUT = man
# The MAN_EXTENSION tag determines the extension that is added to
# the generated man pages (default is the subroutine's section .3)
MAN_EXTENSION = .3
# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
# then it will generate one additional man file for each entity
# documented in the real man page(s). These additional files
# only source the real man page, but without them the man command
# would be unable to find the correct page. The default is NO.
MAN_LINKS = YES
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
# If the GENERATE_XML tag is set to YES Doxygen will
# generate an XML file that captures the structure of
# the code including all documentation. Note that this
# feature is still experimental and incomplete at the
# moment.
GENERATE_XML = NO
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
# generate an AutoGen Definitions (see autogen.sf.net) file
# that captures the structure of the code including all
# documentation. Note that this feature is still experimental
# and incomplete at the moment.
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
# evaluate all C-preprocessor directives found in the sources and include
# files.
ENABLE_PREPROCESSING = YES
# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
# names in the source code. If set to NO (the default) only conditional
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_PREDEFINED tags.
EXPAND_ONLY_PREDEF = YES
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by
# the preprocessor.
INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
# directories. If left blank, the patterns specified with FILE_PATTERNS will
# be used.
INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that
# are defined before the preprocessor is started (similar to the -D option of
# gcc). The argument of the tag is a list of macros of the form: name
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed.
PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 SDLCALL= SNDDECLSPEC=
# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
# on a line and do not end with a semicolon. Such function macros are typically
# used for boiler-plate code, and will confuse the parser if not removed.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
# The TAGFILES tag can be used to specify one or more tagfiles.
TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
# in the class index. If set to NO only the inherited external classes
# will be listed.
ALLEXTERNALS = NO
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
# in the modules index. If set to NO, only the current project's groups will
# be listed.
EXTERNAL_GROUPS = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
# super classes. Setting the tag to NO turns the diagrams off. Note that this
# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
# recommended to install and use dot, since it yields more powerful graphs.
CLASS_DIAGRAMS = NO
# If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented
# or is not a class.
HIDE_UNDOC_RELATIONS = YES
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz, a graph visualization
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = NO
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the
# the CLASS_DIAGRAMS tag to NO.
CLASS_GRAPH = NO
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect implementation dependencies (inheritance, containment, and
# class references variables) of the class with other documented classes.
COLLABORATION_GRAPH = NO
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = NO
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
# tags are set to YES then doxygen will generate a graph for each documented
# file showing the direct and indirect include dependencies of the file with
# other documented files.
INCLUDE_GRAPH = NO
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
# documented header file showing the documented files that directly or
# indirectly include this file.
INCLUDED_BY_GRAPH = YES
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will graphical hierarchy of all classes instead of a textual one.
GRAPHICAL_HIERARCHY = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. Possible values are png, jpg, or gif
# If left blank png will be used.
DOT_IMAGE_FORMAT = png
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found on the path.
DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the
# \dotfile command).
DOTFILE_DIRS =
# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
# this value, doxygen will try to truncate the graph, so that it fits within
# the specified constraint. Beware that most browsers cannot cope with very
# large images.
MAX_DOT_GRAPH_WIDTH = 1024
# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
# this value, doxygen will try to truncate the graph, so that it fits within
# the specified constraint. Beware that most browsers cannot cope with very
# large images.
MAX_DOT_GRAPH_HEIGHT = 1024
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
# remove the intermedate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
# The SEARCHENGINE tag specifies whether or not a search engine should be
# used. If set to NO the values of all tags below this one will be ignored.
SEARCHENGINE = NO
# The CGI_NAME tag should be the name of the CGI script that
# starts the search engine (doxysearch) with the correct parameters.
# A script with this name will be generated by doxygen.
CGI_NAME = search.cgi
# The CGI_URL tag should be the absolute URL to the directory where the
# cgi binaries are located. See the documentation of your http daemon for
# details.
CGI_URL =
# The DOC_URL tag should be the absolute URL to the directory where the
# documentation is located. If left blank the absolute path to the
# documentation, with file:// prepended to it, will be used.
DOC_URL =
# The DOC_ABSPATH tag should be the absolute path to the directory where the
# documentation is located. If left blank the directory on the local machine
# will be used.
DOC_ABSPATH =
# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
# is installed.
BIN_ABSPATH = /usr/local/bin/
# The EXT_DOC_PATHS tag can be used to specify one or more paths to
# documentation generated for other projects. This allows doxysearch to search
# the documentation for these projects as well.
EXT_DOC_PATHS =

View File

@ -1,350 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#include "SDL_config.h"
/* Initialization code for SDL */
#include "SDL.h"
#include "SDL_fatal.h"
#if !SDL_VIDEO_DISABLED
#include "video/SDL_leaks.h"
#endif
#if SDL_THREAD_PTH
#include <pth.h>
#endif
/* Initialization/Cleanup routines */
#if !SDL_JOYSTICK_DISABLED
extern int SDL_JoystickInit(void);
extern void SDL_JoystickQuit(void);
#endif
#if !SDL_CDROM_DISABLED
extern int SDL_CDROMInit(void);
extern void SDL_CDROMQuit(void);
#endif
#if !SDL_TIMERS_DISABLED
extern void SDL_StartTicks(void);
extern int SDL_TimerInit(void);
extern void SDL_TimerQuit(void);
#endif
/* The current SDL version */
static SDL_version version =
{ SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL };
/* The initialized subsystems */
static Uint32 SDL_initialized = 0;
#if !SDL_TIMERS_DISABLED
static Uint32 ticks_started = 0;
#endif
#ifdef CHECK_LEAKS
int surfaces_allocated = 0;
#endif
int SDL_InitSubSystem(Uint32 flags)
{
#if !SDL_VIDEO_DISABLED
/* Initialize the video/event subsystem */
if ( (flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO) ) {
if ( SDL_VideoInit(SDL_getenv("SDL_VIDEODRIVER"),
(flags&SDL_INIT_EVENTTHREAD)) < 0 ) {
return(-1);
}
SDL_initialized |= SDL_INIT_VIDEO;
}
#else
if ( flags & SDL_INIT_VIDEO ) {
SDL_SetError("SDL not built with video support");
return(-1);
}
#endif
#if !SDL_AUDIO_DISABLED
/* Initialize the audio subsystem */
if ( (flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO) ) {
if ( SDL_AudioInit(SDL_getenv("SDL_AUDIODRIVER")) < 0 ) {
return(-1);
}
SDL_initialized |= SDL_INIT_AUDIO;
}
#else
if ( flags & SDL_INIT_AUDIO ) {
SDL_SetError("SDL not built with audio support");
return(-1);
}
#endif
#if !SDL_TIMERS_DISABLED
/* Initialize the timer subsystem */
if ( ! ticks_started ) {
SDL_StartTicks();
ticks_started = 1;
}
if ( (flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER) ) {
if ( SDL_TimerInit() < 0 ) {
return(-1);
}
SDL_initialized |= SDL_INIT_TIMER;
}
#else
if ( flags & SDL_INIT_TIMER ) {
SDL_SetError("SDL not built with timer support");
return(-1);
}
#endif
#if !SDL_JOYSTICK_DISABLED
/* Initialize the joystick subsystem */
if ( (flags & SDL_INIT_JOYSTICK) &&
!(SDL_initialized & SDL_INIT_JOYSTICK) ) {
if ( SDL_JoystickInit() < 0 ) {
return(-1);
}
SDL_initialized |= SDL_INIT_JOYSTICK;
}
#else
if ( flags & SDL_INIT_JOYSTICK ) {
SDL_SetError("SDL not built with joystick support");
return(-1);
}
#endif
#if !SDL_CDROM_DISABLED
/* Initialize the CD-ROM subsystem */
if ( (flags & SDL_INIT_CDROM) && !(SDL_initialized & SDL_INIT_CDROM) ) {
if ( SDL_CDROMInit() < 0 ) {
return(-1);
}
SDL_initialized |= SDL_INIT_CDROM;
}
#else
if ( flags & SDL_INIT_CDROM ) {
SDL_SetError("SDL not built with cdrom support");
return(-1);
}
#endif
return(0);
}
int SDL_Init(Uint32 flags)
{
#if !SDL_THREADS_DISABLED && SDL_THREAD_PTH
if (!pth_init()) {
return -1;
}
#endif
/* Clear the error message */
SDL_ClearError();
/* Initialize the desired subsystems */
if ( SDL_InitSubSystem(flags) < 0 ) {
return(-1);
}
/* Everything is initialized */
if ( !(flags & SDL_INIT_NOPARACHUTE) ) {
SDL_InstallParachute();
}
return(0);
}
void SDL_QuitSubSystem(Uint32 flags)
{
/* Shut down requested initialized subsystems */
#if !SDL_CDROM_DISABLED
if ( (flags & SDL_initialized & SDL_INIT_CDROM) ) {
SDL_CDROMQuit();
SDL_initialized &= ~SDL_INIT_CDROM;
}
#endif
#if !SDL_JOYSTICK_DISABLED
if ( (flags & SDL_initialized & SDL_INIT_JOYSTICK) ) {
SDL_JoystickQuit();
SDL_initialized &= ~SDL_INIT_JOYSTICK;
}
#endif
#if !SDL_TIMERS_DISABLED
if ( (flags & SDL_initialized & SDL_INIT_TIMER) ) {
SDL_TimerQuit();
SDL_initialized &= ~SDL_INIT_TIMER;
}
#endif
#if !SDL_AUDIO_DISABLED
if ( (flags & SDL_initialized & SDL_INIT_AUDIO) ) {
SDL_AudioQuit();
SDL_initialized &= ~SDL_INIT_AUDIO;
}
#endif
#if !SDL_VIDEO_DISABLED
if ( (flags & SDL_initialized & SDL_INIT_VIDEO) ) {
SDL_VideoQuit();
SDL_initialized &= ~SDL_INIT_VIDEO;
}
#endif
}
Uint32 SDL_WasInit(Uint32 flags)
{
if ( ! flags ) {
flags = SDL_INIT_EVERYTHING;
}
return (SDL_initialized&flags);
}
void SDL_Quit(void)
{
/* Quit all subsystems */
#ifdef DEBUG_BUILD
printf("[SDL_Quit] : Enter! Calling QuitSubSystem()\n"); fflush(stdout);
#endif
SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
#ifdef CHECK_LEAKS
#ifdef DEBUG_BUILD
printf("[SDL_Quit] : CHECK_LEAKS\n"); fflush(stdout);
#endif
/* Print the number of surfaces not freed */
if ( surfaces_allocated != 0 ) {
fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n",
surfaces_allocated);
}
#endif
#ifdef DEBUG_BUILD
printf("[SDL_Quit] : SDL_UninstallParachute()\n"); fflush(stdout);
#endif
/* Uninstall any parachute signal handlers */
SDL_UninstallParachute();
#if !SDL_THREADS_DISABLED && SDL_THREAD_PTH
pth_kill();
#endif
#ifdef DEBUG_BUILD
printf("[SDL_Quit] : Returning!\n"); fflush(stdout);
#endif
}
/* Return the library version number */
const SDL_version * SDL_Linked_Version(void)
{
return(&version);
}
#if defined(__OS2__)
/* Building for OS/2 */
#ifdef __WATCOMC__
#define INCL_DOSERRORS
#define INCL_DOSEXCEPTIONS
#include <os2.h>
/* Exception handler to prevent the Audio thread hanging, making a zombie process! */
ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec,
PEXCEPTIONREGISTRATIONRECORD pERegRec,
PCONTEXTRECORD pCtxRec,
PVOID p)
{
if (pERepRec->fHandlerFlags & EH_EXIT_UNWIND)
return XCPT_CONTINUE_SEARCH;
if (pERepRec->fHandlerFlags & EH_UNWINDING)
return XCPT_CONTINUE_SEARCH;
if (pERepRec->fHandlerFlags & EH_NESTED_CALL)
return XCPT_CONTINUE_SEARCH;
/* Do cleanup at every fatal exception! */
if (((pERepRec->ExceptionNum & XCPT_SEVERITY_CODE) == XCPT_FATAL_EXCEPTION) &&
(pERepRec->ExceptionNum != XCPT_BREAKPOINT) &&
(pERepRec->ExceptionNum != XCPT_SINGLE_STEP)
)
{
if (SDL_initialized & SDL_INIT_AUDIO)
{
/* This removes the zombie audio thread in case of emergency. */
#ifdef DEBUG_BUILD
printf("[SDL_Main_ExceptionHandler] : Calling SDL_CloseAudio()!\n");
#endif
SDL_CloseAudio();
}
}
return (XCPT_CONTINUE_SEARCH);
}
EXCEPTIONREGISTRATIONRECORD SDL_Main_xcpthand = {0, SDL_Main_ExceptionHandler};
/* The main DLL entry for DLL Initialization and Uninitialization: */
unsigned _System LibMain(unsigned hmod, unsigned termination)
{
if (termination)
{
#ifdef DEBUG_BUILD
/* printf("[SDL DLL Unintialization] : Removing exception handler\n"); */
#endif
DosUnsetExceptionHandler(&SDL_Main_xcpthand);
return 1;
} else
{
#ifdef DEBUG_BUILD
/* Make stdout and stderr unbuffered! */
setbuf(stdout, NULL);
setbuf(stderr, NULL);
#endif
/* Fire up exception handler */
#ifdef DEBUG_BUILD
/* printf("[SDL DLL Initialization] : Setting exception handler\n"); */
#endif
/* Set exception handler */
DosSetExceptionHandler(&SDL_Main_xcpthand);
return 1;
}
}
#endif /* __WATCOMC__ */
#elif defined(__WIN32__) && !defined(__SYMBIAN32__)
#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL))
/* Need to include DllMain() on Watcom C for some reason.. */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
BOOL APIENTRY _DllMainCRTStartup( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif /* building DLL with Watcom C */
#endif /* OS/2 elif __WIN32__ */

View File

@ -1,238 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#include "SDL_config.h"
/* Simple error handling in SDL */
#include "SDL_error.h"
#include "SDL_error_c.h"
/* Routine to get the thread-specific error variable */
#if SDL_THREADS_DISABLED
/* The SDL_arraysize(The ),default (non-thread-safe) global error variable */
static SDL_error SDL_global_error;
#define SDL_GetErrBuf() (&SDL_global_error)
#else
extern SDL_error *SDL_GetErrBuf(void);
#endif /* SDL_THREADS_DISABLED */
#define SDL_ERRBUFIZE 1024
/* Private functions */
static const char *SDL_LookupString(const char *key)
{
/* FIXME: Add code to lookup key in language string hash-table */
return key;
}
/* Public functions */
void SDL_SetError (const char *fmt, ...)
{
va_list ap;
SDL_error *error;
/* Copy in the key, mark error as valid */
error = SDL_GetErrBuf();
error->error = 1;
SDL_strlcpy((char *)error->key, fmt, sizeof(error->key));
va_start(ap, fmt);
error->argc = 0;
while ( *fmt ) {
if ( *fmt++ == '%' ) {
while ( *fmt == '.' || (*fmt >= '0' && *fmt <= '9') ) {
++fmt;
}
switch (*fmt++) {
case 0: /* Malformed format string.. */
--fmt;
break;
case 'c':
case 'i':
case 'd':
case 'u':
case 'o':
case 'x':
case 'X':
error->args[error->argc++].value_i =
va_arg(ap, int);
break;
case 'f':
error->args[error->argc++].value_f =
va_arg(ap, double);
break;
case 'p':
error->args[error->argc++].value_ptr =
va_arg(ap, void *);
break;
case 's':
{
int i = error->argc;
const char *str = va_arg(ap, const char *);
if (str == NULL)
str = "(null)";
SDL_strlcpy((char *)error->args[i].buf, str, ERR_MAX_STRLEN);
error->argc++;
}
break;
default:
break;
}
if ( error->argc >= ERR_MAX_ARGS ) {
break;
}
}
}
va_end(ap);
/* If we are in debug mode, print out an error message */
#ifdef DEBUG_ERROR
fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
#endif
}
/* This function has a bit more overhead than most error functions
so that it supports internationalization and thread-safe errors.
*/
char *SDL_GetErrorMsg(char *errstr, unsigned int maxlen)
{
SDL_error *error;
/* Clear the error string */
*errstr = '\0'; --maxlen;
/* Get the thread-safe error, and print it out */
error = SDL_GetErrBuf();
if ( error->error ) {
const char *fmt;
char *msg = errstr;
int len;
int argi;
fmt = SDL_LookupString(error->key);
argi = 0;
while ( *fmt && (maxlen > 0) ) {
if ( *fmt == '%' ) {
char tmp[32], *spot = tmp;
*spot++ = *fmt++;
while ( (*fmt == '.' || (*fmt >= '0' && *fmt <= '9')) && spot < (tmp+SDL_arraysize(tmp)-2) ) {
*spot++ = *fmt++;
}
*spot++ = *fmt++;
*spot++ = '\0';
switch (spot[-2]) {
case '%':
*msg++ = '%';
maxlen -= 1;
break;
case 'c':
case 'i':
case 'd':
case 'u':
case 'o':
case 'x':
case 'X':
len = SDL_snprintf(msg, maxlen, tmp, error->args[argi++].value_i);
msg += len;
maxlen -= len;
break;
case 'f':
len = SDL_snprintf(msg, maxlen, tmp, error->args[argi++].value_f);
msg += len;
maxlen -= len;
break;
case 'p':
len = SDL_snprintf(msg, maxlen, tmp, error->args[argi++].value_ptr);
msg += len;
maxlen -= len;
break;
case 's':
len = SDL_snprintf(msg, maxlen, tmp, SDL_LookupString(error->args[argi++].buf));
msg += len;
maxlen -= len;
break;
}
} else {
*msg++ = *fmt++;
maxlen -= 1;
}
}
*msg = 0; /* NULL terminate the string */
}
return(errstr);
}
/* Available for backwards compatibility */
char *SDL_GetError (void)
{
static char errmsg[SDL_ERRBUFIZE];
return((char *)SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE));
}
void SDL_ClearError(void)
{
SDL_error *error;
error = SDL_GetErrBuf();
error->error = 0;
}
/* Very common errors go here */
void SDL_Error(SDL_errorcode code)
{
switch (code) {
case SDL_ENOMEM:
SDL_SetError("Out of memory");
break;
case SDL_EFREAD:
SDL_SetError("Error reading from datastream");
break;
case SDL_EFWRITE:
SDL_SetError("Error writing to datastream");
break;
case SDL_EFSEEK:
SDL_SetError("Error seeking in datastream");
break;
default:
SDL_SetError("Unknown SDL error");
break;
}
}
#ifdef TEST_ERROR
int main(int argc, char *argv[])
{
char buffer[BUFSIZ+1];
SDL_SetError("Hi there!");
printf("Error 1: %s\n", SDL_GetError());
SDL_ClearError();
SDL_memset(buffer, '1', BUFSIZ);
buffer[BUFSIZ] = 0;
SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
printf("Error 2: %s\n", SDL_GetError());
exit(0);
}
#endif

View File

@ -1,58 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#include "SDL_config.h"
/* This file defines a structure that carries language-independent
error messages
*/
#ifndef _SDL_error_c_h
#define _SDL_error_c_h
#define ERR_MAX_STRLEN 128
#define ERR_MAX_ARGS 5
typedef struct SDL_error {
/* This is a numeric value corresponding to the current error */
int error;
/* This is a key used to index into a language hashtable containing
internationalized versions of the SDL error messages. If the key
is not in the hashtable, or no hashtable is available, the key is
used directly as an error message format string.
*/
char key[ERR_MAX_STRLEN];
/* These are the arguments for the error functions */
int argc;
union {
void *value_ptr;
#if 0 /* What is a character anyway? (UNICODE issues) */
unsigned char value_c;
#endif
int value_i;
double value_f;
char buf[ERR_MAX_STRLEN];
} args[ERR_MAX_ARGS];
} SDL_error;
#endif /* _SDL_error_c_h */

View File

@ -1,134 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#include "SDL_config.h"
/* General fatal signal handling code for SDL */
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#include "SDL.h"
#include "SDL_fatal.h"
/* This installs some signal handlers for the more common fatal signals,
so that if the programmer is lazy, the app doesn't die so horribly if
the program crashes.
*/
static void SDL_Parachute(int sig)
{
signal(sig, SIG_DFL);
SDL_Quit();
raise(sig);
}
static int SDL_fatal_signals[] = {
SIGSEGV,
#ifdef SIGBUS
SIGBUS,
#endif
#ifdef SIGFPE
SIGFPE,
#endif
#ifdef SIGQUIT
SIGQUIT,
#endif
0
};
void SDL_InstallParachute(void)
{
/* Set a handler for any fatal signal not already handled */
int i;
#ifdef HAVE_SIGACTION
struct sigaction action;
for ( i=0; SDL_fatal_signals[i]; ++i ) {
sigaction(SDL_fatal_signals[i], NULL, &action);
if ( action.sa_handler == SIG_DFL ) {
action.sa_handler = SDL_Parachute;
sigaction(SDL_fatal_signals[i], &action, NULL);
}
}
#ifdef SIGALRM
/* Set SIGALRM to be ignored -- necessary on Solaris */
sigaction(SIGALRM, NULL, &action);
if ( action.sa_handler == SIG_DFL ) {
action.sa_handler = SIG_IGN;
sigaction(SIGALRM, &action, NULL);
}
#endif
#else
void (*ohandler)(int);
for ( i=0; SDL_fatal_signals[i]; ++i ) {
ohandler = signal(SDL_fatal_signals[i], SDL_Parachute);
if ( ohandler != SIG_DFL ) {
signal(SDL_fatal_signals[i], ohandler);
}
}
#endif /* HAVE_SIGACTION */
return;
}
void SDL_UninstallParachute(void)
{
/* Remove a handler for any fatal signal handled */
int i;
#ifdef HAVE_SIGACTION
struct sigaction action;
for ( i=0; SDL_fatal_signals[i]; ++i ) {
sigaction(SDL_fatal_signals[i], NULL, &action);
if ( action.sa_handler == SDL_Parachute ) {
action.sa_handler = SIG_DFL;
sigaction(SDL_fatal_signals[i], &action, NULL);
}
}
#else
void (*ohandler)(int);
for ( i=0; SDL_fatal_signals[i]; ++i ) {
ohandler = signal(SDL_fatal_signals[i], SIG_DFL);
if ( ohandler != SDL_Parachute ) {
signal(SDL_fatal_signals[i], ohandler);
}
}
#endif /* HAVE_SIGACTION */
}
#else
/* No signals on this platform, nothing to do.. */
void SDL_InstallParachute(void)
{
return;
}
void SDL_UninstallParachute(void)
{
return;
}
#endif /* HAVE_SIGNAL_H */

View File

@ -1,28 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#include "SDL_config.h"
/* General fatal signal handling code for SDL */
extern void SDL_InstallParachute(void);
extern void SDL_UninstallParachute(void);

View File

@ -1,576 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#include "SDL_config.h"
/* This is the joystick API for Simple DirectMedia Layer */
#include "SDL_events.h"
#include "SDL_sysjoystick.h"
#include "SDL_joystick_c.h"
#if !SDL_EVENTS_DISABLED
#include "../events/SDL_events_c.h"
#endif
/* This is used for Quake III Arena */
#if SDL_EVENTS_DISABLED
#define SDL_Lock_EventThread()
#define SDL_Unlock_EventThread()
#endif
Uint8 SDL_numjoysticks = 0;
SDL_Joystick **SDL_joysticks = NULL;
static SDL_Joystick *default_joystick = NULL;
int SDL_JoystickInit(void)
{
int arraylen;
int status;
SDL_numjoysticks = 0;
status = SDL_SYS_JoystickInit();
if ( status >= 0 ) {
arraylen = (status+1)*sizeof(*SDL_joysticks);
SDL_joysticks = (SDL_Joystick **)SDL_malloc(arraylen);
if ( SDL_joysticks == NULL ) {
SDL_numjoysticks = 0;
} else {
SDL_memset(SDL_joysticks, 0, arraylen);
SDL_numjoysticks = status;
}
status = 0;
}
default_joystick = NULL;
return(status);
}
/*
* Count the number of joysticks attached to the system
*/
int SDL_NumJoysticks(void)
{
return SDL_numjoysticks;
}
/*
* Get the implementation dependent name of a joystick
*/
const char *SDL_JoystickName(int device_index)
{
if ( (device_index < 0) || (device_index >= SDL_numjoysticks) ) {
SDL_SetError("There are %d joysticks available",
SDL_numjoysticks);
return(NULL);
}
return(SDL_SYS_JoystickName(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.
*/
SDL_Joystick *SDL_JoystickOpen(int device_index)
{
int i;
SDL_Joystick *joystick;
if ( (device_index < 0) || (device_index >= SDL_numjoysticks) ) {
SDL_SetError("There are %d joysticks available",
SDL_numjoysticks);
return(NULL);
}
/* If the joystick is already open, return it */
for ( i=0; SDL_joysticks[i]; ++i ) {
if ( device_index == SDL_joysticks[i]->index ) {
joystick = SDL_joysticks[i];
++joystick->ref_count;
return(joystick);
}
}
/* Create and initialize the joystick */
joystick = (SDL_Joystick *)SDL_malloc((sizeof *joystick));
if ( !joystick ) {
return(NULL);
}
SDL_memset(joystick, 0, (sizeof *joystick));
joystick->index = device_index;
if ( SDL_SYS_JoystickOpen(joystick) < 0 ) {
SDL_free(joystick);
return(NULL);
}
if ( joystick->naxes > 0 ) {
joystick->axes = (Sint16 *)SDL_malloc
(joystick->naxes*sizeof(Sint16));
}
if ( joystick->nhats > 0 ) {
joystick->hats = (Uint8 *)SDL_malloc
(joystick->nhats*sizeof(Uint8));
}
if ( joystick->nballs > 0 ) {
joystick->balls = (struct balldelta *)SDL_malloc
(joystick->nballs*sizeof(*joystick->balls));
}
if ( joystick->nbuttons > 0 ) {
joystick->buttons = (Uint8 *)SDL_malloc
(joystick->nbuttons*sizeof(Uint8));
}
if ( ((joystick->naxes > 0) && !joystick->axes)
|| ((joystick->nhats > 0) && !joystick->hats)
|| ((joystick->nballs > 0) && !joystick->balls)
|| ((joystick->nbuttons > 0) && !joystick->buttons)) {
SDL_OutOfMemory();
SDL_JoystickClose(joystick);
return(NULL);
}
if ( joystick->axes ) {
SDL_memset(joystick->axes, 0,
joystick->naxes*sizeof(Sint16));
}
if ( joystick->hats ) {
SDL_memset(joystick->hats, 0,
joystick->nhats*sizeof(Uint8));
}
if ( joystick->balls ) {
SDL_memset(joystick->balls, 0,
joystick->nballs*sizeof(*joystick->balls));
}
if ( joystick->buttons ) {
SDL_memset(joystick->buttons, 0,
joystick->nbuttons*sizeof(Uint8));
}
/* Add joystick to list */
++joystick->ref_count;
SDL_Lock_EventThread();
for ( i=0; SDL_joysticks[i]; ++i )
/* Skip to next joystick */ ;
SDL_joysticks[i] = joystick;
SDL_Unlock_EventThread();
return(joystick);
}
/*
* Returns 1 if the joystick has been opened, or 0 if it has not.
*/
int SDL_JoystickOpened(int device_index)
{
int i, opened;
opened = 0;
for ( i=0; SDL_joysticks[i]; ++i ) {
if ( SDL_joysticks[i]->index == (Uint8)device_index ) {
opened = 1;
break;
}
}
return(opened);
}
static int ValidJoystick(SDL_Joystick **joystick)
{
int valid;
if ( *joystick == NULL ) {
*joystick = default_joystick;
}
if ( *joystick == NULL ) {
SDL_SetError("Joystick hasn't been opened yet");
valid = 0;
} else {
valid = 1;
}
return valid;
}
/*
* Get the device index of an opened joystick.
*/
int SDL_JoystickIndex(SDL_Joystick *joystick)
{
if ( ! ValidJoystick(&joystick) ) {
return(-1);
}
return(joystick->index);
}
/*
* Get the number of multi-dimensional axis controls on a joystick
*/
int SDL_JoystickNumAxes(SDL_Joystick *joystick)
{
if ( ! ValidJoystick(&joystick) ) {
return(-1);
}
return(joystick->naxes);
}
/*
* Get the number of hats on a joystick
*/
int SDL_JoystickNumHats(SDL_Joystick *joystick)
{
if ( ! ValidJoystick(&joystick) ) {
return(-1);
}
return(joystick->nhats);
}
/*
* Get the number of trackballs on a joystick
*/
int SDL_JoystickNumBalls(SDL_Joystick *joystick)
{
if ( ! ValidJoystick(&joystick) ) {
return(-1);
}
return(joystick->nballs);
}
/*
* Get the number of buttons on a joystick
*/
int SDL_JoystickNumButtons(SDL_Joystick *joystick)
{
if ( ! ValidJoystick(&joystick) ) {
return(-1);
}
return(joystick->nbuttons);
}
/*
* Get the current state of an axis control on a joystick
*/
Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis)
{
Sint16 state;
if ( ! ValidJoystick(&joystick) ) {
return(0);
}
if ( axis < joystick->naxes ) {
state = joystick->axes[axis];
} else {
SDL_SetError("Joystick only has %d axes", joystick->naxes);
state = 0;
}
return(state);
}
/*
* Get the current state of a hat on a joystick
*/
Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat)
{
Uint8 state;
if ( ! ValidJoystick(&joystick) ) {
return(0);
}
if ( hat < joystick->nhats ) {
state = joystick->hats[hat];
} else {
SDL_SetError("Joystick only has %d hats", joystick->nhats);
state = 0;
}
return(state);
}
/*
* Get the ball axis change since the last poll
*/
int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy)
{
int retval;
if ( ! ValidJoystick(&joystick) ) {
return(-1);
}
retval = 0;
if ( ball < joystick->nballs ) {
if ( dx ) {
*dx = joystick->balls[ball].dx;
}
if ( dy ) {
*dy = joystick->balls[ball].dy;
}
joystick->balls[ball].dx = 0;
joystick->balls[ball].dy = 0;
} else {
SDL_SetError("Joystick only has %d balls", joystick->nballs);
retval = -1;
}
return(retval);
}
/*
* Get the current state of a button on a joystick
*/
Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button)
{
Uint8 state;
if ( ! ValidJoystick(&joystick) ) {
return(0);
}
if ( button < joystick->nbuttons ) {
state = joystick->buttons[button];
} else {
SDL_SetError("Joystick only has %d buttons",joystick->nbuttons);
state = 0;
}
return(state);
}
/*
* Close a joystick previously opened with SDL_JoystickOpen()
*/
void SDL_JoystickClose(SDL_Joystick *joystick)
{
int i;
if ( ! ValidJoystick(&joystick) ) {
return;
}
/* First decrement ref count */
if ( --joystick->ref_count > 0 ) {
return;
}
/* Lock the event queue - prevent joystick polling */
SDL_Lock_EventThread();
if ( joystick == default_joystick ) {
default_joystick = NULL;
}
SDL_SYS_JoystickClose(joystick);
/* Remove joystick from list */
for ( i=0; SDL_joysticks[i]; ++i ) {
if ( joystick == SDL_joysticks[i] ) {
SDL_memmove(&SDL_joysticks[i], &SDL_joysticks[i+1],
(SDL_numjoysticks-i)*sizeof(joystick));
break;
}
}
/* Let the event thread keep running */
SDL_Unlock_EventThread();
/* Free the data associated with this joystick */
if ( joystick->axes ) {
SDL_free(joystick->axes);
}
if ( joystick->hats ) {
SDL_free(joystick->hats);
}
if ( joystick->balls ) {
SDL_free(joystick->balls);
}
if ( joystick->buttons ) {
SDL_free(joystick->buttons);
}
SDL_free(joystick);
}
void SDL_JoystickQuit(void)
{
/* Stop the event polling */
SDL_Lock_EventThread();
SDL_numjoysticks = 0;
SDL_Unlock_EventThread();
/* Quit the joystick setup */
SDL_SYS_JoystickQuit();
if ( SDL_joysticks ) {
SDL_free(SDL_joysticks);
SDL_joysticks = NULL;
}
}
/* These are global for SDL_sysjoystick.c and SDL_events.c */
int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value)
{
int posted;
/* Update internal joystick state */
joystick->axes[axis] = value;
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if ( SDL_ProcessEvents[SDL_JOYAXISMOTION] == SDL_ENABLE ) {
SDL_Event event;
event.type = SDL_JOYAXISMOTION;
event.jaxis.which = joystick->index;
event.jaxis.axis = axis;
event.jaxis.value = value;
if ( (SDL_EventOK == NULL) || (*SDL_EventOK)(&event) ) {
posted = 1;
SDL_PushEvent(&event);
}
}
#endif /* !SDL_EVENTS_DISABLED */
return(posted);
}
int SDL_PrivateJoystickHat(SDL_Joystick *joystick, Uint8 hat, Uint8 value)
{
int posted;
/* Update internal joystick state */
joystick->hats[hat] = value;
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if ( SDL_ProcessEvents[SDL_JOYHATMOTION] == SDL_ENABLE ) {
SDL_Event event;
event.jhat.type = SDL_JOYHATMOTION;
event.jhat.which = joystick->index;
event.jhat.hat = hat;
event.jhat.value = value;
if ( (SDL_EventOK == NULL) || (*SDL_EventOK)(&event) ) {
posted = 1;
SDL_PushEvent(&event);
}
}
#endif /* !SDL_EVENTS_DISABLED */
return(posted);
}
int SDL_PrivateJoystickBall(SDL_Joystick *joystick, Uint8 ball,
Sint16 xrel, Sint16 yrel)
{
int posted;
/* Update internal mouse state */
joystick->balls[ball].dx += xrel;
joystick->balls[ball].dy += yrel;
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if ( SDL_ProcessEvents[SDL_JOYBALLMOTION] == SDL_ENABLE ) {
SDL_Event event;
event.jball.type = SDL_JOYBALLMOTION;
event.jball.which = joystick->index;
event.jball.ball = ball;
event.jball.xrel = xrel;
event.jball.yrel = yrel;
if ( (SDL_EventOK == NULL) || (*SDL_EventOK)(&event) ) {
posted = 1;
SDL_PushEvent(&event);
}
}
#endif /* !SDL_EVENTS_DISABLED */
return(posted);
}
int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state)
{
int posted;
#if !SDL_EVENTS_DISABLED
SDL_Event event;
switch ( state ) {
case SDL_PRESSED:
event.type = SDL_JOYBUTTONDOWN;
break;
case SDL_RELEASED:
event.type = SDL_JOYBUTTONUP;
break;
default:
/* Invalid state -- bail */
return(0);
}
#endif /* !SDL_EVENTS_DISABLED */
/* Update internal joystick state */
joystick->buttons[button] = state;
/* Post the event, if desired */
posted = 0;
#if !SDL_EVENTS_DISABLED
if ( SDL_ProcessEvents[event.type] == SDL_ENABLE ) {
event.jbutton.which = joystick->index;
event.jbutton.button = button;
event.jbutton.state = state;
if ( (SDL_EventOK == NULL) || (*SDL_EventOK)(&event) ) {
posted = 1;
SDL_PushEvent(&event);
}
}
#endif /* !SDL_EVENTS_DISABLED */
return(posted);
}
void SDL_JoystickUpdate(void)
{
int i;
for ( i=0; SDL_joysticks[i]; ++i ) {
SDL_SYS_JoystickUpdate(SDL_joysticks[i]);
}
}
int SDL_JoystickEventState(int state)
{
#if SDL_EVENTS_DISABLED
return SDL_IGNORE;
#else
const Uint8 event_list[] = {
SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION,
SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP,
};
unsigned int i;
switch (state) {
case SDL_QUERY:
state = SDL_IGNORE;
for ( i=0; i<SDL_arraysize(event_list); ++i ) {
state = SDL_EventState(event_list[i],SDL_QUERY);
if ( state == SDL_ENABLE ) {
break;
}
}
break;
default:
for ( i=0; i<SDL_arraysize(event_list); ++i ) {
SDL_EventState(event_list[i], state);
}
break;
}
return(state);
#endif /* SDL_EVENTS_DISABLED */
}

View File

@ -1,38 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#include "SDL_config.h"
/* Useful functions and variables from SDL_joystick.c */
#include "SDL_joystick.h"
/* The number of available joysticks on the system */
extern Uint8 SDL_numjoysticks;
/* Internal event queueing functions */
extern int SDL_PrivateJoystickAxis(SDL_Joystick *joystick,
Uint8 axis, Sint16 value);
extern int SDL_PrivateJoystickBall(SDL_Joystick *joystick,
Uint8 ball, Sint16 xrel, Sint16 yrel);
extern int SDL_PrivateJoystickHat(SDL_Joystick *joystick,
Uint8 hat, Uint8 value);
extern int SDL_PrivateJoystickButton(SDL_Joystick *joystick,
Uint8 button, Uint8 state);

View File

@ -1,82 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is SDL_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
slouken@libsdl.org
*/
#include "SDL_config.h"
/* This is the system specific header for the SDL joystick API */
#include "SDL_joystick.h"
/* The SDL joystick structure */
struct _SDL_Joystick {
Uint8 index; /* Device index */
const char *name; /* Joystick name - system dependent */
int naxes; /* Number of axis controls on the joystick */
Sint16 *axes; /* Current axis states */
int nhats; /* Number of hats on the joystick */
Uint8 *hats; /* Current hat states */
int nballs; /* Number of trackballs on the joystick */
struct balldelta {
int dx;
int dy;
} *balls; /* Current ball motion deltas */
int nbuttons; /* Number of buttons on the joystick */
Uint8 *buttons; /* Current button states */
struct joystick_hwdata *hwdata; /* Driver dependent information */
int ref_count; /* Reference count for multiple opens */
};
/* Function to scan the system for joysticks.
* Joystick 0 should be the system default joystick.
* This function should return the number of available joysticks, or -1
* on an unrecoverable fatal error.
*/
extern int SDL_SYS_JoystickInit(void);
/* Function to get the device-dependent name of a joystick */
extern const char *SDL_SYS_JoystickName(int index);
/* Function to open a joystick for use.
The joystick to open is specified by the index field of the joystick.
This should fill the nbuttons and naxes fields of the joystick structure.
It returns 0, or -1 if there is an error.
*/
extern int SDL_SYS_JoystickOpen(SDL_Joystick *joystick);
/* Function to update the state of a joystick - called as a device poll.
* This function shouldn't update the joystick structure directly,
* but instead should call SDL_PrivateJoystick*() to deliver events
* and update joystick device state.
*/
extern void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick);
/* Function to close a joystick after use */
extern void SDL_SYS_JoystickClose(SDL_Joystick *joystick);
/* Function to perform any system-specific joystick related cleanup */
extern void SDL_SYS_JoystickQuit(void);

View File

@ -1,606 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifdef SDL_JOYSTICK_USBHID
/*
* Joystick driver for the uhid(4) interface found in OpenBSD,
* NetBSD and FreeBSD.
*
* Maintainer: <vedge at csoft.org>
*/
#include <sys/param.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#ifndef __FreeBSD_kernel_version
#define __FreeBSD_kernel_version __FreeBSD_version
#endif
#if defined(HAVE_USB_H)
#include <usb.h>
#endif
#ifdef __DragonFly__
#include <bus/usb/usb.h>
#include <bus/usb/usbhid.h>
#else
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
#endif
#if defined(HAVE_USBHID_H)
#include <usbhid.h>
#elif defined(HAVE_LIBUSB_H)
#include <libusb.h>
#elif defined(HAVE_LIBUSBHID_H)
#include <libusbhid.h>
#endif
#ifdef __FREEBSD__
#ifndef __DragonFly__
#include <osreldate.h>
#endif
#include <sys/joystick.h>
#endif
#if SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
#include <machine/joystick.h>
#endif
#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
#define MAX_UHID_JOYS 4
#define MAX_JOY_JOYS 2
#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
struct usb_ctl_report {
int ucr_report;
u_char ucr_data[1024]; /* filled data size will vary */
};
#endif
struct report {
struct usb_ctl_report *buf; /* Buffer */
ssize_t size; /* Buffer size */
int rid; /* Report ID */
enum {
SREPORT_UNINIT,
SREPORT_CLEAN,
SREPORT_DIRTY
} status;
};
static struct {
int uhid_report;
hid_kind_t kind;
const char *name;
} const repinfo[] = {
{ UHID_INPUT_REPORT, hid_input, "input" },
{ UHID_OUTPUT_REPORT, hid_output, "output" },
{ UHID_FEATURE_REPORT, hid_feature, "feature" }
};
enum {
REPORT_INPUT = 0,
REPORT_OUTPUT = 1,
REPORT_FEATURE = 2
};
enum {
JOYAXE_X,
JOYAXE_Y,
JOYAXE_Z,
JOYAXE_SLIDER,
JOYAXE_WHEEL,
JOYAXE_RX,
JOYAXE_RY,
JOYAXE_RZ,
JOYAXE_count
};
struct joystick_hwdata {
int fd;
char *path;
enum {
BSDJOY_UHID, /* uhid(4) */
BSDJOY_JOY /* joy(4) */
} type;
struct report_desc *repdesc;
struct report inreport;
int axis_map[JOYAXE_count]; /* map present JOYAXE_* to 0,1,..*/
int x;
int y;
int xmin;
int ymin;
int xmax;
int ymax;
};
static char *joynames[MAX_JOYS];
static char *joydevnames[MAX_JOYS];
static int report_alloc(struct report *, struct report_desc *, int);
static void report_free(struct report *);
#if defined(USBHID_UCR_DATA) || (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
#else
#define REP_BUF_DATA(rep) ((rep)->buf->data)
#endif
int
SDL_SYS_JoystickInit(void)
{
char s[16];
int i, fd;
SDL_numjoysticks = 0;
SDL_memset(joynames, 0, sizeof(joynames));
SDL_memset(joydevnames, 0, sizeof(joydevnames));
for (i = 0; i < MAX_UHID_JOYS; i++) {
SDL_Joystick nj;
SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i);
nj.index = SDL_numjoysticks;
joynames[nj.index] = strdup(s);
if (SDL_SYS_JoystickOpen(&nj) == 0) {
SDL_SYS_JoystickClose(&nj);
SDL_numjoysticks++;
} else {
SDL_free(joynames[nj.index]);
joynames[nj.index] = NULL;
}
}
for (i = 0; i < MAX_JOY_JOYS; i++) {
SDL_snprintf(s, SDL_arraysize(s), "/dev/joy%d", i);
fd = open(s, O_RDONLY);
if (fd != -1) {
joynames[SDL_numjoysticks++] = strdup(s);
close(fd);
}
}
/* Read the default USB HID usage table. */
hid_init(NULL);
return (SDL_numjoysticks);
}
const char *
SDL_SYS_JoystickName(int jindex)
{
if (joydevnames[jindex] != NULL) {
return (joydevnames[jindex]);
}
return (joynames[jindex]);
}
static int
usage_to_joyaxe(unsigned usage)
{
int joyaxe;
switch (usage) {
case HUG_X:
joyaxe = JOYAXE_X; break;
case HUG_Y:
joyaxe = JOYAXE_Y; break;
case HUG_Z:
joyaxe = JOYAXE_Z; break;
case HUG_SLIDER:
joyaxe = JOYAXE_SLIDER; break;
case HUG_WHEEL:
joyaxe = JOYAXE_WHEEL; break;
case HUG_RX:
joyaxe = JOYAXE_RX; break;
case HUG_RY:
joyaxe = JOYAXE_RY; break;
case HUG_RZ:
joyaxe = JOYAXE_RZ; break;
default:
joyaxe = -1;
}
return joyaxe;
}
static unsigned
hatval_to_sdl(Sint32 hatval)
{
static const unsigned hat_dir_map[8] = {
SDL_HAT_UP, SDL_HAT_RIGHTUP, SDL_HAT_RIGHT, SDL_HAT_RIGHTDOWN,
SDL_HAT_DOWN, SDL_HAT_LEFTDOWN, SDL_HAT_LEFT, SDL_HAT_LEFTUP
};
unsigned result;
if ((hatval & 7) == hatval)
result = hat_dir_map[hatval];
else
result = SDL_HAT_CENTERED;
return result;
}
int
SDL_SYS_JoystickOpen(SDL_Joystick *joy)
{
char *path = joynames[joy->index];
struct joystick_hwdata *hw;
struct hid_item hitem;
struct hid_data *hdata;
struct report *rep;
int fd;
int i;
fd = open(path, O_RDONLY);
if (fd == -1) {
SDL_SetError("%s: %s", path, strerror(errno));
return (-1);
}
hw = (struct joystick_hwdata *)SDL_malloc(sizeof(struct joystick_hwdata));
if (hw == NULL) {
SDL_OutOfMemory();
close(fd);
return (-1);
}
joy->hwdata = hw;
hw->fd = fd;
hw->path = strdup(path);
hw->x = 0;
hw->y = 0;
hw->xmin = 0xffff;
hw->ymin = 0xffff;
hw->xmax = 0;
hw->ymax = 0;
if (! SDL_strncmp(path, "/dev/joy", 8)) {
hw->type = BSDJOY_JOY;
joy->naxes = 2;
joy->nbuttons = 2;
joy->nhats = 0;
joy->nballs = 0;
joydevnames[joy->index] = strdup("Gameport joystick");
goto usbend;
} else {
hw->type = BSDJOY_UHID;
}
{
int ax;
for (ax = 0; ax < JOYAXE_count; ax++)
hw->axis_map[ax] = -1;
}
hw->repdesc = hid_get_report_desc(fd);
if (hw->repdesc == NULL) {
SDL_SetError("%s: USB_GET_REPORT_DESC: %s", hw->path,
strerror(errno));
goto usberr;
}
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
rep->rid = hid_get_report_id(fd);
if (rep->rid < 0) {
#else
rep = &hw->inreport;
if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
#endif
rep->rid = -1; /* XXX */
}
if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
goto usberr;
}
if (rep->size <= 0) {
SDL_SetError("%s: Input report descriptor has invalid length",
hw->path);
goto usberr;
}
#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111)
hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid);
#else
hdata = hid_start_parse(hw->repdesc, 1 << hid_input);
#endif
if (hdata == NULL) {
SDL_SetError("%s: Cannot start HID parser", hw->path);
goto usberr;
}
joy->naxes = 0;
joy->nbuttons = 0;
joy->nhats = 0;
joy->nballs = 0;
for (i=0; i<JOYAXE_count; i++)
hw->axis_map[i] = -1;
while (hid_get_item(hdata, &hitem) > 0) {
char *sp;
const char *s;
switch (hitem.kind) {
case hid_collection:
switch (HID_PAGE(hitem.usage)) {
case HUP_GENERIC_DESKTOP:
switch (HID_USAGE(hitem.usage)) {
case HUG_JOYSTICK:
case HUG_GAME_PAD:
s = hid_usage_in_page(hitem.usage);
sp = SDL_malloc(SDL_strlen(s) + 5);
SDL_snprintf(sp, SDL_strlen(s) + 5, "%s (%d)", s,
joy->index);
joydevnames[joy->index] = sp;
}
}
break;
case hid_input:
switch (HID_PAGE(hitem.usage)) {
case HUP_GENERIC_DESKTOP: {
unsigned usage = HID_USAGE(hitem.usage);
int joyaxe = usage_to_joyaxe(usage);
if (joyaxe >= 0) {
hw->axis_map[joyaxe] = 1;
} else if (usage == HUG_HAT_SWITCH) {
joy->nhats++;
}
break;
}
case HUP_BUTTON:
joy->nbuttons++;
break;
default:
break;
}
break;
default:
break;
}
}
hid_end_parse(hdata);
for (i=0; i<JOYAXE_count; i++)
if (hw->axis_map[i] > 0)
hw->axis_map[i] = joy->naxes++;
usbend:
/* The poll blocks the event thread. */
fcntl(fd, F_SETFL, O_NONBLOCK);
return (0);
usberr:
close(hw->fd);
SDL_free(hw->path);
SDL_free(hw);
return (-1);
}
void
SDL_SYS_JoystickUpdate(SDL_Joystick *joy)
{
struct hid_item hitem;
struct hid_data *hdata;
struct report *rep;
int nbutton, naxe = -1;
Sint32 v;
#if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
struct joystick gameport;
if (joy->hwdata->type == BSDJOY_JOY) {
if (read(joy->hwdata->fd, &gameport, sizeof gameport) != sizeof gameport)
return;
if (abs(joy->hwdata->x - gameport.x) > 8) {
joy->hwdata->x = gameport.x;
if (joy->hwdata->x < joy->hwdata->xmin) {
joy->hwdata->xmin = joy->hwdata->x;
}
if (joy->hwdata->x > joy->hwdata->xmax) {
joy->hwdata->xmax = joy->hwdata->x;
}
if (joy->hwdata->xmin == joy->hwdata->xmax) {
joy->hwdata->xmin--;
joy->hwdata->xmax++;
}
v = (Sint32)joy->hwdata->x;
v -= (joy->hwdata->xmax + joy->hwdata->xmin + 1)/2;
v *= 32768/((joy->hwdata->xmax - joy->hwdata->xmin + 1)/2);
SDL_PrivateJoystickAxis(joy, 0, v);
}
if (abs(joy->hwdata->y - gameport.y) > 8) {
joy->hwdata->y = gameport.y;
if (joy->hwdata->y < joy->hwdata->ymin) {
joy->hwdata->ymin = joy->hwdata->y;
}
if (joy->hwdata->y > joy->hwdata->ymax) {
joy->hwdata->ymax = joy->hwdata->y;
}
if (joy->hwdata->ymin == joy->hwdata->ymax) {
joy->hwdata->ymin--;
joy->hwdata->ymax++;
}
v = (Sint32)joy->hwdata->y;
v -= (joy->hwdata->ymax + joy->hwdata->ymin + 1)/2;
v *= 32768/((joy->hwdata->ymax - joy->hwdata->ymin + 1)/2);
SDL_PrivateJoystickAxis(joy, 1, v);
}
if (gameport.b1 != joy->buttons[0]) {
SDL_PrivateJoystickButton(joy, 0, gameport.b1);
}
if (gameport.b2 != joy->buttons[1]) {
SDL_PrivateJoystickButton(joy, 1, gameport.b2);
}
return;
}
#endif /* defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
rep = &joy->hwdata->inreport;
if (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) != rep->size) {
return;
}
#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111)
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid);
#else
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
#endif
if (hdata == NULL) {
fprintf(stderr, "%s: Cannot start HID parser\n",
joy->hwdata->path);
return;
}
for (nbutton = 0; hid_get_item(hdata, &hitem) > 0;) {
switch (hitem.kind) {
case hid_input:
switch (HID_PAGE(hitem.usage)) {
case HUP_GENERIC_DESKTOP: {
unsigned usage = HID_USAGE(hitem.usage);
int joyaxe = usage_to_joyaxe(usage);
if (joyaxe >= 0) {
naxe = joy->hwdata->axis_map[joyaxe];
/* scaleaxe */
v = (Sint32)hid_get_data(REP_BUF_DATA(rep),
&hitem);
v -= (hitem.logical_maximum + hitem.logical_minimum + 1)/2;
v *= 32768/((hitem.logical_maximum - hitem.logical_minimum + 1)/2);
if (v != joy->axes[naxe]) {
SDL_PrivateJoystickAxis(joy, naxe, v);
}
} else if (usage == HUG_HAT_SWITCH) {
v = (Sint32)hid_get_data(REP_BUF_DATA(rep),
&hitem);
SDL_PrivateJoystickHat(joy, 0,
hatval_to_sdl(v)-hitem.logical_minimum);
}
break;
}
case HUP_BUTTON:
v = (Sint32)hid_get_data(REP_BUF_DATA(rep),
&hitem);
if (joy->buttons[nbutton] != v) {
SDL_PrivateJoystickButton(joy,
nbutton, v);
}
nbutton++;
break;
default:
continue;
}
break;
default:
break;
}
}
hid_end_parse(hdata);
return;
}
/* Function to close a joystick after use */
void
SDL_SYS_JoystickClose(SDL_Joystick *joy)
{
if (SDL_strncmp(joy->hwdata->path, "/dev/joy", 8)) {
report_free(&joy->hwdata->inreport);
hid_dispose_report_desc(joy->hwdata->repdesc);
}
close(joy->hwdata->fd);
SDL_free(joy->hwdata->path);
SDL_free(joy->hwdata);
return;
}
void
SDL_SYS_JoystickQuit(void)
{
int i;
for (i = 0; i < MAX_JOYS; i++) {
if (joynames[i] != NULL)
SDL_free(joynames[i]);
if (joydevnames[i] != NULL)
SDL_free(joydevnames[i]);
}
return;
}
static int
report_alloc(struct report *r, struct report_desc *rd, int repind)
{
int len;
#ifdef __DragonFly__
len = hid_report_size(rd, r->rid, repinfo[repind].kind);
#elif __FREEBSD__
# if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__)
# if (__FreeBSD_kernel_version <= 500111)
len = hid_report_size(rd, r->rid, repinfo[repind].kind);
# else
len = hid_report_size(rd, repinfo[repind].kind, r->rid);
# endif
# else
len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
# endif
#else
# ifdef USBHID_NEW
len = hid_report_size(rd, repinfo[repind].kind, r->rid);
# else
len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
# endif
#endif
if (len < 0) {
SDL_SetError("Negative HID report size");
return (-1);
}
r->size = len;
if (r->size > 0) {
r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) +
r->size);
if (r->buf == NULL) {
SDL_OutOfMemory();
return (-1);
}
} else {
r->buf = NULL;
}
r->status = SREPORT_CLEAN;
return (0);
}
static void
report_free(struct report *r)
{
if (r->buf != NULL) {
SDL_free(r->buf);
}
r->status = SREPORT_UNINIT;
}
#endif /* SDL_JOYSTICK_USBHID */

View File

@ -1,874 +0,0 @@
/* *INDENT-OFF* */
/*
*
* @APPLE_LICENSE_HEADER_START@
*
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef _IOKIT_HID_IOHIDLIB_H_
#define _IOKIT_HID_IOHIDLIB_H_
#include <sys/cdefs.h>
__BEGIN_DECLS
#include <CoreFoundation/CoreFoundation.h>
#if COREFOUNDATION_CFPLUGINCOM_SEPARATE
#include <CoreFoundation/CFPlugInCOM.h>
#endif
#include <IOKit/IOTypes.h>
#include <IOKit/IOReturn.h>
#include <IOKit/hid/IOHIDKeys.h>
struct IOHIDEventStruct
{
IOHIDElementType type;
IOHIDElementCookie elementCookie;
SInt32 value;
AbsoluteTime timestamp;
UInt32 longValueSize;
void * longValue;
};
typedef struct IOHIDEventStruct IOHIDEventStruct;
/* FA12FA38-6F1A-11D4-BA0C-0005028F18D5 */
#define kIOHIDDeviceUserClientTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \
0xFA, 0x12, 0xFA, 0x38, 0x6F, 0x1A, 0x11, 0xD4, \
0xBA, 0x0C, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
/* 13AA9C44-6F1B-11D4-907C-0005028F18D5 */
#define kIOHIDDeviceFactoryID CFUUIDGetConstantUUIDWithBytes(NULL, \
0x13, 0xAA, 0x9C, 0x44, 0x6F, 0x1B, 0x11, 0xD4, \
0x90, 0x7C, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
/* 78BD420C-6F14-11D4-9474-0005028F18D5 */
/*! @defined kIOHIDDeviceInterfaceID
@discussion Interface ID for the IOHIDDeviceInterface. Corresponds to an
available HID device. */
#define kIOHIDDeviceInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
0x78, 0xBD, 0x42, 0x0C, 0x6F, 0x14, 0x11, 0xD4, \
0x94, 0x74, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
/* 7D0B510E-16D5-11D7-9E9B-000393992E38 */
/*! @defined kIOHIDDeviceInterfaceID121
@discussion Interface ID for the IOHIDDeviceInterface121. Corresponds to
an available HID device that includes methods from
IOHIDDeviceInterface. This interface is available on
IOHIDLib 1.2.1 and Mac OS X 10.2.3 or later.*/
#define kIOHIDDeviceInterfaceID121 CFUUIDGetConstantUUIDWithBytes(NULL, \
0x7d, 0xb, 0x51, 0xe, 0x16, 0xd5, 0x11, 0xd7, \
0x9e, 0x9b, 0x0, 0x3, 0x93, 0x99, 0x2e, 0x38)
/* B70ABF31-16D5-11D7-AB35-000393992E38 */
/*! @defined kIOHIDDeviceInterfaceID122
@discussion Interface ID for the IOHIDDeviceInterface122. Corresponds to
an available HID device that includes methods from
IOHIDDeviceInterface and IOHIDDeviceInterface121. This
interface is available on IOHIDLib 1.2.2 and Mac OS X 10.3
or later.*/
#define kIOHIDDeviceInterfaceID122 CFUUIDGetConstantUUIDWithBytes(NULL, \
0xb7, 0xa, 0xbf, 0x31, 0x16, 0xd5, 0x11, 0xd7, \
0xab, 0x35, 0x0, 0x3, 0x93, 0x99, 0x2e, 0x38)
/* 8138629E-6F14-11D4-970E-0005028F18D5 */
/*! @defined kIOHIDQueueInterfaceID
@discussion Interface ID for the kIOHIDQueueInterfaceID. Corresponds to a
queue for a specific HID device. */
#define kIOHIDQueueInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
0x81, 0x38, 0x62, 0x9E, 0x6F, 0x14, 0x11, 0xD4, \
0x97, 0x0E, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
/* 80CDCC00-755D-11D4-8E0F-0005028F18D5 */
/*! @defined kIOHIDOutputTransactionInterfaceID
@discussion Interface ID for the kIOHIDOutputTransactionInterfaceID.
Corresponds to an output transaction for one or more report IDs
on a specific device. */
#define kIOHIDOutputTransactionInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL,\
0x80, 0xCD, 0xCC, 0x00, 0x75, 0x5D, 0x11, 0xD4, \
0x80, 0xEF, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
/*! @typedef IOHIDCallbackFunction
@discussion Type and arguments of callout C function that is used when a
completion routine is called, see
IOHIDLib.h:setRemovalCallback().
@param target void * pointer to your data, often a pointer to an object.
@param result Completion result of desired operation.
@param refcon void * pointer to more data.
@param sender Interface instance sending the completion routine.
*/
typedef void (*IOHIDCallbackFunction)
(void * target, IOReturn result, void * refcon, void * sender);
/*! @typedef IOHIDElementCallbackFunction
@discussion Type and arguments of callout C function that is used when a
completion routine is called, see IOHIDLib.h:setElementValue().
@param target void * pointer to your data, often a pointer to an object.
@param result Completion result of desired operation.
@param refcon void * pointer to more data.
@param sender Interface instance sending the completion routine.
@param elementCookie Element within interface instance sending completion.
*/
typedef void (*IOHIDElementCallbackFunction)
(void * target,
IOReturn result,
void * refcon,
void * sender,
IOHIDElementCookie elementCookie);
/*! @typedef IOHIDReportCallbackFunction
@discussion Type and arguments of callout C function that is used when a
completion routine is called, see IOHIDLib.h:setReport().
@param target void * pointer to your data, often a pointer to an object.
@param result Completion result of desired operation.
@param refcon void * pointer to more data.
@param sender Interface instance sending the completion routine.
@param bufferSize Size of the buffer received upon completion.
*/
typedef void (*IOHIDReportCallbackFunction)
(void * target,
IOReturn result,
void * refcon,
void * sender,
UInt32 bufferSize);
/* Forward declarations of the queue and output transaction interfaces */
struct IOHIDQueueInterface;
struct IOHIDOutputTransactionInterface;
typedef struct IOHIDQueueInterface IOHIDQueueInterface;
typedef struct IOHIDOutputTransactionInterface IOHIDOutputTransactionInterface;
//
// IOHIDDeviceInterface Functions available in version 1.0 (10.0) and higher of Mac OS X
//
#define IOHIDDEVICEINTERFACE_FUNCS_100 \
IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \
CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \
IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \
mach_port_t (*getAsyncPort)(void * self); \
IOReturn (*open)(void * self, UInt32 flags); \
IOReturn (*close)(void * self); \
IOReturn (*setRemovalCallback)(void * self, IOHIDCallbackFunction removalCallback, \
void * removalTarget, void * removalRefcon); \
IOReturn (*getElementValue)(void * self, IOHIDElementCookie elementCookie, \
IOHIDEventStruct * valueEvent); \
IOReturn (*setElementValue)(void * self, IOHIDElementCookie elementCookie, \
IOHIDEventStruct * valueEvent, UInt32 timeoutMS, \
IOHIDElementCallbackFunction callback, \
void * callbackTarget, void * callbackRefcon); \
IOReturn (*queryElementValue)(void * self, IOHIDElementCookie elementCookie, \
IOHIDEventStruct * valueEvent, UInt32 timeoutMS, \
IOHIDElementCallbackFunction callback, \
void * callbackTarget, void * callbackRefcon); \
IOReturn (*startAllQueues)(void * self); \
IOReturn (*stopAllQueues)(void * self); \
IOHIDQueueInterface ** (*allocQueue) (void *self); \
IOHIDOutputTransactionInterface ** (*allocOutputTransaction) (void *self)
//
// IOHIDDeviceInterface Functions available in version 1.2.1 (10.2.3) and higher of Mac OS X
//
#define IOHIDDEVICEINTERFACE_FUNCS_121 \
IOReturn (*setReport)(void * self, IOHIDReportType reportType, UInt32 reportID, \
void * reportBuffer, UInt32 reportBufferSize, \
UInt32 timeoutMS, IOHIDReportCallbackFunction callback, \
void * callbackTarget, void * callbackRefcon); \
IOReturn (*getReport)(void * self, IOHIDReportType reportType, \
UInt32 reportID, void * reportBuffer, \
UInt32 * reportBufferSize, UInt32 timeoutMS, \
IOHIDReportCallbackFunction callback, \
void * callbackTarget, void * callbackRefcon)
//
// IOHIDDeviceInterface Functions available in version 1.2.2 (10.3) and higher of Mac OS X
//
#define IOHIDDEVICEINTERFACE_FUNCS_122 \
IOReturn (*copyMatchingElements)(void * self, CFDictionaryRef matchingDict, \
CFArrayRef * elements); \
IOReturn (*setInterruptReportHandlerCallback)(void * self, void * reportBuffer, \
UInt32 reportBufferSize, \
IOHIDReportCallbackFunction callback, \
void * callbackTarget, void * callbackRefcon)
typedef struct IOHIDDeviceInterface
{
IUNKNOWN_C_GUTS;
IOHIDDEVICEINTERFACE_FUNCS_100;
IOHIDDEVICEINTERFACE_FUNCS_121;
} IOHIDDeviceInterface;
typedef struct IOHIDDeviceInterface121
{
IUNKNOWN_C_GUTS;
IOHIDDEVICEINTERFACE_FUNCS_100;
IOHIDDEVICEINTERFACE_FUNCS_121;
} IOHIDDeviceInterface121;
typedef struct IOHIDDeviceInterface122
{
IUNKNOWN_C_GUTS;
IOHIDDEVICEINTERFACE_FUNCS_100;
IOHIDDEVICEINTERFACE_FUNCS_121;
IOHIDDEVICEINTERFACE_FUNCS_122;
} IOHIDDeviceInterface122;
//
// IOHIDQueueInterface Functions available in version 1.0 (10.0) and higher of Mac OS X
//
#define IOHIDQUEUEINTERFACE_FUNCS_100 \
IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \
CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \
IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \
mach_port_t (*getAsyncPort)(void * self); \
IOReturn (*create)(void * self, UInt32 flags, UInt32 depth); \
IOReturn (*dispose)(void * self); \
IOReturn (*addElement)(void * self, IOHIDElementCookie elementCookie, UInt32 flags);\
IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie); \
Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie); \
IOReturn (*start)(void * self); \
IOReturn (*stop)(void * self); \
IOReturn (*getNextEvent)(void * self, IOHIDEventStruct * event, \
AbsoluteTime maxTime, UInt32 timeoutMS); \
IOReturn (*setEventCallout)(void * self, IOHIDCallbackFunction callback, \
void * callbackTarget, void * callbackRefcon); \
IOReturn (*getEventCallout)(void * self, IOHIDCallbackFunction * outCallback, \
void ** outCallbackTarget, void ** outCallbackRefcon)
struct IOHIDQueueInterface
{
IUNKNOWN_C_GUTS;
IOHIDQUEUEINTERFACE_FUNCS_100;
};
//
// IOHIDOutputTransactionInterface Functions available in version 1.2 (10.2) and higher of Mac OS X
//
#define IOHIDOUTPUTTRANSACTIONINTERFACE_FUNCS_120 \
IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \
CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \
IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \
mach_port_t (*getAsyncPort)(void * self); \
IOReturn (*create)(void * self); \
IOReturn (*dispose)(void * self); \
IOReturn (*addElement)(void * self, IOHIDElementCookie elementCookie); \
IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie); \
Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie); \
IOReturn (*setElementDefault)(void *self, IOHIDElementCookie elementCookie, \
IOHIDEventStruct * valueEvent); \
IOReturn (*getElementDefault)(void * self, IOHIDElementCookie elementCookie, \
IOHIDEventStruct * outValueEvent); \
IOReturn (*setElementValue)(void * self, IOHIDElementCookie elementCookie, \
IOHIDEventStruct * valueEvent); \
IOReturn (*getElementValue)(void * self, IOHIDElementCookie elementCookie, \
IOHIDEventStruct * outValueEvent); \
IOReturn (*commit)(void * self, UInt32 timeoutMS, IOHIDCallbackFunction callback, \
void * callbackTarget, void * callbackRefcon); \
IOReturn (*clear)(void * self)
struct IOHIDOutputTransactionInterface
{
IUNKNOWN_C_GUTS;
IOHIDOUTPUTTRANSACTIONINTERFACE_FUNCS_120;
};
//
// BEGIN READABLE STRUCTURE DEFINITIONS
//
// This portion of uncompiled code provides a more reader friendly representation of
// the CFPlugin methods defined above.
#if 0
/*! @class IOHIDDeviceInterface
@discussion CFPlugin object subclass which provides the primary interface to
HID devices.
*/
typedef struct IOHIDDeviceInterface
{
IUNKNOWN_C_GUTS;
/*! @function createAsyncEventSource
@abstract Creates async eventsource.
@discussion This method will create an async mach port, if one
has not already been created.
@param source Reference to CFRunLoopSourceRef that is created.
@result Returns an IOReturn code.
*/
IOReturn (*createAsyncEventSource)(void * self,
CFRunLoopSourceRef * source);
/*! @function getAsyncEventSource
@abstract Gets the created async event source.
@result Returns a CFRunLoopSourceRef.
*/
CFRunLoopSourceRef (*getAsyncEventSource)(void * self);
/*! @function createAsyncPort
@abstract Creates an async port.
@discussion The port must be created before any callbacks can be used.
@param port Reference to mach port that is created.
@result Returns an IOReturn code.
*/
IOReturn (*createAsyncPort)(void * self, mach_port_t * port);
/*! @function getAsyncPort
@abstract Gets the current async port.
@result Returns a mach_port_t.
*/
mach_port_t (*getAsyncPort)(void * self);
/*! @function open
@abstract Opens the device.
@param flags Flags to be passed down to the user client.
@result Returns an IOReturn code.
*/
IOReturn (*open)(void * self, UInt32 flags);
/*! @function close
@abstract Closes the device.
@result Returns an IOReturn code.
*/
IOReturn (*close)(void * self);
/*! @function setRemovalCallback
@abstract Sets callback to be used when device is removed.
@param removalCallback Called when the device is removed.
@param removeTarget Passed to the callback.
@param removalRefcon Passed to the callback.
@result Returns an IOReturn code.
*/
IOReturn (*setRemovalCallback)(void * self,
IOHIDCallbackFunction removalCallback,
void * removalTarget,
void * removalRefcon);
/*! @function getElementValue
@abstract Obtains the most recent value of an element.
@discussion This call is most useful for interrupt driven elements,
such as input type elements. Since feature type element values
need to be polled from the device, it is recommended to use the
queryElementValue method to obtain the current value. The
timestamp field in the event details the last time the element
value was altered.
@param elementCookie The element of interest.
@param valueEvent The event that will be filled. If a long value is
present, it is up to the caller to deallocate it.
@result Returns an IOReturn code.
*/
IOReturn (*getElementValue)(void * self,
IOHIDElementCookie elementCookie,
IOHIDEventStruct * valueEvent);
/*! @function setElementValue
@abstract Sets an element value on the device.
@discussion This call is most useful for feature type elements. It is
recommended to use IOOutputTransaction for output type elements.
@param elementCookie The element of interest.
@param valueEvent The event that will be filled. If a long value is
present, it will be copied.
@param timeoutMS UNSUPPORTED.
@param callback UNSUPPORTED.
@param callbackTarget UNSUPPORTED.
@param callbackRefcon UNSUPPORTED.
@result Returns an IOReturn code.
*/
IOReturn (*setElementValue)(void * self,
IOHIDElementCookie elementCookie,
IOHIDEventStruct * valueEvent,
UInt32 timeoutMS,
IOHIDElementCallbackFunction callback,
void * callbackTarget,
void * callbackRefcon);
/*! @function queryElementValue
@abstract Obtains the current value of an element.
@discussion This call is most useful for feature type elements. This
method will poll the device for the current element value.
@param elementCookie The element of interest.
@param valueEvent The event that will be filled. If a long value is
present, it is up to the caller to deallocate it.
@param timeoutMS UNSUPPORTED.
@param callback UNSUPPORTED.
@param callbackTarget UNSUPPORTED.
@param callbackRefcon UNSUPPORTED.
@result Returns an IOReturn code.
*/
IOReturn (*queryElementValue)(void * self,
IOHIDElementCookie elementCookie,
IOHIDEventStruct * valueEvent,
UInt32 timeoutMS,
IOHIDElementCallbackFunction callback,
void * callbackTarget,
void * callbackRefcon);
/*! @function startAllQueues
@abstract Starts data delivery on all queues for this device.
@result Returns an IOReturn code.
*/
IOReturn (*startAllQueues)(void * self);
/*! @function stopAllQueues
@abstract Stops data delivery on all queues for this device.
@result Returns an IOReturn code.
*/
IOReturn (*stopAllQueues)(void * self);
/*! @function allocQueue
@abstract Wrapper to return instances of the IOHIDQueueInterface.
@result Returns the created IOHIDQueueInterface.
*/
IOHIDQueueInterface ** (*allocQueue) (void *self);
/*! @function allocOutputTransaction
@abstract Wrapper to return instances of the IOHIDOutputTransactionInterface.
@result Returns the created IOHIDOutputTransactionInterface.
*/
IOHIDOutputTransactionInterface ** (*allocOutputTransaction) (void *self);
} IOHIDDeviceInterface;
/*! @class IOHIDDeviceInterface121
@discussion CFPlugin object subclass which provides the primary interface to
HID devices. This class is a subclass of IOHIDDeviceInterface.
*/
typedef struct IOHIDDeviceInterface121
{
IUNKNOWN_C_GUTS;
IOHIDDEVICEINTERFACE_FUNCS_100;
/*! @function setReport
@abstract Sends a report to the device.
@param reportType The report type.
@param reportID The report id.
@param reportBuffer Pointer to a preallocated buffer.
@param reportBufferSize Size of the reportBuffer in bytes.
@param timeoutMS
@param callback If null, this method will behave synchronously.
@param callbackTarget The callback target passed to the callback.
@param callbackRefcon The callback refcon passed to the callback.
@result Returns an IOReturn code.
*/
IOReturn (*setReport) (void * self,
IOHIDReportType reportType,
UInt32 reportID,
void * reportBuffer,
UInt32 reportBufferSize,
UInt32 timeoutMS,
IOHIDReportCallbackFunction callback,
void * callbackTarget,
void * callbackRefcon);
/*! @function getReport
@abstract Obtains a report from the device.
@param reportType The report type.
@param reportID The report ID.
@param reportBuffer Pointer to a preallocated buffer.
@param reportBufferSize Size of the reportBuffer in bytes.
When finished, will contain the actual size of the report.
@param timeoutMS
@param callback If null, this method will behave synchronously.
@param callbackTarget The callback target passed to the callback.
@param callbackRefcon The callback refcon passed to the callback.
@result Returns an IOReturn code.
*/
IOReturn (*getReport) (void * self,
IOHIDReportType reportType,
UInt32 reportID,
void * reportBuffer,
UInt32 * reportBufferSize,
UInt32 timeoutMS,
IOHIDReportCallbackFunction callback,
void * callbackTarget,
void * callbackRefcon);
}IOHIDDeviceInterface121;
/*! @class IOHIDDeviceInterface122
@discussion CFPlugin object subclass which provides the primary interface to
HID devices. This class is a subclass of IOHIDDeviceInterface121.
*/
typedef struct IOHIDDeviceInterface122
{
IUNKNOWN_C_GUTS;
IOHIDDEVICEINTERFACE_FUNCS_100;
IOHIDDEVICEINTERFACE_FUNCS_121;
/*! @function copyMatchingElements
@abstract Obtains specific elements defined by the device.
@discussion Using keys defined in IOHIDKeys.h for elements, create a
matching dictonary containing items that you wish to search for.
A null array indicates that no elements matching that criteria
were found. Each item in the array is a reference to the same
dictionary item that represents each element in the I/O Registry.
It is up to the caller to release the returned array of elements.
@param matchingDict Dictionary containg key/value pairs to match on. Pass
a null value to match on all elements.
@param elements Pointer to a CFArrayRef that will be returned by this
method. It is up to the caller to release it when finished.
@result Returns an IOReturn code.
*/
IOReturn (*copyMatchingElements)(void * self,
CFDictionaryRef matchingDict,
CFArrayRef * elements);
/*! @function setInterruptReportHandlerCallback
@abstract Sets the report handler callout to be called when the data
is received from the Interrupt-In pipe.
@discussion In order for this to work correctly, you must call
createAsyncPort and createAsyncEventSource.
@param reportBuffer Pointer to a preallocated buffer.
@param reportBufferSize Size of the reportBuffer in bytes.
@param callback If non-NULL, is a callback to be called when data
is received from the device.
@param callbackTarget The callback target passed to the callback
@param callbackRefcon The callback refcon passed to the callback.
@result Returns an IOReturn code.
*/
IOReturn (*setInterruptReportHandlerCallback)(
void * self,
void * reportBuffer,
UInt32 reportBufferSize,
IOHIDReportCallbackFunction callback,
void * callbackTarget,
void * callbackRefcon);
}IOHIDDeviceInterface122;
/*! @class IOHIDQueueInterface
@discussion CFPlugin object subclass which provides an interface for input
queues from HID devices. Created by an IOHIDDeviceInterface
object.
*/
typedef struct IOHIDQueueInterface
{
IUNKNOWN_C_GUTS;
/*! @function createAsyncEventSource
@abstract Creates an async event source.
@discussion This will be used with setEventCallout.
@param source The newly created event source.
@result Returns an IOReturn code.
*/
IOReturn (*createAsyncEventSource)(void * self,
CFRunLoopSourceRef * source);
/*! @function getAsyncEventSource
@abstract Obtains the current event source.
@result Returns a CFRunLoopSourceRef.
*/
CFRunLoopSourceRef (*getAsyncEventSource)(void * self);
/*! @function createAsyncPort
@abstract Creates an async port.
@discussion This will be used with createAsyncEventSource.
@param port The newly created async port.
@result Returns an IOReturn code.
*/
IOReturn (*createAsyncPort)(void * self, mach_port_t * port);
/*! @function getAsyncPort
@abstract Obtains the current async port.
@result Returns a mach_port_t.
*/
mach_port_t (*getAsyncPort)(void * self);
/*! @function create
@abstract Creates the current queue.
@param flags
@param depth The maximum number of elements in the queue
before the oldest elements in the queue begin to be lost.
@result Returns an IOReturn code.
*/
IOReturn (*create)(void * self,
UInt32 flags,
UInt32 depth);
/*! @function create
@abstract Disposes of the current queue.
@result Returns an IOReturn code.
*/
IOReturn (*dispose)(void * self);
/*! @function addElement
@abstract Adds an element to the queue.
@discussion If the element has already been added to queue,
an error will be returned.
@param elementCookie The element of interest.
@param flags
@result Returns an IOReturn code.
*/
IOReturn (*addElement)(void * self,
IOHIDElementCookie elementCookie,
UInt32 flags);
/*! @function removeElement
@abstract Removes an element from the queue.
@discussion If the element has not been added to queue,
an error will be returned.
@param elementCookie The element of interest.
@result Returns an IOReturn code.
*/
IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie);
/*! @function hasElement
@abstract Checks whether an element has been added to
the queue.
@discussion Will return true if present, otherwise will return false.
@param elementCookie The element of interest.
@result Returns a Boolean value.
*/
Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie);
/*! @function start
@abstract Starts event delivery to the queue.
@result Returns an IOReturn code.
*/
IOReturn (*start)(void * self);
/*! @function stop
@abstract Stops event delivery to the queue.
@result Returns an IOReturn code.
*/
IOReturn (*stop)(void * self);
/*! @function getNextEvent
@abstract Reads next event from the queue.
@param event The event that will be filled. If a long value is
present, it is up to the caller to deallocate it.
@param maxtime UNSUPPORTED. If non-zero, limits read events to
those that occured on or before maxTime.
@param timoutMS UNSUPPORTED. The timeout in milliseconds, a zero
timeout will cause this call to be non-blocking (returning
queue empty) if there is a NULL callback, and blocking forever
until the queue is non-empty if there is a valid callback.
@result Returns an IOReturn code.
*/
IOReturn (*getNextEvent)(void * self,
IOHIDEventStruct * event,
AbsoluteTime maxTime,
UInt32 timeoutMS);
/*! @function setEventCallout
@abstract Sets the event callout to be called when the queue
transitions to non-empty.
@discussion In order for this to work correctly, you must call
createAsyncPort and createAsyncEventSource.
@param callback if non-NULL is a callback to be called when data
is inserted to the queue
@param callbackTarget The callback target passed to the callback
@param callbackRefcon The callback refcon passed to the callback.
@result Returns an IOReturn code.
*/
IOReturn (*setEventCallout)(void * self,
IOHIDCallbackFunction callback,
void * callbackTarget,
void * callbackRefcon);
/*! @function getEventCallout
@abstract Gets the event callout.
@discussion This callback will be called the queue transitions
to non-empty.
@param callback if non-NULL is a callback to be called when data
is inserted to the queue
@param callbackTarget The callback target passed to the callback
@param callbackRefcon The callback refcon passed to the callback
@result Returns an IOReturn code.
*/
IOReturn (*getEventCallout)(void * self,
IOHIDCallbackFunction * outCallback,
void ** outCallbackTarget,
void ** outCallbackRefcon);
} IOHIDQueueInterface;
/*! @class IOHIDOutputTransactionInterface
@discussion CFPlugin object subclass which privides interface for output
transactions to HID devices. Created by a IOHIDDeviceInterface
object. */
typedef struct IOHIDOutputTransactionInterface
{
IUNKNOWN_C_GUTS;
/*! @function createAsyncEventSource
@abstract Creates an async event source.
@discussion This will be used with setEventCallout.
@param source The newly created event source
@result Returns an IOReturn code.
*/
IOReturn (*createAsyncEventSource)(void * self,
CFRunLoopSourceRef * source);
/*! @function getAsyncEventSource
@abstract Obtains the current event source.
@result Returns a CFRunLoopSourceRef.
*/
CFRunLoopSourceRef (*getAsyncEventSource)(void * self);
/*! @function createAsyncPort
@abstract Creates an async port.
@discussion This will be used with createAsyncEventSource.
@param port The newly created async port.
@result Returns an IOReturn code.
*/
IOReturn (*createAsyncPort)(void * self, mach_port_t * port);
/*! @function getAsyncPort
@abstract Obtains the current async port.
@result Returns a mach_port_t.
*/
mach_port_t (*getAsyncPort)(void * self);
/*! @function create
@abstract Creates the current transaction.
@discussion This method will free any memory that has been
allocated for this transaction.
@result Returns an IOReturn code.
*/
IOReturn (*create)(void * self);
/*! @function dispose
@abstract Disposes of the current transaction.
@discussion The transaction will have to be recreated, in order
to perform any operations on the transaction.
@result Returns an IOReturn code.
*/
IOReturn (*dispose)(void * self);
/*! @function addElement
@abstract Adds an element to the transaction.
@discussion If the element has already been added to transaction,
an error will be returned.
@param elementCookie The element of interest.
@result Returns an IOReturn code.
*/
IOReturn (*addElement) (void * self, IOHIDElementCookie elementCookie);
/*! @function removeElement
@abstract Removes an element from the transaction.
@discussion If the element has not been added to transaction,
an error will be returned.
@param elementCookie The element of interest.
@result Returns an IOReturn code.
*/
IOReturn (*removeElement) (void * self, IOHIDElementCookie elementCookie);
/*! @function hasElement
@abstract Checks whether an element has been added to
the transaction.
@discussion Will return true if present, otherwise will return false.
@param elementCookie The element of interest.
@result Returns a Boolean value.
*/
Boolean (*hasElement) (void * self, IOHIDElementCookie elementCookie);
/*! @function setElementDefault
@abstract Sets the default value of an element in a
transaction.
@discussion An error will be returned if the element has not been
added to the transaction.
@param elementCookie The element of interest.
@param valueEvent The event that will be filled. If a long value is
present, it will be copied.
@result Returns an IOReturn code.
*/
IOReturn (*setElementDefault)(void * self,
IOHIDElementCookie elementCookie,
IOHIDEventStruct * valueEvent);
/*! @function getElementDefault
@abstract Obtains the default value of an element in a
transaction.
@discussion An error will be returned if the element has not been
added to the transaction.
@param elementCookie The element of interest.
@param outValueEvent The event that will be filled. If a long value is
present, it is up to the caller to deallocate it.
@result Returns an IOReturn code.
*/
IOReturn (*getElementDefault)(void * self,
IOHIDElementCookie elementCookie,
IOHIDEventStruct * outValueEvent);
/*! @function setElementValue
@abstract Sets the value of an element in a transaction.
@discussion An error will be returned if the element has not been
added to the transaction.
@param elementCookie The element of interest.
@param valueEvent The event that will be filled. If a long value is
present, it will be copied.
@result Returns an IOReturn code.
*/
IOReturn (*setElementValue)(void * self,
IOHIDElementCookie elementCookie,
IOHIDEventStruct * valueEvent);
/*! @function getElementValue
@abstract Obtains the value of an element in a transaction.
@discussion An error will be returned if the element has not been
added to the transaction.
@param elementCookie The element of interest.
@param outValueEvent The event that will be filled. If a long value is
present, it is up to the caller to deallocate it.
@result Returns an IOReturn code.
*/
IOReturn (*getElementValue)(void * self,
IOHIDElementCookie elementCookie,
IOHIDEventStruct * outValueEvent);
/*! @function commit
@abstract Commits the transaction.
@discussion Transaction element values, if set, will be sent to the
device. Otherwise, the default element value will be used. If
neither are set, that element will be omitted from the commit.
After a transaction is committed, transaction element values
will be cleared. Default values will be preserved.
@param timeoutMS UNSUPPORTED
@param callback UNSUPPORTED
@param callbackTarget UNSUPPORTED
@param callbackRefcon UNSUPPORTED
@result Returns an IOReturn code.
*/
IOReturn (*commit)(void * self,
UInt32 timeoutMS,
IOHIDCallbackFunction callback,
void * callbackTarget,
void * callbackRefcon);
/*! @function clear
@abstract Clears the transaction.
@discussion Transaction element values will cleared. Default
values will be preserved.
@result Returns an IOReturn code.
*/
IOReturn (*clear)(void * self);
} IOHIDOutputTransactionInterface;
#endif
__END_DECLS
#endif /* !_IOKIT_HID_IOHIDLIB_H_ */

View File

@ -1,846 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifdef SDL_JOYSTICK_IOKIT
/* SDL joystick driver for Darwin / Mac OS X, based on the IOKit HID API */
/* Written 2001 by Max Horn */
#include <unistd.h>
#include <ctype.h>
#include <sysexits.h>
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/IOCFPlugIn.h>
#ifdef MACOS_10_0_4
#include <IOKit/hidsystem/IOHIDUsageTables.h>
#else
/* The header was moved here in Mac OS X 10.1 */
#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED == 1030
#include "10.3.9-FIX/IOHIDLib.h"
#else
#include <IOKit/hid/IOHIDLib.h>
#endif
#include <IOKit/hid/IOHIDKeys.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Carbon/Carbon.h> /* for NewPtrClear, DisposePtr */
#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
struct recElement
{
IOHIDElementCookie cookie; /* unique value which identifies element, will NOT change */
long min; /* reported min value possible */
long max; /* reported max value possible */
#if 0
/* TODO: maybe should handle the following stuff somehow? */
long scaledMin; /* reported scaled min value possible */
long scaledMax; /* reported scaled max value possible */
long size; /* size in bits of data return from element */
Boolean relative; /* are reports relative to last report (deltas) */
Boolean wrapping; /* does element wrap around (one value higher than max is min) */
Boolean nonLinear; /* are the values reported non-linear relative to element movement */
Boolean preferredState; /* does element have a preferred state (such as a button) */
Boolean nullState; /* does element have null state */
#endif /* 0 */
/* runtime variables used for auto-calibration */
long minReport; /* min returned value */
long maxReport; /* max returned value */
struct recElement * pNext; /* next element in list */
};
typedef struct recElement recElement;
struct joystick_hwdata
{
IOHIDDeviceInterface ** interface; /* interface to device, NULL = no interface */
char product[256]; /* name of product */
long usage; /* usage page from IOUSBHID Parser.h which defines general usage */
long usagePage; /* usage within above page from IOUSBHID Parser.h which defines specific usage */
long axes; /* number of axis (calculated, not reported by device) */
long buttons; /* number of buttons (calculated, not reported by device) */
long hats; /* number of hat switches (calculated, not reported by device) */
long elements; /* number of total elements (shouldbe total of above) (calculated, not reported by device) */
recElement* firstAxis;
recElement* firstButton;
recElement* firstHat;
int removed;
int uncentered;
struct joystick_hwdata* pNext; /* next device */
};
typedef struct joystick_hwdata recDevice;
/* Linked list of all available devices */
static recDevice *gpDeviceList = NULL;
static void HIDReportErrorNum (const char * strError, long numError)
{
SDL_SetError(strError);
}
static void HIDGetCollectionElements (CFMutableDictionaryRef deviceProperties, recDevice *pDevice);
/* returns current value for element, polling element
* will return 0 on error conditions which should be accounted for by application
*/
static SInt32 HIDGetElementValue (recDevice *pDevice, recElement *pElement)
{
IOReturn result = kIOReturnSuccess;
IOHIDEventStruct hidEvent;
hidEvent.value = 0;
if (NULL != pDevice && NULL != pElement && NULL != pDevice->interface)
{
result = (*(pDevice->interface))->getElementValue(pDevice->interface, pElement->cookie, &hidEvent);
if (kIOReturnSuccess == result)
{
/* record min and max for auto calibration */
if (hidEvent.value < pElement->minReport)
pElement->minReport = hidEvent.value;
if (hidEvent.value > pElement->maxReport)
pElement->maxReport = hidEvent.value;
}
}
/* auto user scale */
return hidEvent.value;
}
static SInt32 HIDScaledCalibratedValue (recDevice *pDevice, recElement *pElement, long min, long max)
{
float deviceScale = max - min;
float readScale = pElement->maxReport - pElement->minReport;
SInt32 value = HIDGetElementValue(pDevice, pElement);
if (readScale == 0)
return value; /* no scaling at all */
else
return ((value - pElement->minReport) * deviceScale / readScale) + min;
}
static void HIDRemovalCallback(void * target,
IOReturn result,
void * refcon,
void * sender)
{
recDevice *device = (recDevice *) refcon;
device->removed = 1;
device->uncentered = 1;
}
/* Create and open an interface to device, required prior to extracting values or building queues.
* Note: appliction now owns the device and must close and release it prior to exiting
*/
static IOReturn HIDCreateOpenDeviceInterface (io_object_t hidDevice, recDevice *pDevice)
{
IOReturn result = kIOReturnSuccess;
HRESULT plugInResult = S_OK;
SInt32 score = 0;
IOCFPlugInInterface ** ppPlugInInterface = NULL;
if (NULL == pDevice->interface)
{
result = IOCreatePlugInInterfaceForService (hidDevice, kIOHIDDeviceUserClientTypeID,
kIOCFPlugInInterfaceID, &ppPlugInInterface, &score);
if (kIOReturnSuccess == result)
{
/* Call a method of the intermediate plug-in to create the device interface */
plugInResult = (*ppPlugInInterface)->QueryInterface (ppPlugInInterface,
CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), (void *) &(pDevice->interface));
if (S_OK != plugInResult)
HIDReportErrorNum ("Couldn't query HID class device interface from plugInInterface", plugInResult);
(*ppPlugInInterface)->Release (ppPlugInInterface);
}
else
HIDReportErrorNum ("Failed to create **plugInInterface via IOCreatePlugInInterfaceForService.", result);
}
if (NULL != pDevice->interface)
{
result = (*(pDevice->interface))->open (pDevice->interface, 0);
if (kIOReturnSuccess != result)
HIDReportErrorNum ("Failed to open pDevice->interface via open.", result);
else
(*(pDevice->interface))->setRemovalCallback (pDevice->interface, HIDRemovalCallback, pDevice, pDevice);
}
return result;
}
/* Closes and releases interface to device, should be done prior to exting application
* Note: will have no affect if device or interface do not exist
* application will "own" the device if interface is not closed
* (device may have to be plug and re-plugged in different location to get it working again without a restart)
*/
static IOReturn HIDCloseReleaseInterface (recDevice *pDevice)
{
IOReturn result = kIOReturnSuccess;
if ((NULL != pDevice) && (NULL != pDevice->interface))
{
/* close the interface */
result = (*(pDevice->interface))->close (pDevice->interface);
if (kIOReturnNotOpen == result)
{
/* do nothing as device was not opened, thus can't be closed */
}
else if (kIOReturnSuccess != result)
HIDReportErrorNum ("Failed to close IOHIDDeviceInterface.", result);
/* release the interface */
result = (*(pDevice->interface))->Release (pDevice->interface);
if (kIOReturnSuccess != result)
HIDReportErrorNum ("Failed to release IOHIDDeviceInterface.", result);
pDevice->interface = NULL;
}
return result;
}
/* extracts actual specific element information from each element CF dictionary entry */
static void HIDGetElementInfo (CFTypeRef refElement, recElement *pElement)
{
long number;
CFTypeRef refType;
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementCookieKey));
if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
pElement->cookie = (IOHIDElementCookie) number;
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementMinKey));
if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
pElement->minReport = pElement->min = number;
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementMaxKey));
if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
pElement->maxReport = pElement->max = number;
/*
TODO: maybe should handle the following stuff somehow?
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementScaledMinKey));
if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
pElement->scaledMin = number;
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementScaledMaxKey));
if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
pElement->scaledMax = number;
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementSizeKey));
if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
pElement->size = number;
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsRelativeKey));
if (refType)
pElement->relative = CFBooleanGetValue (refType);
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsWrappingKey));
if (refType)
pElement->wrapping = CFBooleanGetValue (refType);
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsNonLinearKey));
if (refType)
pElement->nonLinear = CFBooleanGetValue (refType);
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementHasPreferedStateKey));
if (refType)
pElement->preferredState = CFBooleanGetValue (refType);
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementHasNullStateKey));
if (refType)
pElement->nullState = CFBooleanGetValue (refType);
*/
}
/* examines CF dictionary vlaue in device element hierarchy to determine if it is element of interest or a collection of more elements
* if element of interest allocate storage, add to list and retrieve element specific info
* if collection then pass on to deconstruction collection into additional individual elements
*/
static void HIDAddElement (CFTypeRef refElement, recDevice* pDevice)
{
recElement* element = NULL;
recElement** headElement = NULL;
long elementType, usagePage, usage;
CFTypeRef refElementType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementTypeKey));
CFTypeRef refUsagePage = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementUsagePageKey));
CFTypeRef refUsage = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementUsageKey));
if ((refElementType) && (CFNumberGetValue (refElementType, kCFNumberLongType, &elementType)))
{
/* look at types of interest */
if ((elementType == kIOHIDElementTypeInput_Misc) || (elementType == kIOHIDElementTypeInput_Button) ||
(elementType == kIOHIDElementTypeInput_Axis))
{
if (refUsagePage && CFNumberGetValue (refUsagePage, kCFNumberLongType, &usagePage) &&
refUsage && CFNumberGetValue (refUsage, kCFNumberLongType, &usage))
{
switch (usagePage) /* only interested in kHIDPage_GenericDesktop and kHIDPage_Button */
{
case kHIDPage_GenericDesktop:
{
switch (usage) /* look at usage to determine function */
{
case kHIDUsage_GD_X:
case kHIDUsage_GD_Y:
case kHIDUsage_GD_Z:
case kHIDUsage_GD_Rx:
case kHIDUsage_GD_Ry:
case kHIDUsage_GD_Rz:
case kHIDUsage_GD_Slider:
case kHIDUsage_GD_Dial:
case kHIDUsage_GD_Wheel:
element = (recElement *) NewPtrClear (sizeof (recElement));
if (element)
{
pDevice->axes++;
headElement = &(pDevice->firstAxis);
}
break;
case kHIDUsage_GD_Hatswitch:
element = (recElement *) NewPtrClear (sizeof (recElement));
if (element)
{
pDevice->hats++;
headElement = &(pDevice->firstHat);
}
break;
}
}
break;
case kHIDPage_Button:
element = (recElement *) NewPtrClear (sizeof (recElement));
if (element)
{
pDevice->buttons++;
headElement = &(pDevice->firstButton);
}
break;
default:
break;
}
}
}
else if (kIOHIDElementTypeCollection == elementType)
HIDGetCollectionElements ((CFMutableDictionaryRef) refElement, pDevice);
}
if (element && headElement) /* add to list */
{
pDevice->elements++;
if (NULL == *headElement)
*headElement = element;
else
{
recElement *elementPrevious, *elementCurrent;
elementCurrent = *headElement;
while (elementCurrent)
{
elementPrevious = elementCurrent;
elementCurrent = elementPrevious->pNext;
}
elementPrevious->pNext = element;
}
element->pNext = NULL;
HIDGetElementInfo (refElement, element);
}
}
/* collects information from each array member in device element list (each array memeber = element) */
static void HIDGetElementsCFArrayHandler (const void * value, void * parameter)
{
if (CFGetTypeID (value) == CFDictionaryGetTypeID ())
HIDAddElement ((CFTypeRef) value, (recDevice *) parameter);
}
/* handles retrieval of element information from arrays of elements in device IO registry information */
static void HIDGetElements (CFTypeRef refElementCurrent, recDevice *pDevice)
{
CFTypeID type = CFGetTypeID (refElementCurrent);
if (type == CFArrayGetTypeID()) /* if element is an array */
{
CFRange range = {0, CFArrayGetCount (refElementCurrent)};
/* CountElementsCFArrayHandler called for each array member */
CFArrayApplyFunction (refElementCurrent, range, HIDGetElementsCFArrayHandler, pDevice);
}
}
/* handles extracting element information from element collection CF types
* used from top level element decoding and hierarchy deconstruction to flatten device element list
*/
static void HIDGetCollectionElements (CFMutableDictionaryRef deviceProperties, recDevice *pDevice)
{
CFTypeRef refElementTop = CFDictionaryGetValue (deviceProperties, CFSTR(kIOHIDElementKey));
if (refElementTop)
HIDGetElements (refElementTop, pDevice);
}
/* use top level element usage page and usage to discern device usage page and usage setting appropriate vlaues in device record */
static void HIDTopLevelElementHandler (const void * value, void * parameter)
{
CFTypeRef refCF = 0;
if (CFGetTypeID (value) != CFDictionaryGetTypeID ())
return;
refCF = CFDictionaryGetValue (value, CFSTR(kIOHIDElementUsagePageKey));
if (!CFNumberGetValue (refCF, kCFNumberLongType, &((recDevice *) parameter)->usagePage))
SDL_SetError ("CFNumberGetValue error retrieving pDevice->usagePage.");
refCF = CFDictionaryGetValue (value, CFSTR(kIOHIDElementUsageKey));
if (!CFNumberGetValue (refCF, kCFNumberLongType, &((recDevice *) parameter)->usage))
SDL_SetError ("CFNumberGetValue error retrieving pDevice->usage.");
}
/* extracts device info from CF dictionary records in IO registry */
static void HIDGetDeviceInfo (io_object_t hidDevice, CFMutableDictionaryRef hidProperties, recDevice *pDevice)
{
CFMutableDictionaryRef usbProperties = 0;
io_registry_entry_t parent1, parent2;
/* Mac OS X currently is not mirroring all USB properties to HID page so need to look at USB device page also
* get dictionary for usb properties: step up two levels and get CF dictionary for USB properties
*/
if ((KERN_SUCCESS == IORegistryEntryGetParentEntry (hidDevice, kIOServicePlane, &parent1)) &&
(KERN_SUCCESS == IORegistryEntryGetParentEntry (parent1, kIOServicePlane, &parent2)) &&
(KERN_SUCCESS == IORegistryEntryCreateCFProperties (parent2, &usbProperties, kCFAllocatorDefault, kNilOptions)))
{
if (usbProperties)
{
CFTypeRef refCF = 0;
/* get device info
* try hid dictionary first, if fail then go to usb dictionary
*/
/* get product name */
refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDProductKey));
if (!refCF)
refCF = CFDictionaryGetValue (usbProperties, CFSTR("USB Product Name"));
if (refCF)
{
if (!CFStringGetCString (refCF, pDevice->product, 256, CFStringGetSystemEncoding ()))
SDL_SetError ("CFStringGetCString error retrieving pDevice->product.");
}
/* get usage page and usage */
refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDPrimaryUsagePageKey));
if (refCF)
{
if (!CFNumberGetValue (refCF, kCFNumberLongType, &pDevice->usagePage))
SDL_SetError ("CFNumberGetValue error retrieving pDevice->usagePage.");
refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDPrimaryUsageKey));
if (refCF)
if (!CFNumberGetValue (refCF, kCFNumberLongType, &pDevice->usage))
SDL_SetError ("CFNumberGetValue error retrieving pDevice->usage.");
}
if (NULL == refCF) /* get top level element HID usage page or usage */
{
/* use top level element instead */
CFTypeRef refCFTopElement = 0;
refCFTopElement = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDElementKey));
{
/* refCFTopElement points to an array of element dictionaries */
CFRange range = {0, CFArrayGetCount (refCFTopElement)};
CFArrayApplyFunction (refCFTopElement, range, HIDTopLevelElementHandler, pDevice);
}
}
CFRelease (usbProperties);
}
else
SDL_SetError ("IORegistryEntryCreateCFProperties failed to create usbProperties.");
if (kIOReturnSuccess != IOObjectRelease (parent2))
SDL_SetError ("IOObjectRelease error with parent2.");
if (kIOReturnSuccess != IOObjectRelease (parent1))
SDL_SetError ("IOObjectRelease error with parent1.");
}
}
static recDevice *HIDBuildDevice (io_object_t hidDevice)
{
recDevice *pDevice = (recDevice *) NewPtrClear (sizeof (recDevice));
if (pDevice)
{
/* get dictionary for HID properties */
CFMutableDictionaryRef hidProperties = 0;
kern_return_t result = IORegistryEntryCreateCFProperties (hidDevice, &hidProperties, kCFAllocatorDefault, kNilOptions);
if ((result == KERN_SUCCESS) && hidProperties)
{
/* create device interface */
result = HIDCreateOpenDeviceInterface (hidDevice, pDevice);
if (kIOReturnSuccess == result)
{
HIDGetDeviceInfo (hidDevice, hidProperties, pDevice); /* hidDevice used to find parents in registry tree */
HIDGetCollectionElements (hidProperties, pDevice);
}
else
{
DisposePtr((Ptr)pDevice);
pDevice = NULL;
}
CFRelease (hidProperties);
}
else
{
DisposePtr((Ptr)pDevice);
pDevice = NULL;
}
}
return pDevice;
}
/* disposes of the element list associated with a device and the memory associated with the list
*/
static void HIDDisposeElementList (recElement **elementList)
{
recElement *pElement = *elementList;
while (pElement)
{
recElement *pElementNext = pElement->pNext;
DisposePtr ((Ptr) pElement);
pElement = pElementNext;
}
*elementList = NULL;
}
/* disposes of a single device, closing and releaseing interface, freeing memory fro device and elements, setting device pointer to NULL
* all your device no longer belong to us... (i.e., you do not 'own' the device anymore)
*/
static recDevice *HIDDisposeDevice (recDevice **ppDevice)
{
kern_return_t result = KERN_SUCCESS;
recDevice *pDeviceNext = NULL;
if (*ppDevice)
{
/* save next device prior to disposing of this device */
pDeviceNext = (*ppDevice)->pNext;
/* free element lists */
HIDDisposeElementList (&(*ppDevice)->firstAxis);
HIDDisposeElementList (&(*ppDevice)->firstButton);
HIDDisposeElementList (&(*ppDevice)->firstHat);
result = HIDCloseReleaseInterface (*ppDevice); /* function sanity checks interface value (now application does not own device) */
if (kIOReturnSuccess != result)
HIDReportErrorNum ("HIDCloseReleaseInterface failed when trying to dipose device.", result);
DisposePtr ((Ptr)*ppDevice);
*ppDevice = NULL;
}
return pDeviceNext;
}
/* Function to scan the system for joysticks.
* Joystick 0 should be the system default joystick.
* This function should return the number of available joysticks, or -1
* on an unrecoverable fatal error.
*/
int SDL_SYS_JoystickInit(void)
{
IOReturn result = kIOReturnSuccess;
mach_port_t masterPort = 0;
io_iterator_t hidObjectIterator = 0;
CFMutableDictionaryRef hidMatchDictionary = NULL;
recDevice *device, *lastDevice;
io_object_t ioHIDDeviceObject = 0;
SDL_numjoysticks = 0;
if (gpDeviceList)
{
SDL_SetError("Joystick: Device list already inited.");
return -1;
}
result = IOMasterPort (bootstrap_port, &masterPort);
if (kIOReturnSuccess != result)
{
SDL_SetError("Joystick: IOMasterPort error with bootstrap_port.");
return -1;
}
/* Set up a matching dictionary to search I/O Registry by class name for all HID class devices. */
hidMatchDictionary = IOServiceMatching (kIOHIDDeviceKey);
if (hidMatchDictionary)
{
/* Add key for device type (joystick, in this case) to refine the matching dictionary. */
/* NOTE: we now perform this filtering later
UInt32 usagePage = kHIDPage_GenericDesktop;
UInt32 usage = kHIDUsage_GD_Joystick;
CFNumberRef refUsage = NULL, refUsagePage = NULL;
refUsage = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &usage);
CFDictionarySetValue (hidMatchDictionary, CFSTR (kIOHIDPrimaryUsageKey), refUsage);
refUsagePage = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &usagePage);
CFDictionarySetValue (hidMatchDictionary, CFSTR (kIOHIDPrimaryUsagePageKey), refUsagePage);
*/
}
else
{
SDL_SetError("Joystick: Failed to get HID CFMutableDictionaryRef via IOServiceMatching.");
return -1;
}
/*/ Now search I/O Registry for matching devices. */
result = IOServiceGetMatchingServices (masterPort, hidMatchDictionary, &hidObjectIterator);
/* Check for errors */
if (kIOReturnSuccess != result)
{
SDL_SetError("Joystick: Couldn't create a HID object iterator.");
return -1;
}
if (!hidObjectIterator) /* there are no joysticks */
{
gpDeviceList = NULL;
SDL_numjoysticks = 0;
return 0;
}
/* IOServiceGetMatchingServices consumes a reference to the dictionary, so we don't need to release the dictionary ref. */
/* build flat linked list of devices from device iterator */
gpDeviceList = lastDevice = NULL;
while ((ioHIDDeviceObject = IOIteratorNext (hidObjectIterator)))
{
/* build a device record */
device = HIDBuildDevice (ioHIDDeviceObject);
if (!device)
continue;
/* dump device object, it is no longer needed */
result = IOObjectRelease (ioHIDDeviceObject);
/* if (KERN_SUCCESS != result)
HIDReportErrorNum ("IOObjectRelease error with ioHIDDeviceObject.", result);
*/
/* Filter device list to non-keyboard/mouse stuff */
if ( (device->usagePage != kHIDPage_GenericDesktop) ||
((device->usage != kHIDUsage_GD_Joystick &&
device->usage != kHIDUsage_GD_GamePad &&
device->usage != kHIDUsage_GD_MultiAxisController)) ) {
/* release memory for the device */
HIDDisposeDevice (&device);
DisposePtr((Ptr)device);
continue;
}
/* Add device to the end of the list */
if (lastDevice)
lastDevice->pNext = device;
else
gpDeviceList = device;
lastDevice = device;
}
result = IOObjectRelease (hidObjectIterator); /* release the iterator */
/* Count the total number of devices we found */
device = gpDeviceList;
while (device)
{
SDL_numjoysticks++;
device = device->pNext;
}
return SDL_numjoysticks;
}
/* Function to get the device-dependent name of a joystick */
const char *SDL_SYS_JoystickName(int jindex)
{
recDevice *device = gpDeviceList;
for (; jindex > 0; jindex--)
device = device->pNext;
return device->product;
}
/* Function to open a joystick for use.
* The joystick to open is specified by the index field of the joystick.
* This should fill the nbuttons and naxes fields of the joystick structure.
* It returns 0, or -1 if there is an error.
*/
int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
{
recDevice *device = gpDeviceList;
int jindex;
for (jindex = joystick->index; jindex > 0; jindex--)
device = device->pNext;
joystick->hwdata = device;
joystick->name = device->product;
joystick->naxes = device->axes;
joystick->nhats = device->hats;
joystick->nballs = 0;
joystick->nbuttons = device->buttons;
return 0;
}
/* Function to update the state of a joystick - called as a device poll.
* This function shouldn't update the joystick structure directly,
* but instead should call SDL_PrivateJoystick*() to deliver events
* and update joystick device state.
*/
void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
{
recDevice *device = joystick->hwdata;
recElement *element;
SInt32 value, range;
int i;
if (device->removed) /* device was unplugged; ignore it. */
{
if (device->uncentered)
{
device->uncentered = 0;
/* Tell the app that everything is centered/unpressed... */
for (i = 0; i < device->axes; i++)
SDL_PrivateJoystickAxis(joystick, i, 0);
for (i = 0; i < device->buttons; i++)
SDL_PrivateJoystickButton(joystick, i, 0);
for (i = 0; i < device->hats; i++)
SDL_PrivateJoystickHat(joystick, i, SDL_HAT_CENTERED);
}
return;
}
element = device->firstAxis;
i = 0;
while (element)
{
value = HIDScaledCalibratedValue(device, element, -32768, 32767);
if ( value != joystick->axes[i] )
SDL_PrivateJoystickAxis(joystick, i, value);
element = element->pNext;
++i;
}
element = device->firstButton;
i = 0;
while (element)
{
value = HIDGetElementValue(device, element);
if (value > 1) /* handle pressure-sensitive buttons */
value = 1;
if ( value != joystick->buttons[i] )
SDL_PrivateJoystickButton(joystick, i, value);
element = element->pNext;
++i;
}
element = device->firstHat;
i = 0;
while (element)
{
Uint8 pos = 0;
range = (element->max - element->min + 1);
value = HIDGetElementValue(device, element) - element->min;
if (range == 4) /* 4 position hatswitch - scale up value */
value *= 2;
else if (range != 8) /* Neither a 4 nor 8 positions - fall back to default position (centered) */
value = -1;
switch(value)
{
case 0:
pos = SDL_HAT_UP;
break;
case 1:
pos = SDL_HAT_RIGHTUP;
break;
case 2:
pos = SDL_HAT_RIGHT;
break;
case 3:
pos = SDL_HAT_RIGHTDOWN;
break;
case 4:
pos = SDL_HAT_DOWN;
break;
case 5:
pos = SDL_HAT_LEFTDOWN;
break;
case 6:
pos = SDL_HAT_LEFT;
break;
case 7:
pos = SDL_HAT_LEFTUP;
break;
default:
/* Every other value is mapped to center. We do that because some
* joysticks use 8 and some 15 for this value, and apparently
* there are even more variants out there - so we try to be generous.
*/
pos = SDL_HAT_CENTERED;
break;
}
if ( pos != joystick->hats[i] )
SDL_PrivateJoystickHat(joystick, i, pos);
element = element->pNext;
++i;
}
return;
}
/* Function to close a joystick after use */
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
{
/* Should we do anything here? */
return;
}
/* Function to perform any system-specific joystick related cleanup */
void SDL_SYS_JoystickQuit(void)
{
while (NULL != gpDeviceList)
gpDeviceList = HIDDisposeDevice (&gpDeviceList);
}
#endif /* SDL_JOYSTICK_IOKIT */

View File

@ -1,83 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#include "SDL_config.h"
#if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED)
/* This is the system specific header for the SDL joystick API */
#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
/* Function to scan the system for joysticks.
* This function should set SDL_numjoysticks to the number of available
* joysticks. Joystick 0 should be the system default joystick.
* It should return 0, or -1 on an unrecoverable fatal error.
*/
int SDL_SYS_JoystickInit(void)
{
SDL_numjoysticks = 0;
return(0);
}
/* Function to get the device-dependent name of a joystick */
const char *SDL_SYS_JoystickName(int index)
{
SDL_SetError("Logic error: No joysticks available");
return(NULL);
}
/* Function to open a joystick for use.
The joystick to open is specified by the index field of the joystick.
This should fill the nbuttons and naxes fields of the joystick structure.
It returns 0, or -1 if there is an error.
*/
int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
{
SDL_SetError("Logic error: No joysticks available");
return(-1);
}
/* Function to update the state of a joystick - called as a device poll.
* This function shouldn't update the joystick structure directly,
* but instead should call SDL_PrivateJoystick*() to deliver events
* and update joystick device state.
*/
void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
{
return;
}
/* Function to close a joystick after use */
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
{
return;
}
/* Function to perform any system-specific joystick related cleanup */
void SDL_SYS_JoystickQuit(void)
{
return;
}
#endif /* SDL_JOYSTICK_DUMMY || SDL_JOYSTICK_DISABLED */

File diff suppressed because it is too large Load Diff

View File

@ -1,407 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 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
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifdef SDL_JOYSTICK_WINMM
/* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mmsystem.h>
#include <regstr.h>
#include "SDL_events.h"
#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
#define MAX_JOYSTICKS 16
#define MAX_AXES 6 /* each joystick can have up to 6 axes */
#define MAX_BUTTONS 32 /* and 32 buttons */
#define AXIS_MIN -32768 /* minimum value for axis coordinate */
#define AXIS_MAX 32767 /* maximum value for axis coordinate */
/* limit axis to 256 possible positions to filter out noise */
#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/256)
#define JOY_BUTTON_FLAG(n) (1<<n)
/* array to hold joystick ID values */
static UINT SYS_JoystickID[MAX_JOYSTICKS];
static JOYCAPS SYS_Joystick[MAX_JOYSTICKS];
static char *SYS_JoystickName[MAX_JOYSTICKS];
/* The private structure used to keep track of a joystick */
struct joystick_hwdata
{
/* joystick ID */
UINT id;
/* values used to translate device-specific coordinates into
SDL-standard ranges */
struct _transaxis {
int offset;
float scale;
} transaxis[6];
};
/* Convert a win32 Multimedia API return code to a text message */
static void SetMMerror(char *function, int code);
static char *GetJoystickName(int index, const char *szRegKey)
{
/* added 7/24/2004 by Eckhard Stolberg */
/*
see if there is a joystick for the current
index (1-16) listed in the registry
*/
char *name = NULL;
HKEY hTopKey;
HKEY hKey;
DWORD regsize;
LONG regresult;
char regkey[256];
char regvalue[256];
char regname[256];
SDL_snprintf(regkey, SDL_arraysize(regkey), "%s\\%s\\%s",
REGSTR_PATH_JOYCONFIG, szRegKey, REGSTR_KEY_JOYCURR);
hTopKey = HKEY_LOCAL_MACHINE;
regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
if (regresult != ERROR_SUCCESS) {
hTopKey = HKEY_CURRENT_USER;
regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
}
if (regresult != ERROR_SUCCESS) {
return NULL;
}
/* find the registry key name for the joystick's properties */
regsize = sizeof(regname);
SDL_snprintf(regvalue, SDL_arraysize(regvalue), "Joystick%d%s", index+1, REGSTR_VAL_JOYOEMNAME);
regresult = RegQueryValueExA(hKey, regvalue, 0, 0, (LPBYTE)regname, &regsize);
RegCloseKey(hKey);
if (regresult != ERROR_SUCCESS) {
return NULL;
}
/* open that registry key */
SDL_snprintf(regkey, SDL_arraysize(regkey), "%s\\%s", REGSTR_PATH_JOYOEM, regname);
regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
if (regresult != ERROR_SUCCESS) {
return NULL;
}
/* find the size for the OEM name text */
regsize = sizeof(regvalue);
regresult = RegQueryValueExA(hKey, REGSTR_VAL_JOYOEMNAME, 0, 0, NULL, &regsize);
if (regresult == ERROR_SUCCESS) {
/* allocate enough memory for the OEM name text ... */
name = (char *) SDL_malloc(regsize);
if ( name ) {
/* ... and read it from the registry */
regresult = RegQueryValueExA(hKey,
REGSTR_VAL_JOYOEMNAME, 0, 0,
(LPBYTE) name, &regsize);
}
}
RegCloseKey(hKey);
return(name);
}
/* Function to scan the system for joysticks.
* This function should set SDL_numjoysticks to the number of available
* joysticks. Joystick 0 should be the system default joystick.
* It should return 0, or -1 on an unrecoverable fatal error.
*/
int SDL_SYS_JoystickInit(void)
{
int i;
int maxdevs;
int numdevs;
JOYINFOEX joyinfo;
JOYCAPS joycaps;
MMRESULT result;
/* Reset the joystick ID & name mapping tables */
for ( i = 0; i < MAX_JOYSTICKS; ++i ) {
SYS_JoystickID[i] = 0;
SYS_JoystickName[i] = NULL;
}
/* Loop over all potential joystick devices */
numdevs = 0;
maxdevs = joyGetNumDevs();
for ( i = JOYSTICKID1; i < maxdevs && numdevs < MAX_JOYSTICKS; ++i ) {
joyinfo.dwSize = sizeof(joyinfo);
joyinfo.dwFlags = JOY_RETURNALL;
result = joyGetPosEx(i, &joyinfo);
if ( result == JOYERR_NOERROR ) {
result = joyGetDevCaps(i, &joycaps, sizeof(joycaps));
if ( result == JOYERR_NOERROR ) {
SYS_JoystickID[numdevs] = i;
SYS_Joystick[numdevs] = joycaps;
SYS_JoystickName[numdevs] = GetJoystickName(i, joycaps.szRegKey);
numdevs++;
}
}
}
return(numdevs);
}
/* Function to get the device-dependent name of a joystick */
const char *SDL_SYS_JoystickName(int index)
{
if ( SYS_JoystickName[index] != NULL ) {
return(SYS_JoystickName[index]);
} else {
return(SYS_Joystick[index].szPname);
}
}
/* Function to open a joystick for use.
The joystick to open is specified by the index field of the joystick.
This should fill the nbuttons and naxes fields of the joystick structure.
It returns 0, or -1 if there is an error.
*/
int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
{
int index, i;
int caps_flags[MAX_AXES-2] =
{ JOYCAPS_HASZ, JOYCAPS_HASR, JOYCAPS_HASU, JOYCAPS_HASV };
int axis_min[MAX_AXES], axis_max[MAX_AXES];
/* shortcut */
index = joystick->index;
axis_min[0] = SYS_Joystick[index].wXmin;
axis_max[0] = SYS_Joystick[index].wXmax;
axis_min[1] = SYS_Joystick[index].wYmin;
axis_max[1] = SYS_Joystick[index].wYmax;
axis_min[2] = SYS_Joystick[index].wZmin;
axis_max[2] = SYS_Joystick[index].wZmax;
axis_min[3] = SYS_Joystick[index].wRmin;
axis_max[3] = SYS_Joystick[index].wRmax;
axis_min[4] = SYS_Joystick[index].wUmin;
axis_max[4] = SYS_Joystick[index].wUmax;
axis_min[5] = SYS_Joystick[index].wVmin;
axis_max[5] = SYS_Joystick[index].wVmax;
/* allocate memory for system specific hardware data */
joystick->hwdata = (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata));
if (joystick->hwdata == NULL)
{
SDL_OutOfMemory();
return(-1);
}
SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
/* set hardware data */
joystick->hwdata->id = SYS_JoystickID[index];
for ( i = 0; i < MAX_AXES; ++i ) {
if ( (i<2) || (SYS_Joystick[index].wCaps & caps_flags[i-2]) ) {
joystick->hwdata->transaxis[i].offset =
AXIS_MIN - axis_min[i];
joystick->hwdata->transaxis[i].scale =
(float)(AXIS_MAX - AXIS_MIN) / (axis_max[i] - axis_min[i]);
} else {
joystick->hwdata->transaxis[i].offset = 0;
joystick->hwdata->transaxis[i].scale = 1.0; /* Just in case */
}
}
/* fill nbuttons, naxes, and nhats fields */
joystick->nbuttons = SYS_Joystick[index].wNumButtons;
joystick->naxes = SYS_Joystick[index].wNumAxes;
if ( SYS_Joystick[index].wCaps & JOYCAPS_HASPOV ) {
joystick->nhats = 1;
} else {
joystick->nhats = 0;
}
return(0);
}
static Uint8 TranslatePOV(DWORD value)
{
Uint8 pos;
pos = SDL_HAT_CENTERED;
if ( value != JOY_POVCENTERED ) {
if ( (value > JOY_POVLEFT) || (value < JOY_POVRIGHT) ) {
pos |= SDL_HAT_UP;
}
if ( (value > JOY_POVFORWARD) && (value < JOY_POVBACKWARD) ) {
pos |= SDL_HAT_RIGHT;
}
if ( (value > JOY_POVRIGHT) && (value < JOY_POVLEFT) ) {
pos |= SDL_HAT_DOWN;
}
if ( value > JOY_POVBACKWARD ) {
pos |= SDL_HAT_LEFT;
}
}
return(pos);
}
/* Function to update the state of a joystick - called as a device poll.
* This function shouldn't update the joystick structure directly,
* but instead should call SDL_PrivateJoystick*() to deliver events
* and update joystick device state.
*/
void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
{
MMRESULT result;
int i;
DWORD flags[MAX_AXES] = { JOY_RETURNX, JOY_RETURNY, JOY_RETURNZ,
JOY_RETURNR, JOY_RETURNU, JOY_RETURNV };
DWORD pos[MAX_AXES];
struct _transaxis *transaxis;
int value, change;
JOYINFOEX joyinfo;
joyinfo.dwSize = sizeof(joyinfo);
joyinfo.dwFlags = JOY_RETURNALL|JOY_RETURNPOVCTS;
if ( ! joystick->hats ) {
joyinfo.dwFlags &= ~(JOY_RETURNPOV|JOY_RETURNPOVCTS);
}
result = joyGetPosEx(joystick->hwdata->id, &joyinfo);
if ( result != JOYERR_NOERROR ) {
SetMMerror("joyGetPosEx", result);
return;
}
/* joystick motion events */
pos[0] = joyinfo.dwXpos;
pos[1] = joyinfo.dwYpos;
pos[2] = joyinfo.dwZpos;
pos[3] = joyinfo.dwRpos;
pos[4] = joyinfo.dwUpos;
pos[5] = joyinfo.dwVpos;
transaxis = joystick->hwdata->transaxis;
for (i = 0; i < joystick->naxes; i++) {
if (joyinfo.dwFlags & flags[i]) {
value = (int)(((float)pos[i] + transaxis[i].offset) * transaxis[i].scale);
change = (value - joystick->axes[i]);
if ( (change < -JOY_AXIS_THRESHOLD) || (change > JOY_AXIS_THRESHOLD) ) {
SDL_PrivateJoystickAxis(joystick, (Uint8)i, (Sint16)value);
}
}
}
/* joystick button events */
if ( joyinfo.dwFlags & JOY_RETURNBUTTONS ) {
for ( i = 0; i < joystick->nbuttons; ++i ) {
if ( joyinfo.dwButtons & JOY_BUTTON_FLAG(i) ) {
if ( ! joystick->buttons[i] ) {
SDL_PrivateJoystickButton(joystick, (Uint8)i, SDL_PRESSED);
}
} else {
if ( joystick->buttons[i] ) {
SDL_PrivateJoystickButton(joystick, (Uint8)i, SDL_RELEASED);
}
}
}
}
/* joystick hat events */
if ( joyinfo.dwFlags & JOY_RETURNPOV ) {
Uint8 pos;
pos = TranslatePOV(joyinfo.dwPOV);
if ( pos != joystick->hats[0] ) {
SDL_PrivateJoystickHat(joystick, 0, pos);
}
}
}
/* Function to close a joystick after use */
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
{
if (joystick->hwdata != NULL) {
/* free system specific hardware data */
SDL_free(joystick->hwdata);
joystick->hwdata = NULL;
}
}
/* Function to perform any system-specific joystick related cleanup */
void SDL_SYS_JoystickQuit(void)
{
int i;
for (i = 0; i < MAX_JOYSTICKS; i++) {
if ( SYS_JoystickName[i] != NULL ) {
SDL_free(SYS_JoystickName[i]);
SYS_JoystickName[i] = NULL;
}
}
}
/* implementation functions */
void SetMMerror(char *function, int code)
{
static char *error;
static char errbuf[1024];
errbuf[0] = 0;
switch (code)
{
case MMSYSERR_NODRIVER:
error = "Joystick driver not present";
break;
case MMSYSERR_INVALPARAM:
case JOYERR_PARMS:
error = "Invalid parameter(s)";
break;
case MMSYSERR_BADDEVICEID:
error = "Bad device ID";
break;
case JOYERR_UNPLUGGED:
error = "Joystick not attached";
break;
case JOYERR_NOCANDO:
error = "Can't capture joystick input";
break;
default:
SDL_snprintf(errbuf, SDL_arraysize(errbuf),
"%s: Unknown Multimedia system error: 0x%x",
function, code);
break;
}
if ( ! errbuf[0] ) {
SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error);
}
SDL_SetError("%s", errbuf);
}
#endif /* SDL_JOYSTICK_WINMM */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +0,0 @@
Bugs are now managed in the SDL bug tracker, here:
http://bugzilla.libsdl.org/
You may report bugs there, and search to see if a given issue has already
been reported, discussed, and maybe even fixed.
You may also find help on the SDL mailing list. Subscription information:
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
bugs discussed on the mailing list may be forgotten or missed.

View File

@ -1,20 +0,0 @@
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

View File

@ -1,13 +0,0 @@
Please distribute this file with the SDL runtime environment:
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
designed to make it easy to write multi-media software, such as games and
emulators.
The Simple DirectMedia Layer library source code is available from:
http://www.libsdl.org/
This library is distributed under the terms of the zlib license:
http://www.zlib.net/zlib_license.html

View File

@ -1,38 +0,0 @@
Simple DirectMedia Layer
(SDL)
Version 2.0
---
http://www.libsdl.org/
Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games.
SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
Support for other platforms may be found in the source code.
SDL is written in C, works natively with C++, and there are bindings
available for several other languages, including C# and Python.
This library is distributed under the zlib license, which can be found
in the file "COPYING.txt".
The best way to learn how to use SDL is to check out the header files in
the "include" subdirectory and the programs in the "test" subdirectory.
The header files and test programs are well commented and always up to date.
More documentation and FAQs are available online at:
http://wiki.libsdl.org/
If you need help with the library, or just want to discuss SDL related
issues, you can join the developers mailing list:
http://www.libsdl.org/mailing-list.php
Enjoy!
Sam Lantinga (slouken@libsdl.org)

View File

@ -1,57 +0,0 @@
This is a list of major changes in SDL's version history.
---------------------------------------------------------------------------
2.0.1:
---------------------------------------------------------------------------
General:
* Added an API to get common filesystem paths in SDL_filesystem.h:
SDL_GetBasePath(), SDL_GetPrefPath()
* Added an API to do optimized YV12 and IYUV texture updates:
SDL_UpdateYUVTexture()
* Added an API to get the amount of RAM on the system:
SDL_GetSystemRAM()
* Added a macro to perform timestamp comparisons with SDL_GetTicks():
SDL_TICKS_PASSED()
* Dramatically improved OpenGL ES 2.0 rendering performance
* Added OpenGL attribute SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
Windows:
* Created a static library configuration for the Visual Studio 2010 project
* Added a hint to create the Direct3D device with support for multi-threading:
SDL_HINT_RENDER_DIRECT3D_THREADSAFE
* Added a function to get the D3D9 adapter index for a display:
SDL_Direct3D9GetAdapterIndex()
* Added a function to get the D3D9 device for a D3D9 renderer:
SDL_RenderGetD3D9Device()
* Fixed building SDL with the mingw32 toolchain (mingw-w64 is preferred)
* Fixed crash when using two XInput controllers at the same time
* Fixed detecting a mixture of XInput and DirectInput controllers
* Fixed clearing a D3D render target larger than the window
* Improved support for format specifiers in SDL_snprintf()
Mac OS X:
* Added support for retina displays:
Create your window with the SDL_WINDOW_ALLOW_HIGHDPI flag, and then use SDL_GL_GetDrawableSize() to find the actual drawable size. You are responsible for scaling mouse and drawing coordinates appropriately.
* Fixed mouse warping in fullscreen mode
* Right mouse click is emulated by holding the Ctrl key while left clicking
Linux:
* Fixed float audio support with the PulseAudio driver
* Fixed missing line endpoints in the OpenGL renderer on some drivers
* X11 symbols are no longer defined to avoid collisions when linking statically
iOS:
* Fixed status bar visibility on iOS 7
* Flipped the accelerometer Y axis to match expected values
Android:
IMPORTANT: You MUST get the updated SDLActivity.java to match C code
* Moved EGL initialization to native code
* Fixed the accelerometer axis rotation relative to the device rotation
* Fixed race conditions when handling the EGL context on pause/resume
* Touch devices are available for enumeration immediately after init
Raspberry Pi:
* Added support for the Raspberry Pi, see README-raspberrypi.txt for details

View File

@ -1,163 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL.h
*
* Main include header for the SDL library
*/
/**
* \mainpage Simple DirectMedia Layer (SDL)
*
* http://www.libsdl.org/
*
* \section intro_sec Introduction
*
* Simple DirectMedia Layer is a cross-platform development library designed
* to provide low level access to audio, keyboard, mouse, joystick, and
* graphics hardware via OpenGL and Direct3D. It is used by video playback
* software, emulators, and popular games including Valve's award winning
* catalog and many Humble Bundle games.
*
* SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
* Support for other platforms may be found in the source code.
*
* SDL is written in C, works natively with C++, and there are bindings
* available for several other languages, including C# and Python.
*
* This library is distributed under the zlib license, which can be found
* in the file "COPYING.txt".
*
* The best way to learn how to use SDL is to check out the header files in
* the "include" subdirectory and the programs in the "test" subdirectory.
* The header files and test programs are well commented and always up to date.
* More documentation and FAQs are available online at:
* http://wiki.libsdl.org/
*
* If you need help with the library, or just want to discuss SDL related
* issues, you can join the developers mailing list:
* http://www.libsdl.org/mailing-list.php
*
* Enjoy!
* Sam Lantinga (slouken@libsdl.org)
*/
#ifndef _SDL_H
#define _SDL_H
#include "SDL_main.h"
#include "SDL_stdinc.h"
#include "SDL_assert.h"
#include "SDL_atomic.h"
#include "SDL_audio.h"
#include "SDL_clipboard.h"
#include "SDL_cpuinfo.h"
#include "SDL_endian.h"
#include "SDL_error.h"
#include "SDL_events.h"
#include "SDL_filesystem.h"
#include "SDL_joystick.h"
#include "SDL_gamecontroller.h"
#include "SDL_haptic.h"
#include "SDL_hints.h"
#include "SDL_loadso.h"
#include "SDL_log.h"
#include "SDL_messagebox.h"
#include "SDL_mutex.h"
#include "SDL_power.h"
#include "SDL_render.h"
#include "SDL_rwops.h"
#include "SDL_system.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
#include "SDL_version.h"
#include "SDL_video.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* As of version 0.5, SDL is loaded dynamically into the application */
/**
* \name SDL_INIT_*
*
* These are the flags which may be passed to SDL_Init(). You should
* specify the subsystems which you will be using in your application.
*/
/* @{ */
#define SDL_INIT_TIMER 0x00000001
#define SDL_INIT_AUDIO 0x00000010
#define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
#define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
#define SDL_INIT_HAPTIC 0x00001000
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
#define SDL_INIT_EVERYTHING ( \
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
)
/* @} */
/**
* This function initializes the subsystems specified by \c flags
* Unless the ::SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
* signal handlers for some commonly ignored fatal signals (like SIGSEGV).
*/
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
/**
* This function initializes specific SDL subsystems
*/
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
/**
* This function cleans up specific SDL subsystems
*/
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
/**
* This function returns a mask of the specified subsystems which have
* previously been initialized.
*
* If \c flags is 0, it returns a mask of all initialized subsystems.
*/
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
/**
* This function cleans up all initialized subsystems. You should
* call it upon all exit conditions.
*/
extern DECLSPEC void SDLCALL SDL_Quit(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_H */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,246 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _SDL_assert_h
#define _SDL_assert_h
#include "SDL_config.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SDL_ASSERT_LEVEL
#ifdef SDL_DEFAULT_ASSERT_LEVEL
#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
#elif defined(_DEBUG) || defined(DEBUG) || \
(defined(__GNUC__) && !defined(__OPTIMIZE__))
#define SDL_ASSERT_LEVEL 2
#else
#define SDL_ASSERT_LEVEL 1
#endif
#endif /* SDL_ASSERT_LEVEL */
/*
These are macros and not first class functions so that the debugger breaks
on the assertion line and not in some random guts of SDL, and so each
assert can have unique static variables associated with it.
*/
#if defined(_MSC_VER)
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
#elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif defined(HAVE_SIGNAL_H)
#include <signal.h>
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
/* How do we trigger breakpoints on this platform? */
#define SDL_TriggerBreakpoint()
#endif
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
# define SDL_FUNCTION __func__
#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
# define SDL_FUNCTION __FUNCTION__
#else
# define SDL_FUNCTION "???"
#endif
#define SDL_FILE __FILE__
#define SDL_LINE __LINE__
/*
sizeof (x) makes the compiler still parse the expression even without
assertions enabled, so the code is always checked at compile time, but
doesn't actually generate code for it, so there are no side effects or
expensive checks at run time, just the constant size of what x WOULD be,
which presumably gets optimized out as unused.
This also solves the problem of...
int somevalue = blah();
SDL_assert(somevalue == 1);
...which would cause compiles to complain that somevalue is unused if we
disable assertions.
*/
#ifdef _MSC_VER /* stupid /W4 warnings. */
#define SDL_NULL_WHILE_LOOP_CONDITION (-1 == __LINE__)
#else
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
#endif
#define SDL_disabled_assert(condition) \
do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
typedef enum
{
SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
SDL_ASSERTION_ABORT, /**< Terminate the program. */
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
} SDL_assert_state;
typedef struct SDL_assert_data
{
int always_ignore;
unsigned int trigger_count;
const char *condition;
const char *filename;
int linenum;
const char *function;
const struct SDL_assert_data *next;
} SDL_assert_data;
#if (SDL_ASSERT_LEVEL > 0)
/* Never call this directly. Use the SDL_assert* macros. */
extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *,
const char *,
const char *, int);
/* the do {} while(0) avoids dangling else problems:
if (x) SDL_assert(y); else blah();
... without the do/while, the "else" could attach to this macro's "if".
We try to handle just the minimum we need here in a macro...the loop,
the static vars, and break points. The heavy lifting is handled in
SDL_ReportAssertion(), in SDL_assert.c.
*/
#define SDL_enabled_assert(condition) \
do { \
while ( !(condition) ) { \
static struct SDL_assert_data assert_data = { \
0, 0, #condition, 0, 0, 0, 0 \
}; \
const SDL_assert_state state = SDL_ReportAssertion(&assert_data, \
SDL_FUNCTION, \
SDL_FILE, \
SDL_LINE); \
if (state == SDL_ASSERTION_RETRY) { \
continue; /* go again. */ \
} else if (state == SDL_ASSERTION_BREAK) { \
SDL_TriggerBreakpoint(); \
} \
break; /* not retrying. */ \
} \
} while (SDL_NULL_WHILE_LOOP_CONDITION)
#endif /* enabled assertions support code */
/* Enable various levels of assertions. */
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
# define SDL_assert(condition) SDL_disabled_assert(condition)
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
# define SDL_assert(condition) SDL_disabled_assert(condition)
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
# define SDL_assert(condition) SDL_enabled_assert(condition)
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
# define SDL_assert(condition) SDL_enabled_assert(condition)
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
#else
# error Unknown assertion level.
#endif
/* this assertion is never disabled at any level. */
#define SDL_assert_always(condition) SDL_enabled_assert(condition)
typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)(
const SDL_assert_data* data, void* userdata);
/**
* \brief Set an application-defined assertion handler.
*
* This allows an app to show its own assertion UI and/or force the
* response to an assertion failure. If the app doesn't provide this, SDL
* will try to do the right thing, popping up a system-specific GUI dialog,
* and probably minimizing any fullscreen windows.
*
* This callback may fire from any thread, but it runs wrapped in a mutex, so
* it will only fire from one thread at a time.
*
* Setting the callback to NULL restores SDL's original internal handler.
*
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
*
* \return SDL_assert_state value of how to handle the assertion failure.
*
* \param handler Callback function, called when an assertion fails.
* \param userdata A pointer passed to the callback as-is.
*/
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
SDL_AssertionHandler handler,
void *userdata);
/**
* \brief Get a list of all assertion failures.
*
* Get all assertions triggered since last call to SDL_ResetAssertionReport(),
* or the start of the program.
*
* The proper way to examine this data looks something like this:
*
* <code>
* const SDL_assert_data *item = SDL_GetAssertionReport();
* while (item) {
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
* item->condition, item->function, item->filename,
* item->linenum, item->trigger_count,
* item->always_ignore ? "yes" : "no");
* item = item->next;
* }
* </code>
*
* \return List of all assertions.
* \sa SDL_ResetAssertionReport
*/
extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void);
/**
* \brief Reset the list of all assertion failures.
*
* Reset list of all assertions triggered.
*
* \sa SDL_GetAssertionReport
*/
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_assert_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,359 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_atomic.h
*
* Atomic operations.
*
* IMPORTANT:
* If you are not an expert in concurrent lockless programming, you should
* only be using the atomic lock and reference counting functions in this
* file. In all other cases you should be protecting your data structures
* with full mutexes.
*
* The list of "safe" functions to use are:
* SDL_AtomicLock()
* SDL_AtomicUnlock()
* SDL_AtomicIncRef()
* SDL_AtomicDecRef()
*
* Seriously, here be dragons!
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* You can find out a little more about lockless programming and the
* subtle issues that can arise here:
* http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
*
* There's also lots of good information here:
* http://www.1024cores.net/home/lock-free-algorithms
* http://preshing.com/
*
* These operations may or may not actually be implemented using
* processor specific atomic operations. When possible they are
* implemented as true processor specific atomic operations. When that
* is not possible the are implemented using locks that *do* use the
* available atomic operations.
*
* All of the atomic operations that modify memory are full memory barriers.
*/
#ifndef _SDL_atomic_h_
#define _SDL_atomic_h_
#include "SDL_stdinc.h"
#include "SDL_platform.h"
#include "begin_code.h"
/* Need to do this here because intrin.h has C++ code in it */
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
#include <intrin.h>
#define HAVE_MSC_ATOMICS 1
#endif
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \name SDL AtomicLock
*
* The atomic locks are efficient spinlocks using CPU instructions,
* but are vulnerable to starvation and can spin forever if a thread
* holding a lock has been terminated. For this reason you should
* minimize the code executed inside an atomic lock and never do
* expensive things like API or system calls while holding them.
*
* The atomic locks are not safe to lock recursively.
*
* Porting Note:
* The spin lock functions and type are required and can not be
* emulated because they are used in the atomic emulation code.
*/
/* @{ */
typedef int SDL_SpinLock;
/**
* \brief Try to lock a spin lock by setting it to a non-zero value.
*
* \param lock Points to the lock.
*
* \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
/**
* \brief Lock a spin lock by setting it to a non-zero value.
*
* \param lock Points to the lock.
*/
extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
/**
* \brief Unlock a spin lock by setting it to 0. Always returns immediately
*
* \param lock Points to the lock.
*/
extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
/* @} *//* SDL AtomicLock */
/**
* The compiler barrier prevents the compiler from reordering
* reads and writes to globally visible variables across the call.
*/
#if defined(_MSC_VER) && (_MSC_VER > 1200)
void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier()
#elif defined(__GNUC__)
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
#else
#define SDL_CompilerBarrier() \
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
#endif
/**
* Memory barriers are designed to prevent reads and writes from being
* reordered by the compiler and being seen out of order on multi-core CPUs.
*
* A typical pattern would be for thread A to write some data and a flag,
* and for thread B to read the flag and get the data. In this case you
* would insert a release barrier between writing the data and the flag,
* guaranteeing that the data write completes no later than the flag is
* written, and you would insert an acquire barrier between reading the
* flag and reading the data, to ensure that all the reads associated
* with the flag have completed.
*
* In this pattern you should always see a release barrier paired with
* an acquire barrier and you should gate the data reads/writes with a
* single flag variable.
*
* For more information on these semantics, take a look at the blog post:
* http://preshing.com/20120913/acquire-and-release-semantics
*/
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
#elif defined(__GNUC__) && defined(__arm__)
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
#ifdef __thumb__
/* The mcr instruction isn't available in thumb mode, use real functions */
extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
#endif /* __thumb__ */
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
#endif /* __GNUC__ && __arm__ */
#else
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
#endif
/* Platform specific optimized versions of the atomic functions,
* you can disable these by defining SDL_DISABLE_ATOMIC_INLINE
*/
#if defined(SDL_ATOMIC_DISABLED) && SDL_ATOMIC_DISABLED
#define SDL_DISABLE_ATOMIC_INLINE
#endif
#ifndef SDL_DISABLE_ATOMIC_INLINE
#ifdef HAVE_MSC_ATOMICS
#define SDL_AtomicSet(a, v) _InterlockedExchange((long*)&(a)->value, (v))
#define SDL_AtomicAdd(a, v) _InterlockedExchangeAdd((long*)&(a)->value, (v))
#define SDL_AtomicCAS(a, oldval, newval) (_InterlockedCompareExchange((long*)&(a)->value, (newval), (oldval)) == (oldval))
#define SDL_AtomicSetPtr(a, v) _InterlockedExchangePointer((a), (v))
#if _M_IX86
#define SDL_AtomicCASPtr(a, oldval, newval) (_InterlockedCompareExchange((long*)(a), (long)(newval), (long)(oldval)) == (long)(oldval))
#else
#define SDL_AtomicCASPtr(a, oldval, newval) (_InterlockedCompareExchangePointer((a), (newval), (oldval)) == (oldval))
#endif
#elif defined(__MACOSX__)
#include <libkern/OSAtomic.h>
#define SDL_AtomicCAS(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((oldval), (newval), &(a)->value)
#ifdef __LP64__
#define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap64Barrier((int64_t)(oldval), (int64_t)(newval), (int64_t*)(a))
#else
#define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((int32_t)(oldval), (int32_t)(newval), (int32_t*)(a))
#endif
#elif defined(HAVE_GCC_ATOMICS)
#define SDL_AtomicSet(a, v) __sync_lock_test_and_set(&(a)->value, v)
#define SDL_AtomicAdd(a, v) __sync_fetch_and_add(&(a)->value, v)
#define SDL_AtomicSetPtr(a, v) __sync_lock_test_and_set(a, v)
#define SDL_AtomicCAS(a, oldval, newval) __sync_bool_compare_and_swap(&(a)->value, oldval, newval)
#define SDL_AtomicCASPtr(a, oldval, newval) __sync_bool_compare_and_swap(a, oldval, newval)
#endif
#endif /* !SDL_DISABLE_ATOMIC_INLINE */
/**
* \brief A type representing an atomic integer value. It is a struct
* so people don't accidentally use numeric operations on it.
*/
#ifndef SDL_atomic_t_defined
typedef struct { int value; } SDL_atomic_t;
#endif
/**
* \brief Set an atomic variable to a new value if it is currently an old value.
*
* \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
*
* \note If you don't know what this function is for, you shouldn't use it!
*/
#ifndef SDL_AtomicCAS
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
#endif
/**
* \brief Set an atomic variable to a value.
*
* \return The previous value of the atomic variable.
*/
#ifndef SDL_AtomicSet
SDL_FORCE_INLINE int SDL_AtomicSet(SDL_atomic_t *a, int v)
{
int value;
do {
value = a->value;
} while (!SDL_AtomicCAS(a, value, v));
return value;
}
#endif
/**
* \brief Get the value of an atomic variable
*/
#ifndef SDL_AtomicGet
SDL_FORCE_INLINE int SDL_AtomicGet(SDL_atomic_t *a)
{
int value = a->value;
SDL_CompilerBarrier();
return value;
}
#endif
/**
* \brief Add to an atomic variable.
*
* \return The previous value of the atomic variable.
*
* \note This same style can be used for any number operation
*/
#ifndef SDL_AtomicAdd
SDL_FORCE_INLINE int SDL_AtomicAdd(SDL_atomic_t *a, int v)
{
int value;
do {
value = a->value;
} while (!SDL_AtomicCAS(a, value, (value + v)));
return value;
}
#endif
/**
* \brief Increment an atomic variable used as a reference count.
*/
#ifndef SDL_AtomicIncRef
#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
#endif
/**
* \brief Decrement an atomic variable used as a reference count.
*
* \return SDL_TRUE if the variable reached zero after decrementing,
* SDL_FALSE otherwise
*/
#ifndef SDL_AtomicDecRef
#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
#endif
/**
* \brief Set a pointer to a new value if it is currently an old value.
*
* \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
*
* \note If you don't know what this function is for, you shouldn't use it!
*/
#ifndef SDL_AtomicCASPtr
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void* *a, void *oldval, void *newval);
#endif
/**
* \brief Set a pointer to a value atomically.
*
* \return The previous value of the pointer.
*/
#ifndef SDL_AtomicSetPtr
SDL_FORCE_INLINE void* SDL_AtomicSetPtr(void* *a, void* v)
{
void* value;
do {
value = *a;
} while (!SDL_AtomicCASPtr(a, value, v));
return value;
}
#endif
/**
* \brief Get the value of a pointer atomically.
*/
#ifndef SDL_AtomicGetPtr
SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a)
{
void* value = *a;
SDL_CompilerBarrier();
return value;
}
#endif
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_atomic_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,506 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_audio.h
*
* 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
/**
* \brief Audio format flags.
*
* These are what the 16 bits in SDL_AudioFormat currently mean...
* (Unspecified bits are always zero).
*
* \verbatim
++-----------------------sample is signed if set
||
|| ++-----------sample is bigendian if set
|| ||
|| || ++---sample is float if set
|| || ||
|| || || +---sample bit size---+
|| || || | |
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
\endverbatim
*
* There are macros in SDL 2.0 and later to query these bits.
*/
typedef Uint16 SDL_AudioFormat;
/**
* \name Audio flags
*/
/* @{ */
#define SDL_AUDIO_MASK_BITSIZE (0xFF)
#define SDL_AUDIO_MASK_DATATYPE (1<<8)
#define SDL_AUDIO_MASK_ENDIAN (1<<12)
#define SDL_AUDIO_MASK_SIGNED (1<<15)
#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE)
#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE)
#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN)
#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED)
#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
/**
* \name 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
/* @} */
/**
* \name int32 support
*/
/* @{ */
#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
#define AUDIO_S32 AUDIO_S32LSB
/* @} */
/**
* \name float32 support
*/
/* @{ */
#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
#define AUDIO_F32 AUDIO_F32LSB
/* @} */
/**
* \name Native audio byte ordering
*/
/* @{ */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define AUDIO_U16SYS AUDIO_U16LSB
#define AUDIO_S16SYS AUDIO_S16LSB
#define AUDIO_S32SYS AUDIO_S32LSB
#define AUDIO_F32SYS AUDIO_F32LSB
#else
#define AUDIO_U16SYS AUDIO_U16MSB
#define AUDIO_S16SYS AUDIO_S16MSB
#define AUDIO_S32SYS AUDIO_S32MSB
#define AUDIO_F32SYS AUDIO_F32MSB
#endif
/* @} */
/**
* \name Allow change flags
*
* Which audio format changes are allowed when opening a device.
*/
/* @{ */
#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
/* @} */
/* @} *//* Audio flags */
/**
* This function is called when the audio device needs more data.
*
* \param userdata An application-specific parameter saved in
* the SDL_AudioSpec structure
* \param stream A pointer to the audio data buffer.
* \param len 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.
*/
typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
int len);
/**
* The calculated values in this structure are calculated by SDL_OpenAudio().
*/
typedef struct SDL_AudioSpec
{
int freq; /**< DSP frequency -- samples per second */
SDL_AudioFormat 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) */
SDL_AudioCallback callback;
void *userdata;
} SDL_AudioSpec;
struct SDL_AudioCVT;
typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
SDL_AudioFormat format);
/**
* A structure to hold a set of audio conversion filters and buffers.
*/
#ifdef __GNUC__
/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
pad it out to 88 bytes to guarantee ABI compatibility between compilers.
vvv
The next time we rev the ABI, make sure to size the ints and add padding.
*/
#define SDL_AUDIOCVT_PACKED __attribute__((packed))
#else
#define SDL_AUDIOCVT_PACKED
#endif
/* */
typedef struct SDL_AudioCVT
{
int needed; /**< Set to 1 if conversion possible */
SDL_AudioFormat src_format; /**< Source audio format */
SDL_AudioFormat 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 */
SDL_AudioFilter filters[10]; /**< Filter list */
int filter_index; /**< Current audio conversion function */
} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
/* Function prototypes */
/**
* \name Driver discovery functions
*
* These functions return the list of built in audio drivers, in the
* order that they are normally initialized by default.
*/
/* @{ */
extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
/* @} */
/**
* \name Initialization and cleanup
*
* \internal 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 returns the name of the current audio driver, or NULL
* if no driver has been initialized.
*/
extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
/**
* 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 \c obtained. If \c 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,
* - \c desired->freq should be the desired audio frequency in samples-per-
* second.
* - \c desired->format should be the desired audio format.
* - \c 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: \code ms = (samples*1000)/freq \endcode
* - \c desired->size is the size in bytes of the audio buffer, and is
* calculated by SDL_OpenAudio().
* - \c desired->silence is the value used to set the buffer to silence,
* and is calculated by SDL_OpenAudio().
* - \c 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.
* - \c 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 \c 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);
/**
* SDL Audio Device IDs.
*
* A successful call to SDL_OpenAudio() is always device id 1, and legacy
* SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
* always returns devices >= 2 on success. The legacy calls are good both
* for backwards compatibility and when you don't care about multiple,
* specific, or capture devices.
*/
typedef Uint32 SDL_AudioDeviceID;
/**
* Get the number of available devices exposed by the current driver.
* Only valid after a successfully initializing the audio subsystem.
* Returns -1 if an explicit list of devices can't be determined; this is
* not an error. For example, if SDL is set up to talk to a remote audio
* server, it can't list every one available on the Internet, but it will
* still allow a specific host to be specified to SDL_OpenAudioDevice().
*
* In many common cases, when this function returns a value <= 0, it can still
* successfully open the default device (NULL for first argument of
* SDL_OpenAudioDevice()).
*/
extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
/**
* Get the human-readable name of a specific audio device.
* Must be a value between 0 and (number of audio devices-1).
* Only valid after a successfully initializing the audio subsystem.
* The values returned by this function reflect the latest call to
* SDL_GetNumAudioDevices(); recall that function to redetect available
* hardware.
*
* The string returned by this function is UTF-8 encoded, read-only, and
* managed internally. You are not to free it. If you need to keep the
* string for any length of time, you should make your own copy of it, as it
* will be invalid next time any of several other SDL functions is called.
*/
extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
int iscapture);
/**
* Open a specific audio device. Passing in a device name of NULL requests
* the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
*
* The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
* some drivers allow arbitrary and driver-specific strings, such as a
* hostname/IP address for a remote audio server, or a filename in the
* diskaudio driver.
*
* \return 0 on error, a valid device ID that is >= 2 on success.
*
* SDL_OpenAudio(), unlike this function, always acts on device ID 1.
*/
extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
*device,
int iscapture,
const
SDL_AudioSpec *
desired,
SDL_AudioSpec *
obtained,
int
allowed_changes);
/**
* \name Audio state
*
* 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);
extern DECLSPEC SDL_AudioStatus SDLCALL
SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
/* @} *//* Audio State */
/**
* \name Pause audio functions
*
* These functions pause and unpause the audio callback processing.
* They 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);
extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
int pause_on);
/* @} *//* Pause audio functions */
/**
* This function loads a WAVE from the data source, automatically freeing
* that source if \c freesrc is non-zero. For example, to load a WAVE file,
* you could do:
* \code
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
* \endcode
*
* If this function succeeds, it returns the given SDL_AudioSpec,
* filled with the audio data format of the wave data, and sets
* \c *audio_buf to a malloc()'d buffer containing the audio data,
* and sets \c *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);
/**
* Loads a WAV from a file.
* Compatibility convenience function.
*/
#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 \c cvt structure with information needed
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
* to the other.
*
* \return -1 if the format conversion is not supported, 0 if there's
* no conversion needed, or 1 if the audio filter is set up.
*/
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
SDL_AudioFormat src_format,
Uint8 src_channels,
int src_rate,
SDL_AudioFormat dst_format,
Uint8 dst_channels,
int dst_rate);
/**
* Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(),
* created an audio buffer \c cvt->buf, and filled it with \c 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
* \c cvt->buf should be allocated after the \c cvt structure is initialized by
* SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
*/
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
#define SDL_MIX_MAXVOLUME 128
/**
* 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.
*/
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
Uint32 len, int volume);
/**
* This works like SDL_MixAudio(), but you specify the audio format instead of
* using the format of audio device 1. Thus it can be used when no audio
* device is open at all.
*/
extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
const Uint8 * src,
SDL_AudioFormat format,
Uint32 len, int volume);
/**
* \name Audio lock functions
*
* The lock manipulated by these functions protects the callback function.
* During a SDL_LockAudio()/SDL_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_LockAudioDevice(SDL_AudioDeviceID dev);
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
/* @} *//* Audio lock functions */
/**
* This function shuts down audio processing and closes the audio device.
*/
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_audio_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,97 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_bits.h
*
* Functions for fiddling with bits and bitmasks.
*/
#ifndef _SDL_bits_h
#define _SDL_bits_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \file SDL_bits.h
*/
/**
* Get the index of the most significant bit. Result is undefined when called
* with 0. This operation can also be stated as "count leading zeroes" and
* "log base 2".
*
* \return Index of the most significant bit, or -1 if the value is 0.
*/
SDL_FORCE_INLINE int
SDL_MostSignificantBitIndex32(Uint32 x)
{
#if defined(__GNUC__) && __GNUC__ >= 4
/* Count Leading Zeroes builtin in GCC.
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
*/
if (x == 0) {
return -1;
}
return 31 - __builtin_clz(x);
#else
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
* <seander@cs.stanford.edu>, released in the public domain.
* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
*/
const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
const int S[] = {1, 2, 4, 8, 16};
int msbIndex = 0;
int i;
if (x == 0) {
return -1;
}
for (i = 4; i >= 0; i--)
{
if (x & b[i])
{
x >>= S[i];
msbIndex |= S[i];
}
}
return msbIndex;
#endif
}
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_bits_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,63 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_blendmode.h
*
* Header file declaring the SDL_BlendMode enumeration
*/
#ifndef _SDL_blendmode_h
#define _SDL_blendmode_h
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief The blend mode used in SDL_RenderCopy() and drawing operations.
*/
typedef enum
{
SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
dstRGBA = srcRGBA */
SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
dstA = srcA + (dstA * (1-srcA)) */
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
dstRGB = (srcRGB * srcA) + dstRGB
dstA = dstA */
SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate
dstRGB = srcRGB * dstRGB
dstA = dstA */
} SDL_BlendMode;
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_video_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,71 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_clipboard.h
*
* Include file for SDL clipboard handling
*/
#ifndef _SDL_clipboard_h
#define _SDL_clipboard_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Function prototypes */
/**
* \brief Put UTF-8 text into the clipboard
*
* \sa SDL_GetClipboardText()
*/
extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
/**
* \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
*
* \sa SDL_SetClipboardText()
*/
extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
/**
* \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
*
* \sa SDL_GetClipboardText()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_clipboard_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,195 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _SDL_config_windows_h
#define _SDL_config_windows_h
#include "SDL_platform.h"
/* This is a set of defines to configure the SDL features */
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
#define HAVE_STDINT_H 1
#elif defined(_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
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
#define DWORD_PTR DWORD
#endif
#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
#define LONG_PTR LONG
#endif
#else /* !__GNUC__ && !_MSC_VER */
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 /* __GNUC__ || _MSC_VER */
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#ifdef _WIN64
# define SIZEOF_VOIDP 8
#else
# define SIZEOF_VOIDP 4
#endif
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#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
#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_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__LTOA 1
#define HAVE__ULTOA 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 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_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_CEIL 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_LOG 1
#define HAVE_POW 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#if _MSC_VER >= 1800
#define HAVE_STRTOLL 1
#define HAVE_SSCANF 1
#define HAVE_COPYSIGN 1
#define HAVE_SCALBN 1
#endif
#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
#define HAVE_M_PI 1
#endif
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#endif
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_XAUDIO2 1
#define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
#define SDL_JOYSTICK_DINPUT 1
#define SDL_HAPTIC_DINPUT 1
/* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */
#define SDL_THREAD_WINDOWS 1
/* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_WINDOWS 1
#ifndef SDL_VIDEO_RENDER_D3D
#define SDL_VIDEO_RENDER_D3D 1
#endif
/* Enable OpenGL support */
#ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_WGL
#define SDL_VIDEO_OPENGL_WGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1
#endif
/* Enable system power support */
#define SDL_POWER_WINDOWS 1
/* Enable filesystem support */
#define SDL_FILESYSTEM_WINDOWS 1
/* Enable assembly routines (Win64 doesn't have inline asm) */
#ifndef _WIN64
#define SDL_ASSEMBLY_ROUTINES 1
#endif
#endif /* _SDL_config_windows_h */

View File

@ -1,151 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_cpuinfo.h
*
* CPU feature detection for SDL.
*/
#ifndef _SDL_cpuinfo_h
#define _SDL_cpuinfo_h
#include "SDL_stdinc.h"
/* Need to do this here because intrin.h has C++ code in it */
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
#include <intrin.h>
#ifndef _WIN64
#define __MMX__
#define __3dNOW__
#endif
#define __SSE__
#define __SSE2__
#elif defined(__MINGW64_VERSION_MAJOR)
#include <intrin.h>
#else
#ifdef __ALTIVEC__
#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
#include <altivec.h>
#undef pixel
#endif
#endif
#ifdef __MMX__
#include <mmintrin.h>
#endif
#ifdef __3dNOW__
#include <mm3dnow.h>
#endif
#ifdef __SSE__
#include <xmmintrin.h>
#endif
#ifdef __SSE2__
#include <emmintrin.h>
#endif
#endif
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* This is a guess for the cacheline size used for padding.
* Most x86 processors have a 64 byte cache line.
* The 64-bit PowerPC processors have a 128 byte cache line.
* We'll use the larger value to be generally safe.
*/
#define SDL_CACHELINE_SIZE 128
/**
* This function returns the number of CPU cores available.
*/
extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
/**
* This function returns the L1 cache line size of the CPU
*
* This is useful for determining multi-threaded structure padding
* or SIMD prefetch sizes.
*/
extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
/**
* This function returns true if the CPU has the RDTSC instruction.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
/**
* This function returns true if the CPU has AltiVec features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
/**
* This function returns true if the CPU has MMX features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
/**
* This function returns true if the CPU has 3DNow! features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
/**
* This function returns true if the CPU has SSE features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
/**
* This function returns true if the CPU has SSE2 features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
/**
* This function returns true if the CPU has SSE3 features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
/**
* This function returns true if the CPU has SSE4.1 features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
/**
* This function returns true if the CPU has SSE4.2 features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
/**
* This function returns the amount of RAM configured in the system, in MB.
*/
extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_cpuinfo_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,239 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_endian.h
*
* Functions for reading and writing endian-specific values
*/
#ifndef _SDL_endian_h
#define _SDL_endian_h
#include "SDL_stdinc.h"
/**
* \name The two types of endianness
*/
/* @{ */
#define SDL_LIL_ENDIAN 1234
#define SDL_BIG_ENDIAN 4321
/* @} */
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
#ifdef __linux__
#include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER
#else /* __linux __ */
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MISPEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
defined(__sparc__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
#endif /* __linux __ */
#endif /* !SDL_BYTEORDER */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \file SDL_endian.h
*/
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && defined(__x86_64__)
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
int result;
__asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
return (Uint16)result;
}
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
#else
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
}
#endif
#if defined(__GNUC__) && defined(__i386__)
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("bswap %0": "=r"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && defined(__x86_64__)
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("bswapl %0": "=r"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
Uint32 result;
__asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x));
__asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x));
__asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x));
return result;
}
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
#else
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
((x >> 8) & 0x0000FF00) | (x >> 24)));
}
#endif
#if defined(__GNUC__) && defined(__i386__)
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
union
{
struct
{
Uint32 a, b;
} s;
Uint64 u;
} v;
v.u = x;
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
"1"(v.s.
b));
return v.u;
}
#elif defined(__GNUC__) && defined(__x86_64__)
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
__asm__("bswapq %0": "=r"(x):"0"(x));
return x;
}
#else
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
Uint32 hi, lo;
/* Separate into high and low 32-bit values and swap them */
lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
x >>= 32;
hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
x = SDL_Swap32(lo);
x <<= 32;
x |= SDL_Swap32(hi);
return (x);
}
#endif
SDL_FORCE_INLINE float
SDL_SwapFloat(float x)
{
union
{
float f;
Uint32 ui32;
} swapper;
swapper.f = x;
swapper.ui32 = SDL_Swap32(swapper.ui32);
return swapper.f;
}
/**
* \name Swap to native
* Byteswap item from the specified endianness to the native endianness.
*/
/* @{ */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define SDL_SwapLE16(X) (X)
#define SDL_SwapLE32(X) (X)
#define SDL_SwapLE64(X) (X)
#define SDL_SwapFloatLE(X) (X)
#define SDL_SwapBE16(X) SDL_Swap16(X)
#define SDL_SwapBE32(X) SDL_Swap32(X)
#define SDL_SwapBE64(X) SDL_Swap64(X)
#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
#else
#define SDL_SwapLE16(X) SDL_Swap16(X)
#define SDL_SwapLE32(X) SDL_Swap32(X)
#define SDL_SwapLE64(X) SDL_Swap64(X)
#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
#define SDL_SwapBE16(X) (X)
#define SDL_SwapBE32(X) (X)
#define SDL_SwapBE64(X) (X)
#define SDL_SwapFloatBE(X) (X)
#endif
/* @} *//* Swap to native */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_endian_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,76 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_error.h
*
* Simple error message routines for SDL.
*/
#ifndef _SDL_error_h
#define _SDL_error_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Public functions */
/* SDL_SetError() unconditionally returns -1. */
extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...);
extern DECLSPEC const char *SDLCALL SDL_GetError(void);
extern DECLSPEC void SDLCALL SDL_ClearError(void);
/**
* \name Internal error functions
*
* \internal
* Private error reporting function - used internally.
*/
/* @{ */
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
typedef enum
{
SDL_ENOMEM,
SDL_EFREAD,
SDL_EFWRITE,
SDL_EFSEEK,
SDL_UNSUPPORTED,
SDL_LASTERROR
} SDL_errorcode;
/* SDL_Error() unconditionally returns -1. */
extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
/* @} *//* Internal error functions */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_error_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,720 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_events.h
*
* Include file for SDL event handling.
*/
#ifndef _SDL_events_h
#define _SDL_events_h
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_video.h"
#include "SDL_keyboard.h"
#include "SDL_mouse.h"
#include "SDL_joystick.h"
#include "SDL_gamecontroller.h"
#include "SDL_quit.h"
#include "SDL_gesture.h"
#include "SDL_touch.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* General keyboard/mouse state definitions */
#define SDL_RELEASED 0
#define SDL_PRESSED 1
/**
* \brief The types of events that can be delivered.
*/
typedef enum
{
SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
/* Application events */
SDL_QUIT = 0x100, /**< User-requested quit */
/* These application events have special meaning on iOS, see README-ios.txt for details */
SDL_APP_TERMINATING, /**< The application is being terminated by the OS
Called on iOS in applicationWillTerminate()
Called on Android in onDestroy()
*/
SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
Called on iOS in applicationDidReceiveMemoryWarning()
Called on Android in onLowMemory()
*/
SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
Called on iOS in applicationWillResignActive()
Called on Android in onPause()
*/
SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
Called on iOS in applicationDidEnterBackground()
Called on Android in onPause()
*/
SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
Called on iOS in applicationWillEnterForeground()
Called on Android in onResume()
*/
SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
Called on iOS in applicationDidBecomeActive()
Called on Android in onResume()
*/
/* Window events */
SDL_WINDOWEVENT = 0x200, /**< Window state change */
SDL_SYSWMEVENT, /**< System specific event */
/* Keyboard events */
SDL_KEYDOWN = 0x300, /**< Key pressed */
SDL_KEYUP, /**< Key released */
SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
SDL_TEXTINPUT, /**< Keyboard text input */
/* Mouse events */
SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
SDL_MOUSEBUTTONUP, /**< Mouse button released */
SDL_MOUSEWHEEL, /**< Mouse wheel motion */
/* Joystick events */
SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
SDL_JOYBALLMOTION, /**< Joystick trackball motion */
SDL_JOYHATMOTION, /**< Joystick hat position change */
SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
SDL_JOYBUTTONUP, /**< Joystick button released */
SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
/* Game controller events */
SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */
SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */
SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
/* Touch events */
SDL_FINGERDOWN = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,
/* Gesture events */
SDL_DOLLARGESTURE = 0x800,
SDL_DOLLARRECORD,
SDL_MULTIGESTURE,
/* Clipboard events */
SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
/* Drag and drop events */
SDL_DROPFILE = 0x1000, /**< The system requests a file open */
/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
* and should be allocated with SDL_RegisterEvents()
*/
SDL_USEREVENT = 0x8000,
/**
* This last event is only for bounding internal arrays
*/
SDL_LASTEVENT = 0xFFFF
} SDL_EventType;
/**
* \brief Fields shared by every event
*/
typedef struct SDL_CommonEvent
{
Uint32 type;
Uint32 timestamp;
} SDL_CommonEvent;
/**
* \brief Window state change event data (event.window.*)
*/
typedef struct SDL_WindowEvent
{
Uint32 type; /**< ::SDL_WINDOWEVENT */
Uint32 timestamp;
Uint32 windowID; /**< The associated window */
Uint8 event; /**< ::SDL_WindowEventID */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
Sint32 data1; /**< event dependent data */
Sint32 data2; /**< event dependent data */
} SDL_WindowEvent;
/**
* \brief Keyboard button event structure (event.key.*)
*/
typedef struct SDL_KeyboardEvent
{
Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
Uint32 timestamp;
Uint32 windowID; /**< The window with keyboard focus, if any */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 repeat; /**< Non-zero if this is a key repeat */
Uint8 padding2;
Uint8 padding3;
SDL_Keysym keysym; /**< The key that was pressed or released */
} SDL_KeyboardEvent;
#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
/**
* \brief Keyboard text editing event structure (event.edit.*)
*/
typedef struct SDL_TextEditingEvent
{
Uint32 type; /**< ::SDL_TEXTEDITING */
Uint32 timestamp;
Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
Sint32 start; /**< The start cursor of selected editing text */
Sint32 length; /**< The length of selected editing text */
} SDL_TextEditingEvent;
#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
/**
* \brief Keyboard text input event structure (event.text.*)
*/
typedef struct SDL_TextInputEvent
{
Uint32 type; /**< ::SDL_TEXTINPUT */
Uint32 timestamp;
Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
} SDL_TextInputEvent;
/**
* \brief Mouse motion event structure (event.motion.*)
*/
typedef struct SDL_MouseMotionEvent
{
Uint32 type; /**< ::SDL_MOUSEMOTION */
Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Uint32 state; /**< The current button state */
Sint32 x; /**< X coordinate, relative to window */
Sint32 y; /**< Y coordinate, relative to window */
Sint32 xrel; /**< The relative motion in the X direction */
Sint32 yrel; /**< The relative motion in the Y direction */
} SDL_MouseMotionEvent;
/**
* \brief Mouse button event structure (event.button.*)
*/
typedef struct SDL_MouseButtonEvent
{
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Uint8 button; /**< The mouse button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1;
Uint8 padding2;
Sint32 x; /**< X coordinate, relative to window */
Sint32 y; /**< Y coordinate, relative to window */
} SDL_MouseButtonEvent;
/**
* \brief Mouse wheel event structure (event.wheel.*)
*/
typedef struct SDL_MouseWheelEvent
{
Uint32 type; /**< ::SDL_MOUSEWHEEL */
Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Sint32 x; /**< The amount scrolled horizontally */
Sint32 y; /**< The amount scrolled vertically */
} SDL_MouseWheelEvent;
/**
* \brief Joystick axis motion event structure (event.jaxis.*)
*/
typedef struct SDL_JoyAxisEvent
{
Uint32 type; /**< ::SDL_JOYAXISMOTION */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
Sint16 value; /**< The axis value (range: -32768 to 32767) */
Uint16 padding4;
} SDL_JoyAxisEvent;
/**
* \brief Joystick trackball motion event structure (event.jball.*)
*/
typedef struct SDL_JoyBallEvent
{
Uint32 type; /**< ::SDL_JOYBALLMOTION */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 ball; /**< The joystick trackball index */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
Sint16 xrel; /**< The relative motion in the X direction */
Sint16 yrel; /**< The relative motion in the Y direction */
} SDL_JoyBallEvent;
/**
* \brief Joystick hat position change event structure (event.jhat.*)
*/
typedef struct SDL_JoyHatEvent
{
Uint32 type; /**< ::SDL_JOYHATMOTION */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */
Uint8 value; /**< The hat position value.
* \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
* \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
* \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
*
* Note that zero means the POV is centered.
*/
Uint8 padding1;
Uint8 padding2;
} SDL_JoyHatEvent;
/**
* \brief Joystick button event structure (event.jbutton.*)
*/
typedef struct SDL_JoyButtonEvent
{
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1;
Uint8 padding2;
} SDL_JoyButtonEvent;
/**
* \brief Joystick device event structure (event.jdevice.*)
*/
typedef struct SDL_JoyDeviceEvent
{
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
Uint32 timestamp;
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
} SDL_JoyDeviceEvent;
/**
* \brief Game controller axis motion event structure (event.caxis.*)
*/
typedef struct SDL_ControllerAxisEvent
{
Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
Sint16 value; /**< The axis value (range: -32768 to 32767) */
Uint16 padding4;
} SDL_ControllerAxisEvent;
/**
* \brief Game controller button event structure (event.cbutton.*)
*/
typedef struct SDL_ControllerButtonEvent
{
Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The controller button (SDL_GameControllerButton) */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1;
Uint8 padding2;
} SDL_ControllerButtonEvent;
/**
* \brief Controller device event structure (event.cdevice.*)
*/
typedef struct SDL_ControllerDeviceEvent
{
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
Uint32 timestamp;
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
} SDL_ControllerDeviceEvent;
/**
* \brief Touch finger event structure (event.tfinger.*)
*/
typedef struct SDL_TouchFingerEvent
{
Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
Uint32 timestamp;
SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId;
float x; /**< Normalized in the range 0...1 */
float y; /**< Normalized in the range 0...1 */
float dx; /**< Normalized in the range 0...1 */
float dy; /**< Normalized in the range 0...1 */
float pressure; /**< Normalized in the range 0...1 */
} SDL_TouchFingerEvent;
/**
* \brief Multiple Finger Gesture Event (event.mgesture.*)
*/
typedef struct SDL_MultiGestureEvent
{
Uint32 type; /**< ::SDL_MULTIGESTURE */
Uint32 timestamp;
SDL_TouchID touchId; /**< The touch device index */
float dTheta;
float dDist;
float x;
float y;
Uint16 numFingers;
Uint16 padding;
} SDL_MultiGestureEvent;
/**
* \brief Dollar Gesture Event (event.dgesture.*)
*/
typedef struct SDL_DollarGestureEvent
{
Uint32 type; /**< ::SDL_DOLLARGESTURE */
Uint32 timestamp;
SDL_TouchID touchId; /**< The touch device id */
SDL_GestureID gestureId;
Uint32 numFingers;
float error;
float x; /**< Normalized center of gesture */
float y; /**< Normalized center of gesture */
} SDL_DollarGestureEvent;
/**
* \brief An event used to request a file open by the system (event.drop.*)
* This event is disabled by default, you can enable it with SDL_EventState()
* \note If you enable this event, you must free the filename in the event.
*/
typedef struct SDL_DropEvent
{
Uint32 type; /**< ::SDL_DROPFILE */
Uint32 timestamp;
char *file; /**< The file name, which should be freed with SDL_free() */
} SDL_DropEvent;
/**
* \brief The "quit requested" event
*/
typedef struct SDL_QuitEvent
{
Uint32 type; /**< ::SDL_QUIT */
Uint32 timestamp;
} SDL_QuitEvent;
/**
* \brief OS Specific event
*/
typedef struct SDL_OSEvent
{
Uint32 type; /**< ::SDL_QUIT */
Uint32 timestamp;
} SDL_OSEvent;
/**
* \brief A user-defined event type (event.user.*)
*/
typedef struct SDL_UserEvent
{
Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
Uint32 timestamp;
Uint32 windowID; /**< The associated window if any */
Sint32 code; /**< User defined event code */
void *data1; /**< User defined data pointer */
void *data2; /**< User defined data pointer */
} SDL_UserEvent;
struct SDL_SysWMmsg;
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
/**
* \brief A video driver dependent system event (event.syswm.*)
* This event is disabled by default, you can enable it with SDL_EventState()
*
* \note If you want to use this event, you should include SDL_syswm.h.
*/
typedef struct SDL_SysWMEvent
{
Uint32 type; /**< ::SDL_SYSWMEVENT */
Uint32 timestamp;
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
} SDL_SysWMEvent;
/**
* \brief General event structure
*/
typedef union SDL_Event
{
Uint32 type; /**< Event type, shared with all events */
SDL_CommonEvent common; /**< Common event data */
SDL_WindowEvent window; /**< Window event data */
SDL_KeyboardEvent key; /**< Keyboard event data */
SDL_TextEditingEvent edit; /**< Text editing event data */
SDL_TextInputEvent text; /**< Text input event data */
SDL_MouseMotionEvent motion; /**< Mouse motion event data */
SDL_MouseButtonEvent button; /**< Mouse button event data */
SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
SDL_JoyBallEvent jball; /**< Joystick ball event data */
SDL_JoyHatEvent jhat; /**< Joystick hat event data */
SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_MultiGestureEvent mgesture; /**< Gesture event data */
SDL_DollarGestureEvent dgesture; /**< Gesture event data */
SDL_DropEvent drop; /**< Drag and drop event data */
/* This is necessary for ABI compatibility between Visual C++ and GCC
Visual C++ will respect the push pack pragma and use 52 bytes for
this structure, and GCC will use the alignment of the largest datatype
within the union, which is 8 bytes.
So... we'll add padding to force the size to be 56 bytes for both.
*/
Uint8 padding[56];
} SDL_Event;
/* Function prototypes */
/**
* Pumps the event loop, gathering events from the input devices.
*
* This function updates the event queue and internal input device state.
*
* This should only be run in the thread that sets the video mode.
*/
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
/* @{ */
typedef enum
{
SDL_ADDEVENT,
SDL_PEEKEVENT,
SDL_GETEVENT
} SDL_eventaction;
/**
* Checks the event queue for messages and optionally returns them.
*
* If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
* the back of the event queue.
*
* If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
* of the event queue, within the specified minimum and maximum type,
* will be returned and will not be removed from the queue.
*
* If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
* of the event queue, within the specified minimum and maximum type,
* will be returned and will be removed from the queue.
*
* \return The number of events actually stored, or -1 if there was an error.
*
* This function is thread-safe.
*/
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
SDL_eventaction action,
Uint32 minType, Uint32 maxType);
/* @} */
/**
* Checks to see if certain event types are in the event queue.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
/**
* This function clears events from the event queue
*/
extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
/**
* \brief Polls for currently pending events.
*
* \return 1 if there are any pending events, or 0 if there are none available.
*
* \param event If not NULL, the next event is removed from the queue and
* stored in that area.
*/
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
/**
* \brief Waits indefinitely for the next available event.
*
* \return 1, or 0 if there was an error while waiting for events.
*
* \param event If not NULL, the next event is removed from the queue and
* stored in that area.
*/
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
/**
* \brief Waits until the specified timeout (in milliseconds) for the next
* available event.
*
* \return 1, or 0 if there was an error while waiting for events.
*
* \param event If not NULL, the next event is removed from the queue and
* stored in that area.
* \param timeout The timeout (in milliseconds) to wait for next event.
*/
extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
int timeout);
/**
* \brief Add an event to the event queue.
*
* \return 1 on success, 0 if the event was filtered, or -1 if the event queue
* was full or there was some other error.
*/
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
/**
* Sets up a filter to process all events before they change internal state and
* are posted to the internal event queue.
*
* The filter is prototyped as:
* \code
* int SDL_EventFilter(void *userdata, SDL_Event * event);
* \endcode
*
* If the filter returns 1, then the event will be added to the internal queue.
* If it returns 0, then the event will be dropped from the queue, but the
* internal state will still be updated. This allows selective filtering of
* dynamically arriving events.
*
* \warning Be very careful of what you do in the event filter function, as
* it may run in a different thread!
*
* There is one caveat when dealing with the ::SDL_QuitEvent event type. The
* event filter is only called when the window manager desires to close the
* application window. If the event filter returns 1, then the window will
* be closed, otherwise the window will remain open if possible.
*
* If the quit event is generated by an interrupt signal, it will bypass the
* internal queue and be delivered to the application at the next event poll.
*/
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
void *userdata);
/**
* Return the current event filter - can be used to "chain" filters.
* If there is no event filter set, this function returns SDL_FALSE.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
void **userdata);
/**
* Add a function which is called when an event is added to the queue.
*/
extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
void *userdata);
/**
* Remove an event watch function added with SDL_AddEventWatch()
*/
extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
void *userdata);
/**
* Run the filter function on the current event queue, removing any
* events for which the filter returns 0.
*/
extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
void *userdata);
/* @{ */
#define SDL_QUERY -1
#define SDL_IGNORE 0
#define SDL_DISABLE 0
#define SDL_ENABLE 1
/**
* This function allows you to set the state of processing certain events.
* - If \c state is set to ::SDL_IGNORE, that event will be automatically
* dropped from the event queue and will not event be filtered.
* - If \c state is set to ::SDL_ENABLE, that event will be processed
* normally.
* - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
* current processing state of the specified event.
*/
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
/* @} */
#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
/**
* This function allocates a set of user-defined events, and returns
* the beginning event number for that set of events.
*
* If there aren't enough user-defined events left, this function
* returns (Uint32)-1
*/
extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_events_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,136 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_filesystem.h
*
* \brief Include file for filesystem SDL API functions
*/
#ifndef _SDL_filesystem_h
#define _SDL_filesystem_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief Get the path where the application resides.
*
* Get the "base path". This is the directory where the application was run
* from, which is probably the installation directory, and may or may not
* be the process's current working directory.
*
* This returns an absolute path in UTF-8 encoding, and is guaranteed to
* end with a path separator ('\\' on Windows, '/' most other places).
*
* The pointer returned by this function is owned by you. Please call
* SDL_free() on the pointer when you are done with it, or it will be a
* memory leak. This is not necessarily a fast call, though, so you should
* call this once near startup and save the string if you need it.
*
* Some platforms can't determine the application's path, and on other
* platforms, this might be meaningless. In such cases, this function will
* return NULL.
*
* \return String of base dir in UTF-8 encoding, or NULL on error.
*
* \sa SDL_GetPrefPath
*/
extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
/**
* \brief Get the user-and-app-specific path where files can be written.
*
* Get the "pref dir". This is meant to be where users can write personal
* files (preferences and save games, etc) that are specific to your
* application. This directory is unique per user, per application.
*
* This function will decide the appropriate location in the native filesystem,
* create the directory if necessary, and return a string of the absolute
* path to the directory in UTF-8 encoding.
*
* On Windows, the string might look like:
* "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\"
*
* On Linux, the string might look like:
* "/home/bob/.local/share/My Program Name/"
*
* On Mac OS X, the string might look like:
* "/Users/bob/Library/Application Support/My Program Name/"
*
* (etc.)
*
* You specify the name of your organization (if it's not a real organization,
* your name or an Internet domain you own might do) and the name of your
* application. These should be untranslated proper names.
*
* Both the org and app strings may become part of a directory name, so
* please follow these rules:
*
* - Try to use the same org string (including case-sensitivity) for
* all your applications that use this function.
* - Always use a unique app string for each one, and make sure it never
* changes for an app once you've decided on it.
* - Unicode characters are legal, as long as it's UTF-8 encoded, but...
* - ...only use letters, numbers, and spaces. Avoid punctuation like
* "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
*
* This returns an absolute path in UTF-8 encoding, and is guaranteed to
* end with a path separator ('\\' on Windows, '/' most other places).
*
* The pointer returned by this function is owned by you. Please call
* SDL_free() on the pointer when you are done with it, or it will be a
* memory leak. This is not necessarily a fast call, though, so you should
* call this once near startup and save the string if you need it.
*
* You should assume the path returned by this function is the only safe
* place to write files (and that SDL_GetBasePath(), while it might be
* writable, or even the parent of the returned path, aren't where you
* should be writing things).
*
* Some platforms can't determine the pref path, and on other
* platforms, this might be meaningless. In such cases, this function will
* return NULL.
*
* \param org The name of your organization.
* \param app The name of your application.
* \return UTF-8 string of user dir in platform-dependent notation. NULL
* if there's a problem (creating directory failed, etc).
*
* \sa SDL_GetBasePath
*/
extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_system_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,298 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_gamecontroller.h
*
* Include file for SDL game controller event handling
*/
#ifndef _SDL_gamecontroller_h
#define _SDL_gamecontroller_h
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_joystick.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \file SDL_gamecontroller.h
*
* 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 game controllers, and load appropriate drivers.
*
* If you would like to receive controller updates while the application
* is in the background, you should set the following hint before calling
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/
/* The gamecontroller structure used to identify an SDL game controller */
struct _SDL_GameController;
typedef struct _SDL_GameController SDL_GameController;
typedef enum
{
SDL_CONTROLLER_BINDTYPE_NONE = 0,
SDL_CONTROLLER_BINDTYPE_BUTTON,
SDL_CONTROLLER_BINDTYPE_AXIS,
SDL_CONTROLLER_BINDTYPE_HAT
} SDL_GameControllerBindType;
/**
* Get the SDL joystick layer binding for this controller button/axis mapping
*/
typedef struct SDL_GameControllerButtonBind
{
SDL_GameControllerBindType bindType;
union
{
int button;
int axis;
struct {
int hat;
int hat_mask;
} hat;
} value;
} SDL_GameControllerButtonBind;
/**
* To count the number of game controllers in the system for the following:
* int nJoysticks = SDL_NumJoysticks();
* int nGameControllers = 0;
* for ( int i = 0; i < nJoysticks; i++ ) {
* if ( SDL_IsGameController(i) ) {
* nGameControllers++;
* }
* }
*
* Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
* guid,name,mappings
*
* Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
* Under Windows there is a reserved GUID of "xinput" that covers any XInput devices.
* The mapping format for joystick is:
* bX - a joystick button, index X
* hX.Y - hat X with value Y
* aX - axis X of the joystick
* Buttons can be used as a controller axis and vice versa.
*
* This string shows an example of a valid mapping for a controller
* "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
*
*/
/**
* Add or update an existing mapping configuration
*
* \return 1 if mapping is added, 0 if updated, -1 on error
*/
extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString );
/**
* Get a mapping string for a GUID
*
* \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available
*/
extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid );
/**
* Get a mapping string for an open GameController
*
* \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available
*/
extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller );
/**
* Is the joystick on this index supported by the game controller interface?
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
/**
* Get the implementation dependent name of a game controller.
* This can be called before any controllers are opened.
* If no name can be found, this function returns NULL.
*/
extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
/**
* Open a game controller for use.
* The index passed as an argument refers to the N'th game controller on the system.
* This index is the value which will identify this controller in future controller
* events.
*
* \return A controller identifier, or NULL if an error occurred.
*/
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
/**
* Return the name for this currently opened controller
*/
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
/**
* Returns SDL_TRUE if the controller has been opened and currently connected,
* or SDL_FALSE if it has not.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller);
/**
* Get the underlying joystick object used by a controller
*/
extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
/**
* Enable/disable controller event polling.
*
* If controller events are disabled, you must call SDL_GameControllerUpdate()
* yourself and check the state of the controller when you want controller
* information.
*
* The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
*/
extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
/**
* Update the current state of the open game controllers.
*
* This is called automatically by the event loop if any game controller
* events are enabled.
*/
extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
/**
* The list of axes available from a controller
*/
typedef enum
{
SDL_CONTROLLER_AXIS_INVALID = -1,
SDL_CONTROLLER_AXIS_LEFTX,
SDL_CONTROLLER_AXIS_LEFTY,
SDL_CONTROLLER_AXIS_RIGHTX,
SDL_CONTROLLER_AXIS_RIGHTY,
SDL_CONTROLLER_AXIS_TRIGGERLEFT,
SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
SDL_CONTROLLER_AXIS_MAX
} SDL_GameControllerAxis;
/**
* turn this string into a axis mapping
*/
extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
/**
* turn this axis enum into a string mapping
*/
extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
/**
* Get the SDL joystick layer binding for this controller button mapping
*/
extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
SDL_GameControllerAxis axis);
/**
* Get the current state of an axis control on a game controller.
*
* The state is a value ranging from -32768 to 32767.
*
* The axis indices start at index 0.
*/
extern DECLSPEC Sint16 SDLCALL
SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
SDL_GameControllerAxis axis);
/**
* The list of buttons available from a controller
*/
typedef enum
{
SDL_CONTROLLER_BUTTON_INVALID = -1,
SDL_CONTROLLER_BUTTON_A,
SDL_CONTROLLER_BUTTON_B,
SDL_CONTROLLER_BUTTON_X,
SDL_CONTROLLER_BUTTON_Y,
SDL_CONTROLLER_BUTTON_BACK,
SDL_CONTROLLER_BUTTON_GUIDE,
SDL_CONTROLLER_BUTTON_START,
SDL_CONTROLLER_BUTTON_LEFTSTICK,
SDL_CONTROLLER_BUTTON_RIGHTSTICK,
SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
SDL_CONTROLLER_BUTTON_DPAD_UP,
SDL_CONTROLLER_BUTTON_DPAD_DOWN,
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
SDL_CONTROLLER_BUTTON_MAX
} SDL_GameControllerButton;
/**
* turn this string into a button mapping
*/
extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
/**
* turn this button enum into a string mapping
*/
extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
/**
* Get the SDL joystick layer binding for this controller button mapping
*/
extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
SDL_GameControllerButton button);
/**
* Get the current state of a button on a game controller.
*
* The button indices start at index 0.
*/
extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
SDL_GameControllerButton button);
/**
* Close a controller previously opened with SDL_GameControllerOpen().
*/
extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_gamecontroller_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,87 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_gesture.h
*
* Include file for SDL gesture event handling.
*/
#ifndef _SDL_gesture_h
#define _SDL_gesture_h
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_video.h"
#include "SDL_touch.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
typedef Sint64 SDL_GestureID;
/* Function prototypes */
/**
* \brief Begin Recording a gesture on the specified touch, or all touches (-1)
*
*
*/
extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
/**
* \brief Save all currently loaded Dollar Gesture templates
*
*
*/
extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *src);
/**
* \brief Save a currently loaded Dollar Gesture template
*
*
*/
extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src);
/**
* \brief Load Dollar Gesture templates from a file
*
*
*/
extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_gesture_h */
/* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large Load Diff

View File

@ -1,355 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_hints.h
*
* Official documentation for SDL configuration variables
*
* This file contains functions to set and get configuration hints,
* as well as listing each of them alphabetically.
*
* The convention for naming hints is SDL_HINT_X, where "SDL_X" is
* the environment variable that can be used to override the default.
*
* In general these hints are just that - they may or may not be
* supported or applicable on any given platform, but they provide
* a way for an application or user to give the library a hint as
* to how they would like the library to work.
*/
#ifndef _SDL_hints_h
#define _SDL_hints_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
*
* SDL can try to accelerate the SDL screen surface by using streaming
* textures with a 3D rendering engine. This variable controls whether and
* how this is done.
*
* This variable can be set to the following values:
* "0" - Disable 3D acceleration
* "1" - Enable 3D acceleration, using the default renderer.
* "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)
*
* By default SDL tries to make a best guess for each platform whether
* to use acceleration or not.
*/
#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION"
/**
* \brief A variable specifying which render driver to use.
*
* If the application doesn't pick a specific renderer to use, this variable
* specifies the name of the preferred renderer. If the preferred renderer
* can't be initialized, the normal default renderer is used.
*
* This variable is case insensitive and can be set to the following values:
* "direct3d"
* "opengl"
* "opengles2"
* "opengles"
* "software"
*
* The default varies by platform, but it's the first one in the list that
* is available on the current platform.
*/
#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER"
/**
* \brief A variable controlling whether the OpenGL render driver uses shaders if they are available.
*
* This variable can be set to the following values:
* "0" - Disable shaders
* "1" - Enable shaders
*
* By default shaders are used if OpenGL supports them.
*/
#define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS"
/**
* \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations.
*
* This variable can be set to the following values:
* "0" - Thread-safety is not enabled (faster)
* "1" - Thread-safety is enabled
*
* By default the Direct3D device is created with thread-safety disabled.
*/
#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE"
/**
* \brief A variable controlling the scaling quality
*
* This variable can be set to the following values:
* "0" or "nearest" - Nearest pixel sampling
* "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D)
* "2" or "best" - Currently this is the same as "linear"
*
* By default nearest pixel sampling is used
*/
#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY"
/**
* \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
*
* This variable can be set to the following values:
* "0" - Disable vsync
* "1" - Enable vsync
*
* By default SDL does not sync screen surface updates with vertical refresh.
*/
#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"
/**
* \brief A variable controlling whether the X11 VidMode extension should be used.
*
* This variable can be set to the following values:
* "0" - Disable XVidMode
* "1" - Enable XVidMode
*
* By default SDL will use XVidMode if it is available.
*/
#define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE"
/**
* \brief A variable controlling whether the X11 Xinerama extension should be used.
*
* This variable can be set to the following values:
* "0" - Disable Xinerama
* "1" - Enable Xinerama
*
* By default SDL will use Xinerama if it is available.
*/
#define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA"
/**
* \brief A variable controlling whether the X11 XRandR extension should be used.
*
* This variable can be set to the following values:
* "0" - Disable XRandR
* "1" - Enable XRandR
*
* By default SDL will not use XRandR because of window manager issues.
*/
#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
/**
* \brief A variable controlling whether grabbing input grabs the keyboard
*
* This variable can be set to the following values:
* "0" - Grab will affect only the mouse
* "1" - Grab will affect mouse and keyboard
*
* By default SDL will not grab the keyboard so system shortcuts still work.
*/
#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
/**
* \brief Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true.
*
*/
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
/**
* \brief A variable controlling whether the idle timer is disabled on iOS.
*
* When an iOS app does not receive touches for some time, the screen is
* dimmed automatically. For games where the accelerometer is the only input
* this is problematic. This functionality can be disabled by setting this
* hint.
*
* This variable can be set to the following values:
* "0" - Enable idle timer
* "1" - Disable idle timer
*/
#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
/**
* \brief A variable controlling which orientations are allowed on iOS.
*
* In some circumstances it is necessary to be able to explicitly control
* which UI orientations are allowed.
*
* This variable is a space delimited list of the following values:
* "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
*/
#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
/**
* \brief A variable that lets you disable the detection and use of Xinput gamepad devices
*
* The variable can be set to the following values:
* "0" - Disable XInput timer (only uses direct input)
* "1" - Enable XInput timer (the default)
*/
#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
/**
* \brief A variable that lets you manually hint extra gamecontroller db entries
*
* The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
*
* This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
* You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
*/
#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
/**
* \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
*
* The variable can be set to the following values:
* "0" - Disable joystick & gamecontroller input events when the
* application is in the background.
* "1" - Enable joystick & gamecontroller input events when the
* application is in the backgroumd.
*
* The default value is "0". This hint may be set at any time.
*/
#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
/**
* \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it.
* This is a debugging aid for developers and not expected to be used by end users. The default is "1"
*
* This variable can be set to the following values:
* "0" - don't allow topmost
* "1" - allow topmost
*/
#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
/**
* \brief A variable that controls the timer resolution, in milliseconds.
*
* The higher resolution the timer, the more frequently the CPU services
* timer interrupts, and the more precise delays are, but this takes up
* power and CPU time. This hint is only used on Windows 7 and earlier.
*
* See this blog post for more information:
* http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
*
* If this variable is set to "0", the system timer resolution is not set.
*
* The default value is "1". This hint may be set at any time.
*/
#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
/**
* \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac)
*/
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED"
/**
* \brief An enumeration of hint priorities
*/
typedef enum
{
SDL_HINT_DEFAULT,
SDL_HINT_NORMAL,
SDL_HINT_OVERRIDE
} SDL_HintPriority;
/**
* \brief Set a hint with a specific priority
*
* The priority controls the behavior when setting a hint that already
* has a value. Hints will replace existing hints of their priority and
* lower. Environment variables are considered to have override priority.
*
* \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
*/
extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
const char *value,
SDL_HintPriority priority);
/**
* \brief Set a hint with normal priority
*
* \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
*/
extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
const char *value);
/**
* \brief Get a hint
*
* \return The string value of a hint variable.
*/
extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
/**
* \brief Add a function to watch a particular hint
*
* \param name The hint to watch
* \param callback The function to call when the hint value changes
* \param userdata A pointer to pass to the callback function
*/
typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
SDL_HintCallback callback,
void *userdata);
/**
* \brief Remove a function watching a particular hint
*
* \param name The hint being watched
* \param callback The function being called when the hint value changes
* \param userdata A pointer being passed to the callback function
*/
extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name,
SDL_HintCallback callback,
void *userdata);
/**
* \brief Clear all hints
*
* This function is called during SDL_Quit() to free stored hints.
*/
extern DECLSPEC void SDLCALL SDL_ClearHints(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_hints_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,253 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_joystick.h
*
* Include file for SDL joystick event handling
*
* The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick
* behind a device_index changing as joysticks are plugged and unplugged.
*
* The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
* then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
*
* The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
* the device (a X360 wired controller for example). This identifier is platform dependent.
*
*
*/
#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
/**
* \file SDL_joystick.h
*
* 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.
*
* If you would like to receive joystick updates while the application
* is in the background, you should set the following hint before calling
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/
/* The joystick structure used to identify an SDL joystick */
struct _SDL_Joystick;
typedef struct _SDL_Joystick SDL_Joystick;
/* A structure that encodes the stable unique id for a joystick device */
typedef struct {
Uint8 data[16];
} SDL_JoystickGUID;
typedef Sint32 SDL_JoystickID;
/* Function prototypes */
/**
* Count the number of joysticks attached to the system right now
*/
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_JoystickNameForIndex(int device_index);
/**
* Open a joystick for use.
* The index passed as an argument refers tothe N'th joystick on the system.
* This index is the value which will identify this joystick in future joystick
* events.
*
* \return A joystick identifier, or NULL if an error occurred.
*/
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
/**
* Return the name for this currently opened joystick.
* If no name can be found, this function returns NULL.
*/
extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
/**
* Return the GUID for the joystick at this index
*/
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
/**
* Return the GUID for this opened joystick
*/
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
/**
* Return a string representation for this guid. pszGUID must point to at least 33 bytes
* (32 for the string plus a NULL terminator).
*/
extern DECLSPEC void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
/**
* convert a string into a joystick formatted guid
*/
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
/**
* Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick);
/**
* Get the instance ID of an opened joystick or -1 if the joystick is invalid.
*/
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(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);
/**
* \name Hat 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)
/* @} */
/**
* Get the current state of a POV hat on a joystick.
*
* The hat indices start at index 0.
*
* \return The return value is one of the following positions:
* - ::SDL_HAT_CENTERED
* - ::SDL_HAT_UP
* - ::SDL_HAT_RIGHT
* - ::SDL_HAT_DOWN
* - ::SDL_HAT_LEFT
* - ::SDL_HAT_RIGHTUP
* - ::SDL_HAT_RIGHTDOWN
* - ::SDL_HAT_LEFTUP
* - ::SDL_HAT_LEFTDOWN
*/
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick,
int hat);
/**
* Get the ball axis change since the last poll.
*
* \return 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 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,217 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_keyboard.h
*
* Include file for SDL keyboard event handling
*/
#ifndef _SDL_keyboard_h
#define _SDL_keyboard_h
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_keycode.h"
#include "SDL_video.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief The SDL keysym structure, used in key events.
*
* \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
*/
typedef struct SDL_Keysym
{
SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
Uint16 mod; /**< current key modifiers */
Uint32 unused;
} SDL_Keysym;
/* Function prototypes */
/**
* \brief Get the window which currently has keyboard focus.
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
/**
* \brief Get a snapshot of the current state of the keyboard.
*
* \param numkeys if non-NULL, receives the length of the returned array.
*
* \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
*
* \b Example:
* \code
* const Uint8 *state = SDL_GetKeyboardState(NULL);
* if ( state[SDL_SCANCODE_RETURN] ) {
* printf("<RETURN> is pressed.\n");
* }
* \endcode
*/
extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
/**
* \brief Get the current key modifier state for the keyboard.
*/
extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
/**
* \brief Set the current key modifier state for the keyboard.
*
* \note This does not change the keyboard state, only the key modifier flags.
*/
extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
/**
* \brief Get the key code corresponding to the given scancode according
* to the current keyboard layout.
*
* See ::SDL_Keycode for details.
*
* \sa SDL_GetKeyName()
*/
extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
/**
* \brief Get the scancode corresponding to the given key code according to the
* current keyboard layout.
*
* See ::SDL_Scancode for details.
*
* \sa SDL_GetScancodeName()
*/
extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
/**
* \brief Get a human-readable name for a scancode.
*
* \return A pointer to the name for the scancode.
* If the scancode doesn't have a name, this function returns
* an empty string ("").
*
* \sa SDL_Scancode
*/
extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
/**
* \brief Get a scancode from a human-readable name
*
* \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
*
* \sa SDL_Scancode
*/
extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
/**
* \brief Get a human-readable name for a key.
*
* \return A pointer to a UTF-8 string that stays valid at least until the next
* call to this function. If you need it around any longer, you must
* copy it. If the key doesn't have a name, this function returns an
* empty string ("").
*
* \sa SDL_Key
*/
extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
/**
* \brief Get a key code from a human-readable name
*
* \return key code, or SDLK_UNKNOWN if the name wasn't recognized
*
* \sa SDL_Keycode
*/
extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
/**
* \brief Start accepting Unicode text input events.
* This function will show the on-screen keyboard if supported.
*
* \sa SDL_StopTextInput()
* \sa SDL_SetTextInputRect()
* \sa SDL_HasScreenKeyboardSupport()
*/
extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
/**
* \brief Return whether or not Unicode text input events are enabled.
*
* \sa SDL_StartTextInput()
* \sa SDL_StopTextInput()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
/**
* \brief Stop receiving any text input events.
* This function will hide the on-screen keyboard if supported.
*
* \sa SDL_StartTextInput()
* \sa SDL_HasScreenKeyboardSupport()
*/
extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
/**
* \brief Set the rectangle used to type Unicode text inputs.
* This is used as a hint for IME and on-screen keyboard placement.
*
* \sa SDL_StartTextInput()
*/
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
/**
* \brief Returns whether the platform has some screen keyboard support.
*
* \return SDL_TRUE if some keyboard support is available else SDL_FALSE.
*
* \note Not all screen keyboard functions are supported on all platforms.
*
* \sa SDL_IsScreenKeyboardShown()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
/**
* \brief Returns whether the screen keyboard is shown for given window.
*
* \param window The window for which screen keyboard should be queried.
*
* \return SDL_TRUE if screen keyboard is shown else SDL_FALSE.
*
* \sa SDL_HasScreenKeyboardSupport()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_keyboard_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,341 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_keycode.h
*
* Defines constants which identify keyboard keys and modifiers.
*/
#ifndef _SDL_keycode_h
#define _SDL_keycode_h
#include "SDL_stdinc.h"
#include "SDL_scancode.h"
/**
* \brief The SDL virtual key representation.
*
* Values of this type are used to represent keyboard keys using the current
* layout of the keyboard. These values include Unicode values representing
* the unmodified character that would be generated by pressing the key, or
* an SDLK_* constant for those keys that do not generate characters.
*/
typedef Sint32 SDL_Keycode;
#define SDLK_SCANCODE_MASK (1<<30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
enum
{
SDLK_UNKNOWN = 0,
SDLK_RETURN = '\r',
SDLK_ESCAPE = '\033',
SDLK_BACKSPACE = '\b',
SDLK_TAB = '\t',
SDLK_SPACE = ' ',
SDLK_EXCLAIM = '!',
SDLK_QUOTEDBL = '"',
SDLK_HASH = '#',
SDLK_PERCENT = '%',
SDLK_DOLLAR = '$',
SDLK_AMPERSAND = '&',
SDLK_QUOTE = '\'',
SDLK_LEFTPAREN = '(',
SDLK_RIGHTPAREN = ')',
SDLK_ASTERISK = '*',
SDLK_PLUS = '+',
SDLK_COMMA = ',',
SDLK_MINUS = '-',
SDLK_PERIOD = '.',
SDLK_SLASH = '/',
SDLK_0 = '0',
SDLK_1 = '1',
SDLK_2 = '2',
SDLK_3 = '3',
SDLK_4 = '4',
SDLK_5 = '5',
SDLK_6 = '6',
SDLK_7 = '7',
SDLK_8 = '8',
SDLK_9 = '9',
SDLK_COLON = ':',
SDLK_SEMICOLON = ';',
SDLK_LESS = '<',
SDLK_EQUALS = '=',
SDLK_GREATER = '>',
SDLK_QUESTION = '?',
SDLK_AT = '@',
/*
Skip uppercase letters
*/
SDLK_LEFTBRACKET = '[',
SDLK_BACKSLASH = '\\',
SDLK_RIGHTBRACKET = ']',
SDLK_CARET = '^',
SDLK_UNDERSCORE = '_',
SDLK_BACKQUOTE = '`',
SDLK_a = 'a',
SDLK_b = 'b',
SDLK_c = 'c',
SDLK_d = 'd',
SDLK_e = 'e',
SDLK_f = 'f',
SDLK_g = 'g',
SDLK_h = 'h',
SDLK_i = 'i',
SDLK_j = 'j',
SDLK_k = 'k',
SDLK_l = 'l',
SDLK_m = 'm',
SDLK_n = 'n',
SDLK_o = 'o',
SDLK_p = 'p',
SDLK_q = 'q',
SDLK_r = 'r',
SDLK_s = 's',
SDLK_t = 't',
SDLK_u = 'u',
SDLK_v = 'v',
SDLK_w = 'w',
SDLK_x = 'x',
SDLK_y = 'y',
SDLK_z = 'z',
SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12),
SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN),
SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK),
SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE),
SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
SDLK_DELETE = '\177',
SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR),
SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE),
SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY),
SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS),
SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS),
SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER),
SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1),
SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2),
SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3),
SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4),
SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5),
SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6),
SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7),
SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8),
SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9),
SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0),
SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD),
SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION),
SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER),
SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS),
SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13),
SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14),
SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15),
SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16),
SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17),
SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18),
SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19),
SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20),
SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21),
SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22),
SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23),
SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24),
SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE),
SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP),
SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU),
SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT),
SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP),
SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN),
SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO),
SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT),
SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY),
SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE),
SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND),
SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE),
SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP),
SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN),
SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA),
SDLK_KP_EQUALSAS400 =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400),
SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE),
SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ),
SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL),
SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR),
SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR),
SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2),
SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR),
SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT),
SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER),
SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN),
SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL),
SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL),
SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00),
SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000),
SDLK_THOUSANDSSEPARATOR =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR),
SDLK_DECIMALSEPARATOR =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR),
SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT),
SDLK_CURRENCYSUBUNIT =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT),
SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN),
SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN),
SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE),
SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE),
SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB),
SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE),
SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A),
SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B),
SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C),
SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D),
SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E),
SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F),
SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR),
SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER),
SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT),
SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS),
SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER),
SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND),
SDLK_KP_DBLAMPERSAND =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND),
SDLK_KP_VERTICALBAR =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR),
SDLK_KP_DBLVERTICALBAR =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR),
SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON),
SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH),
SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE),
SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT),
SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM),
SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE),
SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL),
SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR),
SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD),
SDLK_KP_MEMSUBTRACT =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT),
SDLK_KP_MEMMULTIPLY =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY),
SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE),
SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS),
SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR),
SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY),
SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY),
SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL),
SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL),
SDLK_KP_HEXADECIMAL =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL),
SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL),
SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT),
SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT),
SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI),
SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL),
SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT),
SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT),
SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI),
SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE),
SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT),
SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV),
SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP),
SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY),
SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE),
SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT),
SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW),
SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL),
SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR),
SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER),
SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH),
SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME),
SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK),
SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD),
SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP),
SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH),
SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS),
SDLK_BRIGHTNESSDOWN =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN),
SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP),
SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH),
SDLK_KBDILLUMTOGGLE =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE),
SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP)
};
/**
* \brief Enumeration of valid key mods (possibly OR'd together).
*/
typedef enum
{
KMOD_NONE = 0x0000,
KMOD_LSHIFT = 0x0001,
KMOD_RSHIFT = 0x0002,
KMOD_LCTRL = 0x0040,
KMOD_RCTRL = 0x0080,
KMOD_LALT = 0x0100,
KMOD_RALT = 0x0200,
KMOD_LGUI = 0x0400,
KMOD_RGUI = 0x0800,
KMOD_NUM = 0x1000,
KMOD_CAPS = 0x2000,
KMOD_MODE = 0x4000,
KMOD_RESERVED = 0x8000
} SDL_Keymod;
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
#endif /* _SDL_keycode_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,81 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_loadso.h
*
* System dependent library loading routines
*
* Some things to keep in mind:
* \li These functions only work on C function names. Other languages may
* have name mangling and intrinsic language support that varies from
* compiler to compiler.
* \li Make sure you declare your function pointers with the same calling
* convention as the actual library function. Your code will crash
* mysteriously if you do not do this.
* \li Avoid namespace collisions. If you load a symbol from the library,
* it is not defined whether or not it goes into the global symbol
* namespace for the application. If it does and it conflicts with
* symbols in your code or other shared libraries, you will not get
* the results you expect. :)
*/
#ifndef _SDL_loadso_h
#define _SDL_loadso_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 function dynamically loads a shared object and returns a pointer
* to the object handle (or NULL if there was an error).
* The 'sofile' parameter is a system dependent name of the object file.
*/
extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
/**
* Given an object handle, this function looks up the address of the
* named function in the shared object and returns it. This address
* is no longer valid after calling SDL_UnloadObject().
*/
extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
const char *name);
/**
* Unload a shared object from memory.
*/
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_loadso_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,211 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_log.h
*
* Simple log messages with categories and priorities.
*
* By default logs are quiet, but if you're debugging SDL you might want:
*
* SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
*
* Here's where the messages go on different platforms:
* Windows: debug output stream
* Android: log output
* Others: standard error output (stderr)
*/
#ifndef _SDL_log_h
#define _SDL_log_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief The maximum size of a log message
*
* Messages longer than the maximum size will be truncated
*/
#define SDL_MAX_LOG_MESSAGE 4096
/**
* \brief The predefined log categories
*
* By default the application category is enabled at the INFO level,
* the assert category is enabled at the WARN level, test is enabled
* at the VERBOSE level and all other categories are enabled at the
* CRITICAL level.
*/
enum
{
SDL_LOG_CATEGORY_APPLICATION,
SDL_LOG_CATEGORY_ERROR,
SDL_LOG_CATEGORY_ASSERT,
SDL_LOG_CATEGORY_SYSTEM,
SDL_LOG_CATEGORY_AUDIO,
SDL_LOG_CATEGORY_VIDEO,
SDL_LOG_CATEGORY_RENDER,
SDL_LOG_CATEGORY_INPUT,
SDL_LOG_CATEGORY_TEST,
/* Reserved for future SDL library use */
SDL_LOG_CATEGORY_RESERVED1,
SDL_LOG_CATEGORY_RESERVED2,
SDL_LOG_CATEGORY_RESERVED3,
SDL_LOG_CATEGORY_RESERVED4,
SDL_LOG_CATEGORY_RESERVED5,
SDL_LOG_CATEGORY_RESERVED6,
SDL_LOG_CATEGORY_RESERVED7,
SDL_LOG_CATEGORY_RESERVED8,
SDL_LOG_CATEGORY_RESERVED9,
SDL_LOG_CATEGORY_RESERVED10,
/* Beyond this point is reserved for application use, e.g.
enum {
MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
MYAPP_CATEGORY_AWESOME2,
MYAPP_CATEGORY_AWESOME3,
...
};
*/
SDL_LOG_CATEGORY_CUSTOM
};
/**
* \brief The predefined log priorities
*/
typedef enum
{
SDL_LOG_PRIORITY_VERBOSE = 1,
SDL_LOG_PRIORITY_DEBUG,
SDL_LOG_PRIORITY_INFO,
SDL_LOG_PRIORITY_WARN,
SDL_LOG_PRIORITY_ERROR,
SDL_LOG_PRIORITY_CRITICAL,
SDL_NUM_LOG_PRIORITIES
} SDL_LogPriority;
/**
* \brief Set the priority of all log categories
*/
extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
/**
* \brief Set the priority of a particular log category
*/
extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
SDL_LogPriority priority);
/**
* \brief Get the priority of a particular log category
*/
extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
/**
* \brief Reset all priorities to default.
*
* \note This is called in SDL_Quit().
*/
extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
/**
* \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
*/
extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...);
/**
* \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
*/
extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...);
/**
* \brief Log a message with SDL_LOG_PRIORITY_DEBUG
*/
extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...);
/**
* \brief Log a message with SDL_LOG_PRIORITY_INFO
*/
extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...);
/**
* \brief Log a message with SDL_LOG_PRIORITY_WARN
*/
extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...);
/**
* \brief Log a message with SDL_LOG_PRIORITY_ERROR
*/
extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...);
/**
* \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
*/
extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...);
/**
* \brief Log a message with the specified category and priority.
*/
extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
SDL_LogPriority priority,
const char *fmt, ...);
/**
* \brief Log a message with the specified category and priority.
*/
extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
SDL_LogPriority priority,
const char *fmt, va_list ap);
/**
* \brief The prototype for the log output function
*/
typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
/**
* \brief Get the current log output function.
*/
extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
/**
* \brief This function allows you to replace the default log output
* function with one of your own.
*/
extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_log_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,125 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _SDL_main_h
#define _SDL_main_h
#include "SDL_stdinc.h"
/**
* \file SDL_main.h
*
* Redefine main() on some platforms so that it is called by SDL.
*/
#ifndef SDL_MAIN_HANDLED
#if defined(__WIN32__)
/* On Windows SDL provides WinMain(), which parses the command line and passes
the arguments to your main function.
If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
*/
#define SDL_MAIN_AVAILABLE
#elif defined(__IPHONEOS__)
/* On iOS SDL provides a main function that creates an application delegate
and starts the iOS application run loop.
See src/video/uikit/SDL_uikitappdelegate.m for more details.
*/
#define SDL_MAIN_NEEDED
#elif defined(__ANDROID__)
/* On Android SDL provides a Java class in SDLActivity.java that is the
main activity entry point.
See README-android.txt for more details on extending that class.
*/
#define SDL_MAIN_NEEDED
#endif
#endif /* SDL_MAIN_HANDLED */
#ifdef __cplusplus
#define C_LINKAGE "C"
#else
#define C_LINKAGE
#endif /* __cplusplus */
/**
* \file SDL_main.h
*
* The application's main() function must be called with C linkage,
* and should be declared like this:
* \code
* #ifdef __cplusplus
* extern "C"
* #endif
* int main(int argc, char *argv[])
* {
* }
* \endcode
*/
#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
#define main SDL_main
#endif
/**
* The prototype for the application's main() function
*/
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
#include "begin_code.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* This is called by the real SDL main function to let the rest of the
* library know that initialization was done properly.
*
* Calling this yourself without knowing what you're doing can cause
* crashes and hard to diagnose problems with your application.
*/
extern DECLSPEC void SDL_SetMainReady(void);
#ifdef __WIN32__
/**
* This can be called to set the application class at startup
*/
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
void *hInst);
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#endif /* __WIN32__ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_main_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,144 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _SDL_messagebox_h
#define _SDL_messagebox_h
#include "SDL_stdinc.h"
#include "SDL_video.h" /* For SDL_Window */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief SDL_MessageBox flags. If supported will display warning icon, etc.
*/
typedef enum
{
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
} SDL_MessageBoxFlags;
/**
* \brief Flags for SDL_MessageBoxButtonData.
*/
typedef enum
{
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */
} SDL_MessageBoxButtonFlags;
/**
* \brief Individual button data.
*/
typedef struct
{
Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
const char * text; /**< The UTF-8 button text */
} SDL_MessageBoxButtonData;
/**
* \brief RGB value used in a message box color scheme
*/
typedef struct
{
Uint8 r, g, b;
} SDL_MessageBoxColor;
typedef enum
{
SDL_MESSAGEBOX_COLOR_BACKGROUND,
SDL_MESSAGEBOX_COLOR_TEXT,
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
SDL_MESSAGEBOX_COLOR_MAX
} SDL_MessageBoxColorType;
/**
* \brief A set of colors to use for message box dialogs
*/
typedef struct
{
SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
} SDL_MessageBoxColorScheme;
/**
* \brief MessageBox structure containing title, text, window, etc.
*/
typedef struct
{
Uint32 flags; /**< ::SDL_MessageBoxFlags */
SDL_Window *window; /**< Parent window, can be NULL */
const char *title; /**< UTF-8 title */
const char *message; /**< UTF-8 message text */
int numbuttons;
const SDL_MessageBoxButtonData *buttons;
const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
} SDL_MessageBoxData;
/**
* \brief Create a modal message box.
*
* \param messageboxdata The SDL_MessageBoxData structure with title, text, etc.
* \param buttonid The pointer to which user id of hit button should be copied.
*
* \return -1 on error, otherwise 0 and buttonid contains user id of button
* hit or -1 if dialog was closed.
*
* \note This function should be called on the thread that created the parent
* window, or on the main thread if the messagebox has no parent. It will
* block execution of that thread until the user clicks a button or
* closes the messagebox.
*/
extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
/**
* \brief Create a simple modal message box
*
* \param flags ::SDL_MessageBoxFlags
* \param title UTF-8 title text
* \param message UTF-8 message text
* \param window The parent window, or NULL for no parent
*
* \return 0 on success, -1 on error
*
* \sa SDL_ShowMessageBox
*/
extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_messagebox_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,224 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_mouse.h
*
* Include file for SDL mouse event handling.
*/
#ifndef _SDL_mouse_h
#define _SDL_mouse_h
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_video.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */
/**
* \brief Cursor types for SDL_CreateSystemCursor.
*/
typedef enum
{
SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
SDL_SYSTEM_CURSOR_WAIT, /**< Wait */
SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */
SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */
SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */
SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */
SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */
SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */
SDL_SYSTEM_CURSOR_HAND, /**< Hand */
SDL_NUM_SYSTEM_CURSORS
} SDL_SystemCursor;
/* Function prototypes */
/**
* \brief Get the window which currently has mouse focus.
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
/**
* \brief Retrieve the current state of the mouse.
*
* The current button state is returned as a button bitmask, which can
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
* mouse cursor position relative to the focus window for the currently
* selected mouse. You can pass NULL for either x or y.
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
/**
* \brief Retrieve the relative state of the mouse.
*
* The current button state is returned as a button bitmask, which can
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
* mouse deltas since the last call to SDL_GetRelativeMouseState().
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
/**
* \brief Moves the mouse to the given position within the window.
*
* \param window The window to move the mouse into, or NULL for the current mouse focus
* \param x The x coordinate within the window
* \param y The y coordinate within the window
*
* \note This function generates a mouse motion event
*/
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
int x, int y);
/**
* \brief Set relative mouse mode.
*
* \param enabled Whether or not to enable relative mode
*
* \return 0 on success, or -1 if relative mode is not supported.
*
* While the mouse is in relative mode, the cursor is hidden, and the
* driver will try to report continuous motion in the current window.
* Only relative motion events will be delivered, the mouse position
* will not change.
*
* \note This function will flush any pending mouse motion.
*
* \sa SDL_GetRelativeMouseMode()
*/
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
/**
* \brief Query whether relative mouse mode is enabled.
*
* \sa SDL_SetRelativeMouseMode()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
/**
* \brief Create a cursor, using the specified bitmap data and
* mask (in MSB format).
*
* The cursor width must be a multiple of 8 bits.
*
* The cursor is created in black and white according to the following:
* <table>
* <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
* <tr><td> 0 </td><td> 1 </td><td> White </td></tr>
* <tr><td> 1 </td><td> 1 </td><td> Black </td></tr>
* <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr>
* <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
* if not. </td></tr>
* </table>
*
* \sa SDL_FreeCursor()
*/
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
const Uint8 * mask,
int w, int h, int hot_x,
int hot_y);
/**
* \brief Create a color cursor.
*
* \sa SDL_FreeCursor()
*/
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
int hot_x,
int hot_y);
/**
* \brief Create a system cursor.
*
* \sa SDL_FreeCursor()
*/
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
/**
* \brief Set the active cursor.
*/
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
/**
* \brief Return the active cursor.
*/
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
/**
* \brief Return the default cursor.
*/
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
/**
* \brief Frees a cursor created with SDL_CreateCursor().
*
* \sa SDL_CreateCursor()
*/
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
/**
* \brief Toggle whether or not the cursor is shown.
*
* \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
* state.
*
* \return 1 if the cursor is shown, or 0 if the cursor is hidden.
*/
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
/**
* Used as a mask when testing buttons in buttonstate.
* - Button 1: Left mouse button
* - Button 2: Middle mouse button
* - Button 3: Right mouse button
*/
#define SDL_BUTTON(X) (1 << ((X)-1))
#define SDL_BUTTON_LEFT 1
#define SDL_BUTTON_MIDDLE 2
#define SDL_BUTTON_RIGHT 3
#define SDL_BUTTON_X1 4
#define SDL_BUTTON_X2 5
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_mouse_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,251 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _SDL_mutex_h
#define _SDL_mutex_h
/**
* \file SDL_mutex.h
*
* Functions to provide thread synchronization primitives.
*/
#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
/**
* Synchronization functions which can time out return this value
* if they time out.
*/
#define SDL_MUTEX_TIMEDOUT 1
/**
* This is the timeout value which corresponds to never time out.
*/
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
/**
* \name Mutex functions
*/
/* @{ */
/* The SDL mutex structure, defined in SDL_sysmutex.c */
struct SDL_mutex;
typedef struct SDL_mutex SDL_mutex;
/**
* Create a mutex, initialized unlocked.
*/
extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
/**
* Lock the mutex.
*
* \return 0, or -1 on error.
*/
#define SDL_mutexP(m) SDL_LockMutex(m)
extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
/**
* Try to lock the mutex
*
* \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error
*/
extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
/**
* Unlock the mutex.
*
* \return 0, or -1 on error.
*
* \warning It is an error to unlock a mutex that has not been locked by
* the current thread, and doing so results in undefined behavior.
*/
#define SDL_mutexV(m) SDL_UnlockMutex(m)
extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
/**
* Destroy a mutex.
*/
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
/* @} *//* Mutex functions */
/**
* \name Semaphore functions
*/
/* @{ */
/* The SDL semaphore structure, defined in SDL_syssem.c */
struct SDL_semaphore;
typedef struct SDL_semaphore SDL_sem;
/**
* Create a semaphore, initialized with value, returns NULL on failure.
*/
extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
/**
* Destroy a semaphore.
*/
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
/**
* This function suspends the calling thread until the semaphore pointed
* to by \c sem has a positive count. It then atomically decreases the
* semaphore count.
*/
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
/**
* Non-blocking variant of SDL_SemWait().
*
* \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would
* block, and -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
/**
* Variant of SDL_SemWait() with a timeout in milliseconds.
*
* \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
* succeed in the allotted time, and -1 on error.
*
* \warning On some platforms this function is implemented by looping with a
* delay of 1 ms, and so should be avoided if possible.
*/
extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
/**
* Atomically increases the semaphore's count (not blocking).
*
* \return 0, or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
/**
* Returns the current count of the semaphore.
*/
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
/* @} *//* Semaphore functions */
/**
* \name Condition variable functions
*/
/* @{ */
/* The SDL condition variable structure, defined in SDL_syscond.c */
struct SDL_cond;
typedef struct SDL_cond SDL_cond;
/**
* Create a condition variable.
*
* Typical use of condition variables:
*
* Thread A:
* SDL_LockMutex(lock);
* while ( ! condition ) {
* SDL_CondWait(cond, lock);
* }
* SDL_UnlockMutex(lock);
*
* Thread B:
* SDL_LockMutex(lock);
* ...
* condition = true;
* ...
* SDL_CondSignal(cond);
* SDL_UnlockMutex(lock);
*
* There is some discussion whether to signal the condition variable
* with the mutex locked or not. There is some potential performance
* benefit to unlocking first on some platforms, but there are some
* potential race conditions depending on how your code is structured.
*
* In general it's safer to signal the condition variable while the
* mutex is locked.
*/
extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
/**
* Destroy a condition variable.
*/
extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
/**
* Restart one of the threads that are waiting on the condition variable.
*
* \return 0 or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
/**
* Restart all threads that are waiting on the condition variable.
*
* \return 0 or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
/**
* Wait on the condition variable, unlocking the provided mutex.
*
* \warning The mutex must be locked before entering this function!
*
* The mutex is re-locked once the condition variable is signaled.
*
* \return 0 when it is signaled, or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
/**
* Waits for at most \c ms milliseconds, and returns 0 if the condition
* variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not
* signaled in the allotted time, and -1 on error.
*
* \warning On some platforms this function is implemented by looping with a
* delay of 1 ms, and so should be avoided if possible.
*/
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
SDL_mutex * mutex, Uint32 ms);
/* @} *//* Condition variable functions */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_mutex_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,11 +0,0 @@
#ifndef _SDLname_h_
#define _SDLname_h_
#if defined(__STDC__) || defined(__cplusplus)
#define NeedFunctionPrototypes 1
#endif
#define SDL_NAME(X) SDL_##X
#endif /* _SDLname_h_ */

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More