#!/bin/sh
-prefix=${0%/bin/sdl2-config}
+prefix=/opt/local/i686-w64-mingw32
exec_prefix=${prefix}
exec_prefix_set=no
libdir=${exec_prefix}/lib
echo $exec_prefix
;;
--version)
- echo 2.0.5
+ echo 2.0.10
;;
--cflags)
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
;;
# --libs)
-# echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
+# echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
# ;;
# --static-libs)
--libs|--static-libs)
- echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc
+ echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc
;;
*)
echo "${usage}" 1>&2
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_H
-#define _SDL_H
+#ifndef SDL_h_
+#define SDL_h_
#include "SDL_main.h"
#include "SDL_stdinc.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_joystick.h"
#include "SDL_loadso.h"
#include "SDL_log.h"
#include "SDL_messagebox.h"
#include "SDL_power.h"
#include "SDL_render.h"
#include "SDL_rwops.h"
+#include "SDL_sensor.h"
+#include "SDL_shape.h"
#include "SDL_system.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
#define SDL_INIT_HAPTIC 0x00001000u
#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000u
+#define SDL_INIT_SENSOR 0x00008000u
#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
#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 \
+ SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
)
/* @} */
#endif
#include "close_code.h"
-#endif /* _SDL_H */
+#endif /* SDL_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_assert_h
-#define _SDL_assert_h
+#ifndef SDL_assert_h_
+#define SDL_assert_h_
#include "SDL_config.h"
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
-#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
+#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
-#elif defined(HAVE_SIGNAL_H)
+#elif defined(__386__) && defined(__WATCOMC__)
+ #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
+#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
#include <signal.h>
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
# define SDL_FUNCTION __func__
-#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
+#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
# define SDL_FUNCTION __FUNCTION__
#else
# define SDL_FUNCTION "???"
*
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
*
- * \return SDL_AssertState value of how to handle the assertion failure.
+ * Return SDL_AssertState 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.
* <code>
* const SDL_AssertData *item = SDL_GetAssertionReport();
* while (item) {
- * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
+ * 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");
#endif
#include "close_code.h"
-#endif /* _SDL_assert_h */
+#endif /* SDL_assert_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* All of the atomic operations that modify memory are full memory barriers.
*/
-#ifndef _SDL_atomic_h_
-#define _SDL_atomic_h_
+#ifndef SDL_atomic_h_
+#define SDL_atomic_h_
#include "SDL_stdinc.h"
#include "SDL_platform.h"
* 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)
+#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier()
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
+#elif defined(__WATCOMC__)
+extern _inline void SDL_CompilerBarrier (void);
+#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
#else
#define SDL_CompilerBarrier() \
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
* For more information on these semantics, take a look at the blog post:
* http://preshing.com/20120913/acquire-and-release-semantics
*/
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
+
#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(__aarch64__)
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "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__)
+#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */
+/* Information from:
+ https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19
+
+ The Linux kernel provides a helper function which provides the right code for a memory barrier,
+ hard-coded at address 0xffff0fa0
+*/
+typedef void (*SDL_KernelMemoryBarrierFunc)();
+#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
+#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
+#elif 0 /* defined(__QNXNTO__) */
+#include <sys/cpuinline.h>
+
+#define SDL_MemoryBarrierRelease() __cpu_membarrier()
+#define SDL_MemoryBarrierAcquire() __cpu_membarrier()
+#else
+#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__) || defined(__ARM_ARCH_8A__)
#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__)
+#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__) || defined(__ARM_ARCH_5TE__)
#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();
+#define SDL_MEMORY_BARRIER_USES_FUNCTION
+#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
+#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
#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")
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
+#endif /* __LINUX__ || __ANDROID__ */
#endif /* __GNUC__ && __arm__ */
#else
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
#include "close_code.h"
-#endif /* _SDL_atomic_h_ */
+#endif /* SDL_atomic_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Access to the raw audio mixing buffer for the SDL library.
*/
-#ifndef _SDL_audio_h
-#define _SDL_audio_h
+#ifndef SDL_audio_h_
+#define SDL_audio_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#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)
+#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008
+#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE)
/* @} */
/* @} *//* Audio flags */
/**
* The calculated values in this structure are calculated by SDL_OpenAudio().
+ *
+ * For multi-channel audio, the default SDL channel mapping is:
+ * 2: FL FR (stereo)
+ * 3: FL FR LFE (2.1 surround)
+ * 4: FL FR BL BR (quad)
+ * 5: FL FR FC BL BR (quad + center)
+ * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
+ * 7: FL FR FC LFE BC SL SR (6.1 surround)
+ * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
*/
typedef struct SDL_AudioSpec
{
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 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
Uint16 padding; /**< Necessary for some compile environments */
Uint32 size; /**< Audio buffer size in bytes (calculated) */
SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
SDL_AudioFormat format);
/**
- * A structure to hold a set of audio conversion filters and buffers.
+ * \brief Upper limit of filters in SDL_AudioCVT
+ *
+ * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
+ * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
+ * one of which is the terminating NULL pointer.
+ */
+#define SDL_AUDIOCVT_MAX_FILTERS 9
+
+/**
+ * \struct SDL_AudioCVT
+ * \brief A structure to hold a set of audio conversion filters and buffers.
+ *
+ * Note that various parts of the conversion pipeline can take advantage
+ * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
+ * you to pass it aligned data, but can possibly run much faster if you
+ * set both its (buf) field to a pointer that is aligned to 16 bytes, and its
+ * (len) field to something that's a multiple of 16, if possible.
*/
#ifdef __GNUC__
/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
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 */
+ SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
int filter_index; /**< Current audio conversion function */
} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
/* @} *//* 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:
+ * \brief Load the audio data of a WAVE file into memory
+ *
+ * Loading a WAVE file requires \c src, \c spec, \c audio_buf and \c audio_len
+ * to be valid pointers. The entire data portion of the file is then loaded
+ * into memory and decoded if necessary.
+ *
+ * If \c freesrc is non-zero, the data source gets automatically closed and
+ * freed before the function returns.
+ *
+ * Supported are RIFF WAVE files with the formats PCM (8, 16, 24, and 32 bits),
+ * IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and A-law and
+ * µ-law (8 bits). Other formats are currently unsupported and cause an error.
+ *
+ * If this function succeeds, the pointer returned by it is equal to \c spec
+ * and the pointer to the audio data allocated by the function is written to
+ * \c audio_buf and its length in bytes to \c audio_len. The \ref SDL_AudioSpec
+ * members \c freq, \c channels, and \c format are set to the values of the
+ * audio data in the buffer. The \c samples member is set to a sane default and
+ * all others are set to zero.
+ *
+ * It's necessary to use SDL_FreeWAV() to free the audio data returned in
+ * \c audio_buf when it is no longer used.
+ *
+ * Because of the underspecification of the Waveform format, there are many
+ * problematic files in the wild that cause issues with strict decoders. To
+ * provide compatibility with these files, this decoder is lenient in regards
+ * to the truncation of the file, the fact chunk, and the size of the RIFF
+ * chunk. The hints SDL_HINT_WAVE_RIFF_CHUNK_SIZE, SDL_HINT_WAVE_TRUNCATION,
+ * and SDL_HINT_WAVE_FACT_CHUNK can be used to tune the behavior of the
+ * loading process.
+ *
+ * Any file that is invalid (due to truncation, corruption, or wrong values in
+ * the headers), too big, or unsupported causes an error. Additionally, any
+ * critical I/O error from the data source will terminate the loading process
+ * with an error. The function returns NULL on error and in all cases (with the
+ * exception of \c src being NULL), an appropriate error message will be set.
+ *
+ * It is required that the data source supports seeking.
+ *
+ * Example:
* \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.
+ * \param src The data source with the WAVE data
+ * \param freesrc A integer value that makes the function close the data source if non-zero
+ * \param spec A pointer filled with the audio format of the audio data
+ * \param audio_buf A pointer filled with the audio data allocated by the function
+ * \param audio_len A pointer filled with the length of the audio data buffer in bytes
+ * \return NULL on error, or non-NULL on success.
*/
extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
int freesrc,
* 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.
+ * to the other. An unsupported format causes an error and -1 will be returned.
*
- * \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.
+ * \return 0 if no conversion is needed, 1 if the audio filter is set up,
+ * or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
SDL_AudioFormat src_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.
+ *
+ * \return 0 on success or -1 if \c cvt->buf is NULL.
*/
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
+/* SDL_AudioStream is a new audio conversion interface.
+ The benefits vs SDL_AudioCVT:
+ - it can handle resampling data in chunks without generating
+ artifacts, when it doesn't have the complete buffer available.
+ - it can handle incoming data in any variable size.
+ - You push data as you have it, and pull it when you need it
+ */
+/* this is opaque to the outside world. */
+struct _SDL_AudioStream;
+typedef struct _SDL_AudioStream SDL_AudioStream;
+
+/**
+ * Create a new audio stream
+ *
+ * \param src_format The format of the source audio
+ * \param src_channels The number of channels of the source audio
+ * \param src_rate The sampling rate of the source audio
+ * \param dst_format The format of the desired audio output
+ * \param dst_channels The number of channels of the desired audio output
+ * \param dst_rate The sampling rate of the desired audio output
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format,
+ const Uint8 src_channels,
+ const int src_rate,
+ const SDL_AudioFormat dst_format,
+ const Uint8 dst_channels,
+ const int dst_rate);
+
+/**
+ * Add data to be converted/resampled to the stream
+ *
+ * \param stream The stream the audio data is being added to
+ * \param buf A pointer to the audio data to add
+ * \param len The number of bytes to write to the stream
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len);
+
+/**
+ * Get converted/resampled data from the stream
+ *
+ * \param stream The stream the audio is being requested from
+ * \param buf A buffer to fill with audio data
+ * \param len The maximum number of bytes to fill
+ * \return The number of bytes read from the stream, or -1 on error
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len);
+
+/**
+ * Get the number of converted/resampled bytes available. The stream may be
+ * buffering data behind the scenes until it has enough to resample
+ * correctly, so this number might be lower than what you expect, or even
+ * be zero. Add more data or flush the stream if you need the data now.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream);
+
+/**
+ * Tell the stream that you're done sending data, and anything being buffered
+ * should be converted/resampled and made available immediately.
+ *
+ * It is legal to add more data to a stream after flushing, but there will
+ * be audio gaps in the output. Generally this is intended to signal the
+ * end of input, so the complete output becomes available.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream);
+
+/**
+ * Clear any pending data in the stream without converting it
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
+
+/**
+ * Free an audio stream
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ */
+extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
+
#define SDL_MIX_MAXVOLUME 128
/**
* This takes two audio buffers of the playing audio format and mixes
* \param dev The device ID to which we will queue audio.
* \param data The data to queue to the device for later playback.
* \param len The number of bytes (not samples!) to which (data) points.
- * \return zero on success, -1 on error.
+ * \return 0 on success, or -1 on error.
*
* \sa SDL_GetQueuedAudioSize
* \sa SDL_ClearQueuedAudio
#endif
#include "close_code.h"
-#endif /* _SDL_audio_h */
+#endif /* SDL_audio_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Functions for fiddling with bits and bitmasks.
*/
-#ifndef _SDL_bits_h
-#define _SDL_bits_h
+#ifndef SDL_bits_h_
+#define SDL_bits_h_
#include "SDL_stdinc.h"
*
* \return Index of the most significant bit, or -1 if the value is 0.
*/
+#if defined(__WATCOMC__) && defined(__386__)
+extern _inline int _SDL_clz_watcom (Uint32);
+#pragma aux _SDL_clz_watcom = \
+ "bsr eax, eax" \
+ "xor eax, 31" \
+ parm [eax] nomemory \
+ value [eax] \
+ modify exact [eax] nomemory;
+#endif
+
SDL_FORCE_INLINE int
SDL_MostSignificantBitIndex32(Uint32 x)
{
-#if defined(__GNUC__) && __GNUC__ >= 4
+#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
/* Count Leading Zeroes builtin in GCC.
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
*/
return -1;
}
return 31 - __builtin_clz(x);
+#elif defined(__WATCOMC__) && defined(__386__)
+ if (x == 0) {
+ return -1;
+ }
+ return 31 - _SDL_clz_watcom(x);
#else
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
* <seander@cs.stanford.edu>, released in the public domain.
#endif
}
+SDL_FORCE_INLINE SDL_bool
+SDL_HasExactlyOneBitSet32(Uint32 x)
+{
+ if (x && !(x & (x - 1))) {
+ return SDL_TRUE;
+ }
+ return SDL_FALSE;
+}
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_bits_h */
+#endif /* SDL_bits_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file declaring the SDL_BlendMode enumeration
*/
-#ifndef _SDL_blendmode_h
-#define _SDL_blendmode_h
+#ifndef SDL_blendmode_h_
+#define SDL_blendmode_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
dstRGB = (srcRGB * srcA) + dstRGB
dstA = dstA */
- SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate
+ SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
dstRGB = srcRGB * dstRGB
dstA = dstA */
+ SDL_BLENDMODE_INVALID = 0x7FFFFFFF
+
+ /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
+
} SDL_BlendMode;
+/**
+ * \brief The blend operation used when combining source and destination pixel components
+ */
+typedef enum
+{
+ SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
+ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
+ SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
+ SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
+ SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */
+
+} SDL_BlendOperation;
+
+/**
+ * \brief The normalized factor used to multiply pixel components
+ */
+typedef enum
+{
+ SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
+ SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
+ SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
+ SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
+ SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
+ SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
+ SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
+ SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
+
+} SDL_BlendFactor;
+
+/**
+ * \brief Create a custom blend mode, which may or may not be supported by a given renderer
+ *
+ * \param srcColorFactor source color factor
+ * \param dstColorFactor destination color factor
+ * \param colorOperation color operation
+ * \param srcAlphaFactor source alpha factor
+ * \param dstAlphaFactor destination alpha factor
+ * \param alphaOperation alpha operation
+ *
+ * The result of the blend mode operation will be:
+ * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
+ * and
+ * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
+ */
+extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
+ SDL_BlendFactor dstColorFactor,
+ SDL_BlendOperation colorOperation,
+ SDL_BlendFactor srcAlphaFactor,
+ SDL_BlendFactor dstAlphaFactor,
+ SDL_BlendOperation alphaOperation);
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_blendmode_h */
+#endif /* SDL_blendmode_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL clipboard handling
*/
-#ifndef _SDL_clipboard_h
-#define _SDL_clipboard_h
+#ifndef SDL_clipboard_h_
+#define SDL_clipboard_h_
#include "SDL_stdinc.h"
#endif
#include "close_code.h"
-#endif /* _SDL_clipboard_h */
+#endif /* SDL_clipboard_h_ */
/* vi: set ts=4 sw=4 expandtab: */
-/* include/SDL_config.h. Generated from SDL_config.h.in by configure. */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_windows_h_
+#define SDL_config_windows_h_
+#define SDL_config_h_
-/**
- * \file SDL_config.h.in
- *
- * 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 run hg revert SDL_config.h
-#endif
+/* This is a set of defines to configure the SDL features */
-/* C language features */
-/* #undef const */
-/* #undef inline */
-/* #undef volatile */
+#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 */
-/* C datatypes */
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
+#ifdef _WIN64
+# define SIZEOF_VOIDP 8
#else
-#define SIZEOF_VOIDP 4
+# define SIZEOF_VOIDP 4
#endif
-#define HAVE_GCC_ATOMICS 1
-/* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */
#define HAVE_DDRAW_H 1
#define HAVE_DINPUT_H 1
#define HAVE_DSOUND_H 1
#define HAVE_DXGI_H 1
#define HAVE_XINPUT_H 1
+#define HAVE_MMDEVICEAPI_H 1
+#define HAVE_AUDIOCLIENT_H 1
+#define HAVE_ENDPOINTVOLUME_H 1
-/* Comment this if you want to build without any C library requirements */
-#define HAVE_LIBC 1
-#if HAVE_LIBC
-
+/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
+#ifdef HAVE_LIBC
/* Useful headers */
-/* #undef HAVE_ALLOCA_H */
-#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_FLOAT_H 1
+#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
-/* #undef HAVE_ICONV_H */
#define HAVE_SIGNAL_H 1
-/* #undef HAVE_ALTIVEC_H */
-/* #undef HAVE_PTHREAD_NP_H */
-/* #undef HAVE_LIBUDEV_H */
-/* #undef HAVE_DBUS_DBUS_H */
-/* #undef HAVE_IBUS_IBUS_H */
-/* #undef HAVE_FCITX_FRONTEND_H */
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
-/* #undef HAVE_ALLOCA */
-#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
-#define HAVE_GETENV 1
-/* #undef HAVE_SETENV */
-#define HAVE_PUTENV 1
-/* #undef HAVE_UNSETENV */
-#endif
+#define HAVE_ALLOCA 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
-/* #undef HAVE_BCOPY */
#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
#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
-/* #undef HAVE_INDEX */
-/* #undef HAVE_RINDEX */
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__STRUPR */
+/* #undef HAVE__STRLWR */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
-#define HAVE_ITOA 1
-#define HAVE__LTOA 1
-/* #undef HAVE__UITOA */
-#define HAVE__ULTOA 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__LTOA */
+/* #undef HAVE__ULTOA */
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
-#define HAVE__I64TOA 1
-#define HAVE__UI64TOA 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__STRICMP 1
-#define HAVE_STRCASECMP 1
#define HAVE__STRNICMP 1
-#define HAVE_STRNCASECMP 1
-/* #undef HAVE_SSCANF */
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEILF 1
+#define HAVE__COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_EXP 1
+#define HAVE_EXPF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#if defined(_MSC_VER)
+/* These functions were added with the VC++ 2013 C runtime library */
+#if _MSC_VER >= 1800
+#define HAVE_STRTOLL 1
#define HAVE_VSSCANF 1
-/* #undef HAVE_SNPRINTF */
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI /**/
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 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_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_FSEEKO 1
-#define HAVE_FSEEKO64 1
-/* #undef HAVE_SIGACTION */
-/* #undef HAVE_SA_SIGACTION */
-/* #undef HAVE_SETJMP */
-#define HAVE_NANOSLEEP 1
-/* #undef HAVE_SYSCONF */
-/* #undef HAVE_SYSCTLBYNAME */
-/* #undef HAVE_CLOCK_GETTIME */
-/* #undef HAVE_GETPAGESIZE */
-/* #undef HAVE_MPROTECT */
-/* #undef HAVE_ICONV */
-/* #undef HAVE_PTHREAD_SETNAME_NP */
-/* #undef HAVE_PTHREAD_SET_NAME_NP */
-/* #undef HAVE_SEM_TIMEDWAIT */
-
+#define HAVE_SCALBNF 1
+#endif
+/* This function is available with at least the VC++ 2008 C runtime library */
+#if _MSC_VER >= 1400
+#define HAVE__FSEEKI64 1
+#endif
+#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
-#define HAVE_STDINT_H 1
-#endif /* HAVE_LIBC */
-
-/* SDL internal assertion support */
-/* #undef SDL_DEFAULT_ASSERT_LEVEL */
-
-/* Allow disabling of core subsystems */
-/* #undef SDL_ATOMIC_DISABLED */
-/* #undef SDL_AUDIO_DISABLED */
-/* #undef SDL_CPUINFO_DISABLED */
-/* #undef SDL_EVENTS_DISABLED */
-/* #undef SDL_FILE_DISABLED */
-/* #undef SDL_JOYSTICK_DISABLED */
-/* #undef SDL_HAPTIC_DISABLED */
-/* #undef SDL_LOADSO_DISABLED */
-/* #undef SDL_RENDER_DISABLED */
-/* #undef SDL_THREADS_DISABLED */
-/* #undef SDL_TIMERS_DISABLED */
-/* #undef SDL_VIDEO_DISABLED */
-/* #undef SDL_POWER_DISABLED */
-/* #undef SDL_FILESYSTEM_DISABLED */
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#endif
/* 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_PULSEAUDIO */
-/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_HAIKU */
-/* #undef SDL_AUDIO_DRIVER_BSD */
-/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-/* #undef SDL_AUDIO_DRIVER_ANDROID */
-/* #undef SDL_AUDIO_DRIVER_XAUDIO2 */
+#define SDL_AUDIO_DRIVER_WASAPI 1
#define SDL_AUDIO_DRIVER_DSOUND 1
-/* #undef SDL_AUDIO_DRIVER_ESD */
-/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_NACL */
-/* #undef SDL_AUDIO_DRIVER_NAS */
-/* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_SNDIO */
-/* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_OSS */
-/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */
-/* #undef SDL_AUDIO_DRIVER_PAUDIO */
-/* #undef SDL_AUDIO_DRIVER_QSA */
-/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
-#define SDL_AUDIO_DRIVER_WINMM 1
-/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */
-/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_EMSCRIPTEN */
+#define SDL_AUDIO_DRIVER_WINMM 1
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
-/* #undef SDL_INPUT_LINUXEV */
-/* #undef SDL_INPUT_LINUXKD */
-/* #undef SDL_INPUT_TSLIB */
-/* #undef SDL_JOYSTICK_HAIKU */
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_XINPUT 1
-/* #undef SDL_JOYSTICK_DUMMY */
-/* #undef SDL_JOYSTICK_IOKIT */
-/* #undef SDL_JOYSTICK_LINUX */
-/* #undef SDL_JOYSTICK_ANDROID */
-/* #undef SDL_JOYSTICK_WINMM */
-/* #undef SDL_JOYSTICK_USBHID */
-/* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
-/* #undef SDL_JOYSTICK_EMSCRIPTEN */
-/* #undef SDL_HAPTIC_DUMMY */
-/* #undef SDL_HAPTIC_LINUX */
-/* #undef SDL_HAPTIC_IOKIT */
-#define SDL_HAPTIC_DINPUT 1
-#define SDL_HAPTIC_XINPUT 1
+#define SDL_JOYSTICK_HIDAPI 1
+#define SDL_HAPTIC_DINPUT 1
+#define SDL_HAPTIC_XINPUT 1
+
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY 1
/* Enable various shared object loading systems */
-/* #undef SDL_LOADSO_HAIKU */
-/* #undef SDL_LOADSO_DLOPEN */
-/* #undef SDL_LOADSO_DUMMY */
-/* #undef SDL_LOADSO_LDG */
-#define SDL_LOADSO_WINDOWS 1
+#define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */
-/* #undef SDL_THREAD_PTHREAD */
-/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX */
-/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
-#define SDL_THREAD_WINDOWS 1
+#define SDL_THREAD_WINDOWS 1
/* Enable various timer systems */
-/* #undef SDL_TIMER_HAIKU */
-/* #undef SDL_TIMER_DUMMY */
-/* #undef SDL_TIMER_UNIX */
-#define SDL_TIMER_WINDOWS 1
+#define SDL_TIMER_WINDOWS 1
/* Enable various video drivers */
-/* #undef SDL_VIDEO_DRIVER_HAIKU */
-/* #undef SDL_VIDEO_DRIVER_COCOA */
-/* #undef SDL_VIDEO_DRIVER_DIRECTFB */
-/* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_WINDOWS 1
-/* #undef SDL_VIDEO_DRIVER_WAYLAND */
-/* #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
-/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
-/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */
-/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */
-/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */
-/* #undef SDL_VIDEO_DRIVER_MIR */
-/* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC */
-/* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON */
-/* #undef SDL_VIDEO_DRIVER_X11 */
-/* #undef SDL_VIDEO_DRIVER_RPI */
-/* #undef SDL_VIDEO_DRIVER_ANDROID */
-/* #undef SDL_VIDEO_DRIVER_EMSCRIPTEN */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE */
-/* #undef SDL_VIDEO_DRIVER_X11_XCURSOR */
-/* #undef SDL_VIDEO_DRIVER_X11_XDBE */
-/* #undef SDL_VIDEO_DRIVER_X11_XINERAMA */
-/* #undef SDL_VIDEO_DRIVER_X11_XINPUT2 */
-/* #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */
-/* #undef SDL_VIDEO_DRIVER_X11_XRANDR */
-/* #undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER */
-/* #undef SDL_VIDEO_DRIVER_X11_XSHAPE */
-/* #undef SDL_VIDEO_DRIVER_X11_XVIDMODE */
-/* #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */
-/* #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY */
-/* #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM */
-/* #undef SDL_VIDEO_DRIVER_NACL */
-/* #undef SDL_VIDEO_DRIVER_VIVANTE */
-/* #undef SDL_VIDEO_DRIVER_VIVANTE_VDK */
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_WINDOWS 1
-#define SDL_VIDEO_RENDER_D3D 1
-/* #undef SDL_VIDEO_RENDER_D3D11 */
-#define SDL_VIDEO_RENDER_OGL 1
-/* #undef SDL_VIDEO_RENDER_OGL_ES */
-/* #undef SDL_VIDEO_RENDER_OGL_ES2 */
-/* #undef SDL_VIDEO_RENDER_DIRECTFB */
+#ifndef SDL_VIDEO_RENDER_D3D
+#define SDL_VIDEO_RENDER_D3D 1
+#endif
+#ifndef SDL_VIDEO_RENDER_D3D11
+#define SDL_VIDEO_RENDER_D3D11 0
+#endif
/* Enable OpenGL support */
-#define SDL_VIDEO_OPENGL 1
-/* #undef SDL_VIDEO_OPENGL_ES */
-/* #undef SDL_VIDEO_OPENGL_ES2 */
-/* #undef SDL_VIDEO_OPENGL_BGL */
-/* #undef SDL_VIDEO_OPENGL_CGL */
-/* #undef SDL_VIDEO_OPENGL_EGL */
-/* #undef SDL_VIDEO_OPENGL_GLX */
-#define SDL_VIDEO_OPENGL_WGL 1
-/* #undef SDL_VIDEO_OPENGL_OSMESA */
-/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
+#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
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_OPENGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_EGL
+#define SDL_VIDEO_OPENGL_EGL 1
+#endif
+
+/* Enable Vulkan support */
+#define SDL_VIDEO_VULKAN 1
/* Enable system power support */
-/* #undef SDL_POWER_LINUX */
#define SDL_POWER_WINDOWS 1
-/* #undef SDL_POWER_MACOSX */
-/* #undef SDL_POWER_HAIKU */
-/* #undef SDL_POWER_ANDROID */
-/* #undef SDL_POWER_EMSCRIPTEN */
-/* #undef SDL_POWER_HARDWIRED */
-/* Enable system filesystem support */
-/* #undef SDL_FILESYSTEM_HAIKU */
-/* #undef SDL_FILESYSTEM_COCOA */
-/* #undef SDL_FILESYSTEM_DUMMY */
-/* #undef SDL_FILESYSTEM_UNIX */
-#define SDL_FILESYSTEM_WINDOWS 1
-/* #undef SDL_FILESYSTEM_NACL */
-/* #undef SDL_FILESYSTEM_ANDROID */
-/* #undef SDL_FILESYSTEM_EMSCRIPTEN */
+/* Enable filesystem support */
+#define SDL_FILESYSTEM_WINDOWS 1
-/* Enable assembly routines */
-#define SDL_ASSEMBLY_ROUTINES 1
-/* #undef SDL_ALTIVEC_BLITTERS */
-
-/* Enable ime support */
-/* #undef SDL_USE_IME */
+/* Enable assembly routines (Win64 doesn't have inline asm) */
+#ifndef _WIN64
+#define SDL_ASSEMBLY_ROUTINES 1
+#endif
-#endif /* _SDL_config_h */
+#endif /* SDL_config_windows_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* CPU feature detection for SDL.
*/
-#ifndef _SDL_cpuinfo_h
-#define _SDL_cpuinfo_h
+#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) && (defined(_M_IX86) || defined(_M_X64))
+#ifdef __clang__
+/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
+#undef __MMX__
+#undef __SSE__
+#undef __SSE2__
+#else
#include <intrin.h>
#ifndef _WIN64
+#ifndef __MMX__
#define __MMX__
+#endif
+#ifndef __3dNOW__
#define __3dNOW__
#endif
+#endif
+#ifndef __SSE__
#define __SSE__
+#endif
+#ifndef __SSE2__
#define __SSE2__
+#endif
+#endif /* __clang__ */
#elif defined(__MINGW64_VERSION_MAJOR)
#include <intrin.h>
#else
-#ifdef __ALTIVEC__
-#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
+/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */
+#if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H)
#include <altivec.h>
-#undef pixel
#endif
+#if !defined(SDL_DISABLE_ARM_NEON_H)
+# if defined(__ARM_NEON)
+# include <arm_neon.h>
+# elif defined(__WINDOWS__) || defined(__WINRT__)
+/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
+# if defined(_M_ARM)
+# include <armintr.h>
+# include <arm_neon.h>
+# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
+# endif
+# if defined (_M_ARM64)
+# include <armintr.h>
+# include <arm_neon.h>
+# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
+# endif
+# endif
#endif
-#ifdef __MMX__
-#include <mmintrin.h>
-#endif
-#ifdef __3dNOW__
+#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
#include <mm3dnow.h>
#endif
-#ifdef __SSE__
+#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
+#include <immintrin.h>
+#else
+#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
+#include <mmintrin.h>
+#endif
+#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
#include <xmmintrin.h>
#endif
-#ifdef __SSE2__
+#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
#include <emmintrin.h>
#endif
+#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
+#include <pmmintrin.h>
#endif
+#endif /* HAVE_IMMINTRIN_H */
+#endif /* compiler version */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
+/**
+ * This function returns true if the CPU has AVX-512F (foundation) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
+
+/**
+ * This function returns true if the CPU has NEON (ARM SIMD) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
+
/**
* This function returns the amount of RAM configured in the system, in MB.
*/
extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
+/**
+ * \brief Report the alignment this system needs for SIMD allocations.
+ *
+ * This will return the minimum number of bytes to which a pointer must be
+ * aligned to be compatible with SIMD instructions on the current machine.
+ * For example, if the machine supports SSE only, it will return 16, but if
+ * it supports AVX-512F, it'll return 64 (etc). This only reports values for
+ * instruction sets SDL knows about, so if your SDL build doesn't have
+ * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
+ * not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
+ * Plan accordingly.
+ */
+extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
+
+/**
+ * \brief Allocate memory in a SIMD-friendly way.
+ *
+ * This will allocate a block of memory that is suitable for use with SIMD
+ * instructions. Specifically, it will be properly aligned and padded for
+ * the system's supported vector instructions.
+ *
+ * The memory returned will be padded such that it is safe to read or write
+ * an incomplete vector at the end of the memory block. This can be useful
+ * so you don't have to drop back to a scalar fallback at the end of your
+ * SIMD processing loop to deal with the final elements without overflowing
+ * the allocated buffer.
+ *
+ * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free()
+ * or delete[], etc.
+ *
+ * Note that SDL will only deal with SIMD instruction sets it is aware of;
+ * for example, SDL 2.0.8 knows that SSE wants 16-byte vectors
+ * (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't
+ * know that AVX-512 wants 64. To be clear: if you can't decide to use an
+ * instruction set with an SDL_Has*() function, don't use that instruction
+ * set with memory allocated through here.
+ *
+ * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't
+ * out of memory.
+ *
+ * \param len The length, in bytes, of the block to allocated. The actual
+ * allocated block might be larger due to padding, etc.
+ * \return Pointer to newly-allocated block, NULL if out of memory.
+ *
+ * \sa SDL_SIMDAlignment
+ * \sa SDL_SIMDFree
+ */
+extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
+
+/**
+ * \brief Deallocate memory obtained from SDL_SIMDAlloc
+ *
+ * It is not valid to use this function on a pointer from anything but
+ * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
+ * SDL_malloc, memalign, new[], etc.
+ *
+ * However, SDL_SIMDFree(NULL) is a legal no-op.
+ *
+ * \sa SDL_SIMDAlloc
+ */
+extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr);
+/* vi: set ts=4 sw=4 expandtab: */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_cpuinfo_h */
+#endif /* SDL_cpuinfo_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*
* This is a simple file to encapsulate the EGL API headers.
*/
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__ANDROID__)
#include <EGL/egl.h>
#include <EGL/eglext.h>
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Functions for reading and writing endian-specific values
*/
-#ifndef _SDL_endian_h
-#define _SDL_endian_h
+#ifndef SDL_endian_h_
+#define SDL_endian_h_
#include "SDL_stdinc.h"
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint16 SDL_Swap16(Uint16);
+#pragma aux SDL_Swap16 = \
+ "xchg al, ah" \
+ parm [ax] \
+ modify [ax];
#else
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint32 SDL_Swap32(Uint32);
+#ifndef __SW_3 /* 486+ */
+#pragma aux SDL_Swap32 = \
+ "bswap eax" \
+ parm [eax] \
+ modify [eax];
+#else /* 386-only */
+#pragma aux SDL_Swap32 = \
+ "xchg al, ah" \
+ "ror eax, 16" \
+ "xchg al, ah" \
+ parm [eax] \
+ modify [eax];
+#endif
#else
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
#endif
#include "close_code.h"
-#endif /* _SDL_endian_h */
+#endif /* SDL_endian_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Simple error message routines for SDL.
*/
-#ifndef _SDL_error_h
-#define _SDL_error_h
+#ifndef SDL_error_h_
+#define SDL_error_h_
#include "SDL_stdinc.h"
#endif
#include "close_code.h"
-#endif /* _SDL_error_h */
+#endif /* SDL_error_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL event handling.
*/
-#ifndef _SDL_events_h
-#define _SDL_events_h
+#ifndef SDL_events_h_
+#define SDL_events_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
Called on Android in onResume()
*/
+ /* Display events */
+ SDL_DISPLAYEVENT = 0x150, /**< Display state change */
+
/* Window events */
SDL_WINDOWEVENT = 0x200, /**< Window state change */
SDL_SYSWMEVENT, /**< System specific event */
SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
+ /* Sensor events */
+ SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */
+
/* Render events */
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
typedef struct SDL_CommonEvent
{
Uint32 type;
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_CommonEvent;
+/**
+ * \brief Display state change event data (event.display.*)
+ */
+typedef struct SDL_DisplayEvent
+{
+ Uint32 type; /**< ::SDL_DISPLAYEVENT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 display; /**< The associated display index */
+ Uint8 event; /**< ::SDL_DisplayEventID */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint32 data1; /**< event dependent data */
+} SDL_DisplayEvent;
+
/**
* \brief Window state change event data (event.window.*)
*/
typedef struct SDL_WindowEvent
{
Uint32 type; /**< ::SDL_WINDOWEVENT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The associated window */
Uint8 event; /**< ::SDL_WindowEventID */
Uint8 padding1;
typedef struct SDL_KeyboardEvent
{
Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_TextEditingEvent
{
Uint32 type; /**< ::SDL_TEXTEDITING */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_TextInputEvent
{
Uint32 type; /**< ::SDL_TEXTINPUT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
} SDL_TextInputEvent;
typedef struct SDL_MouseMotionEvent
{
Uint32 type; /**< ::SDL_MOUSEMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_MouseButtonEvent
{
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_MouseWheelEvent
{
Uint32 type; /**< ::SDL_MOUSEWHEEL */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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, positive to the right and negative to the left */
typedef struct SDL_JoyAxisEvent
{
Uint32 type; /**< ::SDL_JOYAXISMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */
Uint8 padding1;
typedef struct SDL_JoyBallEvent
{
Uint32 type; /**< ::SDL_JOYBALLMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 ball; /**< The joystick trackball index */
Uint8 padding1;
typedef struct SDL_JoyHatEvent
{
Uint32 type; /**< ::SDL_JOYHATMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */
Uint8 value; /**< The hat position value.
typedef struct SDL_JoyButtonEvent
{
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
typedef struct SDL_JoyDeviceEvent
{
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
} SDL_JoyDeviceEvent;
typedef struct SDL_ControllerAxisEvent
{
Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
Uint8 padding1;
typedef struct SDL_ControllerButtonEvent
{
Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The controller button (SDL_GameControllerButton) */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
typedef struct SDL_ControllerDeviceEvent
{
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
} SDL_ControllerDeviceEvent;
typedef struct SDL_AudioDeviceEvent
{
Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
Uint8 padding1;
typedef struct SDL_TouchFingerEvent
{
Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId;
float x; /**< Normalized in the range 0...1 */
typedef struct SDL_MultiGestureEvent
{
Uint32 type; /**< ::SDL_MULTIGESTURE */
- Uint32 timestamp;
- SDL_TouchID touchId; /**< The touch device index */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_TouchID touchId; /**< The touch device id */
float dTheta;
float dDist;
float x;
typedef struct SDL_DollarGestureEvent
{
Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */
SDL_GestureID gestureId;
Uint32 numFingers;
typedef struct SDL_DropEvent
{
Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
Uint32 windowID; /**< The window that was dropped on, if any */
} SDL_DropEvent;
+/**
+ * \brief Sensor event structure (event.sensor.*)
+ */
+typedef struct SDL_SensorEvent
+{
+ Uint32 type; /**< ::SDL_SENSORUPDATE */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Sint32 which; /**< The instance ID of the sensor */
+ float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
+} SDL_SensorEvent;
+
/**
* \brief The "quit requested" event
*/
typedef struct SDL_QuitEvent
{
Uint32 type; /**< ::SDL_QUIT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_QuitEvent;
/**
typedef struct SDL_OSEvent
{
Uint32 type; /**< ::SDL_QUIT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_OSEvent;
/**
typedef struct SDL_UserEvent
{
Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The associated window if any */
Sint32 code; /**< User defined event code */
void *data1; /**< User defined data pointer */
typedef struct SDL_SysWMEvent
{
Uint32 type; /**< ::SDL_SYSWMEVENT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
} SDL_SysWMEvent;
{
Uint32 type; /**< Event type, shared with all events */
SDL_CommonEvent common; /**< Common event data */
+ SDL_DisplayEvent display; /**< Window event data */
SDL_WindowEvent window; /**< Window event data */
SDL_KeyboardEvent key; /**< Keyboard event data */
SDL_TextEditingEvent edit; /**< Text editing event data */
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
SDL_AudioDeviceEvent adevice; /**< Audio device event data */
+ SDL_SensorEvent sensor; /**< Sensor event data */
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */
Uint8 padding[56];
} SDL_Event;
+/* Make sure we haven't broken binary compatibility */
+SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == 56);
+
/* Function prototypes */
/**
* 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.
+ * dropped from the event queue and will not 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
#endif
#include "close_code.h"
-#endif /* _SDL_events_h */
+#endif /* SDL_events_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* \brief Include file for filesystem SDL API functions
*/
-#ifndef _SDL_filesystem_h
-#define _SDL_filesystem_h
+#ifndef SDL_filesystem_h_
+#define SDL_filesystem_h_
#include "SDL_stdinc.h"
#endif
#include "close_code.h"
-#endif /* _SDL_filesystem_h */
+#endif /* SDL_filesystem_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL game controller event handling
*/
-#ifndef _SDL_gamecontroller_h
-#define _SDL_gamecontroller_h
+#ifndef SDL_gamecontroller_h_
+#define SDL_gamecontroller_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/
-/* The gamecontroller structure used to identify an SDL game controller */
+/**
+ * The gamecontroller structure used to identify an SDL game controller
+ */
struct _SDL_GameController;
typedef struct _SDL_GameController SDL_GameController;
* 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) ) {
+ * for (int i = 0; i < nJoysticks; i++) {
+ * if (SDL_IsGameController(i)) {
* nGameControllers++;
* }
* }
* 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",
+ * "03000000341a00003608000000000000,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",
*
*/
*
* \return number of mappings added, -1 on error
*/
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw );
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
/**
* Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
*
* \return 1 if mapping is added, 0 if updated, -1 on error
*/
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString );
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
+
+/**
+ * Get the number of mappings installed
+ *
+ * \return the number of mappings
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
+
+/**
+ * Get the mapping at a particular index.
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range.
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
/**
* 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 );
+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 );
+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.
*/
extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
+/**
+ * Get the mapping of a game controller.
+ * This can be called before any controllers are opened.
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
+ */
+extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(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.
*/
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
+/**
+ * Get the player index of an opened game controller, or -1 if it's not available
+ *
+ * For XInput controllers this returns the XInput user index.
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
+
+/**
+ * Get the USB vendor ID of an opened controller, if available.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller);
+
+/**
+ * Get the USB product ID of an opened controller, if available.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller);
+
+/**
+ * Get the product version of an opened controller, if available.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller);
+
/**
* Returns SDL_TRUE if the controller has been opened and currently connected,
* or SDL_FALSE if it has not.
/**
* The list of axes available from a controller
+ *
+ * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
+ * and are centered within ~8000 of zero, though advanced UI will allow users to set
+ * or autodetect the dead zone, which varies between controllers.
+ *
+ * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
*/
typedef enum
{
extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
SDL_GameControllerButton button);
+/**
+ * Trigger a rumble effect
+ * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
+ *
+ * \param gamecontroller The controller to vibrate
+ * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF
+ * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
+ * \param duration_ms The duration of the rumble effect, in milliseconds
+ *
+ * \return 0, or -1 if rumble isn't supported on this joystick
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
+
/**
* Close a controller previously opened with SDL_GameControllerOpen().
*/
#endif
#include "close_code.h"
-#endif /* _SDL_gamecontroller_h */
+#endif /* SDL_gamecontroller_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL gesture event handling.
*/
-#ifndef _SDL_gesture_h
-#define _SDL_gesture_h
+#ifndef SDL_gesture_h_
+#define SDL_gesture_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
#include "close_code.h"
-#endif /* _SDL_gesture_h */
+#endif /* SDL_gesture_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/**
* \file SDL_haptic.h
*
- * \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
+ * \brief The SDL haptic subsystem allows you to control haptic (force feedback)
* devices.
*
* The basic usage is as follows:
- * - Initialize the Subsystem (::SDL_INIT_HAPTIC).
- * - Open a Haptic Device.
+ * - Initialize the subsystem (::SDL_INIT_HAPTIC).
+ * - Open a haptic device.
* - SDL_HapticOpen() to open from index.
* - SDL_HapticOpenFromJoystick() to open from an existing joystick.
* - Create an effect (::SDL_HapticEffect).
* \endcode
*/
-#ifndef _SDL_haptic_h
-#define _SDL_haptic_h
+#ifndef SDL_haptic_h_
+#define SDL_haptic_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
extern "C" {
#endif /* __cplusplus */
+/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF).
+ *
+ * At the moment the magnitude variables are mixed between signed/unsigned, and
+ * it is also not made clear that ALL of those variables expect a max of 0x7FFF.
+ *
+ * Some platforms may have higher precision than that (Linux FF, Windows XInput)
+ * so we should fix the inconsistency in favor of higher possible precision,
+ * adjusting for platforms that use different scales.
+ * -flibit
+ */
+
/**
* \typedef SDL_Haptic
*
/**
* \brief Device can be queried for effect status.
*
- * Device can be queried for effect status.
+ * Device supports querying effect status.
*
* \sa SDL_HapticGetEffectStatus
*/
/**
* \brief Device can be paused.
*
+ * Devices supports being paused.
+ *
* \sa SDL_HapticPause
* \sa SDL_HapticUnpause
*/
/**
* \brief A structure containing a template for a Constant effect.
*
- * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
+ * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
*
* A constant effect applies a constant force in the specified direction
* to the joystick.
* This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
*
* The Left/Right effect is used to explicitly control the large and small
- * motors, commonly found in modern game controllers. One motor is high
- * frequency, the other is low frequency.
+ * motors, commonly found in modern game controllers. The small (right) motor
+ * is high frequency, and the large (left) motor is low frequency.
*
* \sa SDL_HAPTIC_LEFTRIGHT
* \sa SDL_HapticEffect
Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */
/* Replay */
- Uint32 length; /**< Duration of the effect. */
+ Uint32 length; /**< Duration of the effect in milliseconds. */
/* Rumble */
Uint16 large_magnitude; /**< Control of the large controller motor. */
/**
* \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
*
+ * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
+ *
* A custom force feedback effect is much like a periodic effect, where the
* application can define its exact shape. You will have to allocate the
* data yourself. Data should consist of channels * samples Uint16 samples.
extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
/**
- * \brief Get the implementation dependent name of a Haptic device.
+ * \brief Get the implementation dependent name of a haptic device.
*
* 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_HapticName(int device_index);
/**
- * \brief Opens a Haptic device for usage.
+ * \brief Opens a haptic device for use.
*
- * The index passed as an argument refers to the N'th Haptic device on this
+ * The index passed as an argument refers to the N'th haptic device on this
* system.
*
* When opening a haptic device, its gain will be set to maximum and
* \brief Checks to see if a joystick has haptic features.
*
* \param joystick Joystick to test for haptic capabilities.
- * \return 1 if the joystick is haptic, 0 if it isn't
- * or -1 if an error ocurred.
+ * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
+ * or -1 if an error occurred.
*
* \sa SDL_HapticOpenFromJoystick
*/
extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
/**
- * \brief Opens a Haptic device for usage from a Joystick device.
+ * \brief Opens a haptic device for use from a joystick device.
*
* You must still close the haptic device separately. It will not be closed
* with the joystick.
joystick);
/**
- * \brief Closes a Haptic device previously opened with SDL_HapticOpen().
+ * \brief Closes a haptic device previously opened with SDL_HapticOpen().
*
* \param haptic Haptic device to close.
*/
* Example:
* \code
* if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
- * printf("We have constant haptic effect!");
+ * printf("We have constant haptic effect!\n");
* }
* \endcode
*
*
* \param haptic Haptic device to create the effect on.
* \param effect Properties of the effect to create.
- * \return The id of the effect on success or -1 on error.
+ * \return The identifier of the effect on success or -1 on error.
*
* \sa SDL_HapticUpdateEffect
* \sa SDL_HapticRunEffect
/**
* \brief Updates the properties of an effect.
*
- * Can be used dynamically, although behaviour when dynamically changing
+ * Can be used dynamically, although behavior when dynamically changing
* direction may be strange. Specifically the effect may reupload itself
* and start playing from the start. You cannot change the type either when
* running SDL_HapticUpdateEffect().
*
* \param haptic Haptic device that has the effect.
- * \param effect Effect to update.
+ * \param effect Identifier of the effect to update.
* \param data New effect properties to use.
* \return 0 on success or -1 on error.
*
#endif
#include "close_code.h"
-#endif /* _SDL_haptic_h */
+#endif /* SDL_haptic_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* to how they would like the library to work.
*/
-#ifndef _SDL_hints_h
-#define _SDL_hints_h
+#ifndef SDL_hints_h_
+#define SDL_hints_h_
#include "SDL_stdinc.h"
* "opengl"
* "opengles2"
* "opengles"
+ * "metal"
* "software"
*
* The default varies by platform, but it's the first one in the list that
*/
#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG"
+/**
+ * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
+ *
+ * This variable can be set to the following values:
+ * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen
+ * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
+ *
+ * By default letterbox is used
+ */
+#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE"
+
/**
* \brief A variable controlling the scaling quality
*
*/
#define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING"
+/**
+ * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable _NET_WM_BYPASS_COMPOSITOR
+ * "1" - Enable _NET_WM_BYPASS_COMPOSITOR
+ *
+ * By default SDL will use _NET_WM_BYPASS_COMPOSITOR
+ *
+ */
+#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
+
/**
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
*
*/
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
+/**
+ * \brief A variable to specify custom icon resource id from RC file on Windows platform
+ */
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON"
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
+
/**
* \brief A variable controlling whether the windows message loop is processed by SDL
*
*/
#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
+/**
+ * \brief A variable setting the double click time, in milliseconds.
+ */
+#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME"
+
+/**
+ * \brief A variable setting the double click radius, in pixels.
+ */
+#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS"
+
+/**
+ * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode
+ */
+#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE"
+
+/**
+ * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
+ */
+#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
+
/**
* \brief A variable controlling whether relative mouse mode is implemented using mouse warping
*
*/
#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
+/**
+ * \brief A variable controlling whether touch events should generate synthetic mouse events
+ *
+ * This variable can be set to the following values:
+ * "0" - Touch events will not generate mouse events
+ * "1" - Touch events will generate mouse events
+ *
+ * By default SDL will generate mouse events for touch events
+ */
+#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS"
+
+/**
+ * \brief A variable controlling whether mouse events should generate synthetic touch events
+ *
+ * This variable can be set to the following values:
+ * "0" - Mouse events will not generate touch events (default for desktop platforms)
+ * "1" - Mouse events will generate touch events (default for mobile platforms, such as Android and iOS)
+ */
+
+#define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS"
+
/**
* \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
*
#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
/**
- * \brief A variable controlling which orientations are allowed on iOS.
+ * \brief A variable controlling which orientations are allowed on iOS/Android.
*
* In some circumstances it is necessary to be able to explicitly control
* which UI orientations are allowed.
*/
#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
+/**
+ * \brief A variable controlling whether the home indicator bar on iPhone X
+ * should be hidden.
+ *
+ * This variable can be set to the following values:
+ * "0" - The indicator bar is not hidden (default for windowed applications)
+ * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications)
+ * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications)
+ */
+#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR"
+
/**
* \brief A variable controlling whether the Android / iOS built-in
- * accelerometer should be listed as a joystick device, rather than listing
- * actual joysticks only.
+ * accelerometer should be listed as a joystick device.
*
* This variable can be set to the following values:
- * "0" - List only real joysticks and accept input from them
- * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default).
+ * "0" - The accelerometer is not listed as a joystick
+ * "1" - The accelerometer is available as a 3 axis joystick (the default).
*/
#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
+/**
+ * \brief A variable controlling whether the Android / tvOS remotes
+ * should be listed as joystick devices, instead of sending keyboard events.
+ *
+ * This variable can be set to the following values:
+ * "0" - Remotes send enter/escape/arrow key events
+ * "1" - Remotes are available as 2 axis, 2 button joysticks (the default).
+ */
+#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK"
/**
* \brief A variable that lets you disable the detection and use of Xinput gamepad devices
*/
#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
-
/**
* \brief A variable that causes SDL to use the old axis and button mapping for XInput devices.
*
*/
#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
-
/**
- * \brief A variable that lets you manually hint extra gamecontroller db entries
+ * \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
*
*/
#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
+/**
+ * \brief A variable that lets you provide a file with extra gamecontroller db entries.
+ *
+ * The file should contain lines 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_FILE "SDL_GAMECONTROLLERCONFIG_FILE"
+
+/**
+ * \brief A variable containing a list of devices to skip when scanning for game controllers.
+ *
+ * The format of the string is a comma separated list of USB VID/PID pairs
+ * in hexadecimal form, e.g.
+ *
+ * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ * The variable can also take the form of @file, in which case the named
+ * file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES"
+
+/**
+ * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable.
+ *
+ * The format of the string is a comma separated list of USB VID/PID pairs
+ * in hexadecimal form, e.g.
+ *
+ * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ * The variable can also take the form of @file, in which case the named
+ * file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
/**
* \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
*/
#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
+/**
+ * \brief A variable controlling whether the HIDAPI joystick drivers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI drivers are not used
+ * "1" - HIDAPI drivers are used (the default)
+ *
+ * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below.
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4"
+
+/**
+ * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver.
+ *
+ * This variable can be set to the following values:
+ * "0" - extended reports are not enabled (the default)
+ * "1" - extended reports
+ *
+ * Extended input reports allow rumble on Bluetooth PS4 controllers, but
+ * break DirectInput handling for applications that don't use SDL.
+ *
+ * Once extended reports are enabled, they can not be disabled without
+ * power cycling the controller.
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX"
+
+/**
+ * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
+ *
+ * The variable can be set to the following values:
+ * "0" - Do not scan for Steam Controllers
+ * "1" - Scan for Steam Controllers (the default)
+ *
+ * The default value is "1". This hint must be set before initializing the joystick subsystem.
+ */
+#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS"
+
/**
* \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
*/
#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
-
/**
* \brief A variable that controls the timer resolution, in milliseconds.
*
#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
+/**
+ * \brief A variable describing the content orientation on QtWayland-based platforms.
+ *
+ * On QtWayland platforms, windows are rotated client-side to allow for custom
+ * transitions. In order to correctly position overlays (e.g. volume bar) and
+ * gestures (e.g. events view, close/minimize gestures), the system needs to
+ * know in which orientation the application is currently drawing its contents.
+ *
+ * This does not cause the window to be rotated or resized, the application
+ * needs to take care of drawing the content in the right orientation (the
+ * framebuffer is always in portrait mode).
+ *
+ * This variable can be one of the following values:
+ * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape"
+ */
+#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION"
+
+/**
+ * \brief Flags to set on QtWayland windows to integrate with the native window manager.
+ *
+ * On QtWayland platforms, this hint controls the flags to set on the windows.
+ * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures.
+ *
+ * This variable is a space-separated list of the following values (empty = no flags):
+ * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager"
+ */
+#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS"
/**
* \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size
* This is specially useful if you build SDL against a non glibc libc library (such as musl) which
* provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
* Support for this hint is currently available only in the pthread, Windows, and PSP backend.
+*
+* Instead of this hint, in 2.0.9 and later, you can use
+* SDL_CreateThreadWithStackSize(). This hint only works with the classic
+* SDL_CreateThread().
*/
#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE"
*/
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
+/**
+ * \brief A variable to control whether we trap the Android back button to handle it manually.
+ * This is necessary for the right mouse button to work on some Android devices, or
+ * to be able to trap the back button for use in your code reliably. If set to true,
+ * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of
+ * SDL_SCANCODE_AC_BACK.
+ *
+ * The variable can be set to the following values:
+ * "0" - Back button will be handled as usual for system. (default)
+ * "1" - Back button will be trapped, allowing you to handle the key press
+ * manually. (This will also let right mouse click work on systems
+ * where the right mouse button functions as back.)
+ *
+ * The value of this hint is used at runtime, so it can be changed at any time.
+ */
+#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON"
+
+/**
+ * \brief A variable to control whether the event loop will block itself when the app is paused.
+ *
+ * The variable can be set to the following values:
+ * "0" - Non blocking.
+ * "1" - Blocking. (default)
+ *
+ * The value should be set before SDL is initialized.
+ */
+#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE"
+
/**
- * \brief A variable to control whether mouse and touch events are to be treated together or separately
+ * \brief A variable to control whether the return key on the soft keyboard
+ * should hide the soft keyboard on Android and iOS.
*
* The variable can be set to the following values:
- * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse
- * events. This is the behaviour of SDL <= 2.0.3. (default)
- * "1" - Mouse events will be handled separately from pure touch events.
+ * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default)
+ * "1" - The return key will hide the keyboard.
*
* The value of this hint is used at runtime, so it can be changed at any time.
*/
-#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
+#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME"
/**
* \brief override the binding element for keyboard inputs for Emscripten builds
* "0" - SDL will generate a window-close event when it sees Alt+F4.
* "1" - SDL will only do normal key handling for Alt+F4.
*/
-#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
+#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
/**
* \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs.
#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
/**
- * \brief Tell SDL not to name threads on Windows.
+ * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
+ * The 0x406D1388 Exception is a trick used to inform Visual Studio of a
+ * thread's name, but it tends to cause problems with other debuggers,
+ * and the .NET runtime. Note that SDL 2.0.6 and later will still use
+ * the (safer) SetThreadDescription API, introduced in the Windows 10
+ * Creators Update, if available.
*
* The variable can be set to the following values:
* "0" - SDL will raise the 0x406D1388 Exception to name threads.
- * This is the default behavior of SDL <= 2.0.4. (default)
- * "1" - SDL will not raise this exception, and threads will be unnamed.
- * For .NET languages this is required when running under a debugger.
+ * This is the default behavior of SDL <= 2.0.4.
+ * "1" - SDL will not raise this exception, and threads will be unnamed. (default)
+ * This is necessary with .NET languages or debuggers that aren't Visual Studio.
*/
#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
*/
#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER"
+/**
+ * \brief Tell the video driver that we only want a double buffer.
+ *
+ * By default, most lowlevel 2D APIs will use a triple buffer scheme that
+ * wastes no CPU time on waiting for vsync after issuing a flip, but
+ * introduces a frame of latency. On the other hand, using a double buffer
+ * scheme instead is recommended for cases where low latency is an important
+ * factor because we save a whole frame of latency.
+ * We do so by waiting for vsync immediately after issuing a flip, usually just
+ * after eglSwapBuffers call in the backend's *_SwapWindow function.
+ *
+ * Since it's driver-specific, it's only supported where possible and
+ * implemented. Currently supported the following drivers:
+ * - KMSDRM (kmsdrm)
+ * - Raspberry Pi (raspberrypi)
+ */
+#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER"
+
+/**
+ * \brief A variable controlling what driver to use for OpenGL ES contexts.
+ *
+ * On some platforms, currently Windows and X11, OpenGL drivers may support
+ * creating contexts with an OpenGL ES profile. By default SDL uses these
+ * profiles, when available, otherwise it attempts to load an OpenGL ES
+ * library, e.g. that provided by the ANGLE project. This variable controls
+ * whether SDL follows this default behaviour or will always load an
+ * OpenGL ES library.
+ *
+ * Circumstances where this is useful include
+ * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE,
+ * or emulator, e.g. those from ARM, Imagination or Qualcomm.
+ * - Resolving OpenGL ES function addresses at link time by linking with
+ * the OpenGL ES library instead of querying them at run time with
+ * SDL_GL_GetProcAddress().
+ *
+ * Caution: for an application to work with the default behaviour across
+ * different OpenGL drivers it must query the OpenGL ES function
+ * addresses at run time using SDL_GL_GetProcAddress().
+ *
+ * This variable is ignored on most platforms because OpenGL ES is native
+ * or not supported.
+ *
+ * This variable can be set to the following values:
+ * "0" - Use ES profile of OpenGL, if available. (Default when not set.)
+ * "1" - Load OpenGL ES library using the default library names.
+ *
+ */
+#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER"
+
+/**
+ * \brief A variable controlling speed/quality tradeoff of audio resampling.
+ *
+ * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ )
+ * to handle audio resampling. There are different resampling modes available
+ * that produce different levels of quality, using more CPU.
+ *
+ * If this hint isn't specified to a valid setting, or libsamplerate isn't
+ * available, SDL will use the default, internal resampling algorithm.
+ *
+ * Note that this is currently only applicable to resampling audio that is
+ * being written to a device for playback or audio being read from a device
+ * for capture. SDL_AudioCVT always uses the default resampler (although this
+ * might change for SDL 2.1).
+ *
+ * This hint is currently only checked at audio subsystem initialization.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast)
+ * "1" or "fast" - Use fast, slightly higher quality resampling, if available
+ * "2" or "medium" - Use medium quality resampling, if available
+ * "3" or "best" - Use high quality resampling, if available
+ */
+#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE"
+
+/**
+ * \brief A variable controlling the audio category on iOS and Mac OS X
+ *
+ * This variable can be set to the following values:
+ *
+ * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default)
+ * "playback" - Use the AVAudioSessionCategoryPlayback category
+ *
+ * For more information, see Apple's documentation:
+ * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html
+ */
+#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY"
+
+/**
+ * \brief A variable controlling whether the 2D render API is compatible or efficient.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" - Don't use batching to make rendering more efficient.
+ * "1" - Use batching, but might cause problems if app makes its own direct OpenGL calls.
+ *
+ * Up to SDL 2.0.9, the render API would draw immediately when requested. Now
+ * it batches up draw requests and sends them all to the GPU only when forced
+ * to (during SDL_RenderPresent, when changing render targets, by updating a
+ * texture that the batch needs, etc). This is significantly more efficient,
+ * but it can cause problems for apps that expect to render on top of the
+ * render API's output. As such, SDL will disable batching if a specific
+ * render backend is requested (since this might indicate that the app is
+ * planning to use the underlying graphics API directly). This hint can
+ * be used to explicitly request batching in this instance. It is a contract
+ * that you will either never use the underlying graphics API directly, or
+ * if you do, you will call SDL_RenderFlush() before you do so any current
+ * batch goes to the GPU before your work begins. Not following this contract
+ * will result in undefined behavior.
+ */
+#define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING"
+
+
+/**
+ * \brief A variable controlling whether SDL logs all events pushed onto its internal queue.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" - Don't log any events (default)
+ * "1" - Log all events except mouse and finger motion, which are pretty spammy.
+ * "2" - Log all events.
+ *
+ * This is generally meant to be used to debug SDL itself, but can be useful
+ * for application developers that need better visibility into what is going
+ * on in the event queue. Logged events are sent through SDL_Log(), which
+ * means by default they appear on stdout on most platforms or maybe
+ * OutputDebugString() on Windows, and can be funneled by the app with
+ * SDL_LogSetOutputFunction(), etc.
+ *
+ * This hint can be toggled on and off at runtime, if you only need to log
+ * events for a small subset of program execution.
+ */
+#define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING"
+
+
+
+/**
+ * \brief Controls how the size of the RIFF chunk affects the loading of a WAVE file.
+ *
+ * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE
+ * file) is not always reliable. In case the size is wrong, it's possible to
+ * just ignore it and step through the chunks until a fixed limit is reached.
+ *
+ * Note that files that have trailing data unrelated to the WAVE file or
+ * corrupt files may slow down the loading process without a reliable boundary.
+ * By default, SDL stops after 10000 chunks to prevent wasting time. Use the
+ * environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value.
+ *
+ * This variable can be set to the following values:
+ *
+ * "force" - Always use the RIFF chunk size as a boundary for the chunk search
+ * "ignorezero" - Like "force", but a zero size searches up to 4 GiB (default)
+ * "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB
+ * "maximum" - Search for chunks until the end of file (not recommended)
+ */
+#define SDL_HINT_WAVE_RIFF_CHUNK_SIZE "SDL_WAVE_RIFF_CHUNK_SIZE"
+
+/**
+ * \brief Controls how a truncated WAVE file is handled.
+ *
+ * A WAVE file is considered truncated if any of the chunks are incomplete or
+ * the data chunk size is not a multiple of the block size. By default, SDL
+ * decodes until the first incomplete block, as most applications seem to do.
+ *
+ * This variable can be set to the following values:
+ *
+ * "verystrict" - Raise an error if the file is truncated
+ * "strict" - Like "verystrict", but the size of the RIFF chunk is ignored
+ * "dropframe" - Decode until the first incomplete sample frame
+ * "dropblock" - Decode until the first incomplete block (default)
+ */
+#define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION"
+
+/**
+ * \brief Controls how the fact chunk affects the loading of a WAVE file.
+ *
+ * The fact chunk stores information about the number of samples of a WAVE
+ * file. The Standards Update from Microsoft notes that this value can be used
+ * to 'determine the length of the data in seconds'. This is especially useful
+ * for compressed formats (for which this is a mandatory chunk) if they produce
+ * multiple sample frames per block and truncating the block is not allowed.
+ * The fact chunk can exactly specify how many sample frames there should be
+ * in this case.
+ *
+ * Unfortunately, most application seem to ignore the fact chunk and so SDL
+ * ignores it by default as well.
+ *
+ * This variable can be set to the following values:
+ *
+ * "truncate" - Use the number of samples to truncate the wave data if
+ * the fact chunk is present and valid
+ * "strict" - Like "truncate", but raise an error if the fact chunk
+ * is invalid, not present for non-PCM formats, or if the
+ * data chunk doesn't have that many samples
+ * "ignorezero" - Like "truncate", but ignore fact chunk if the number of
+ * samples is zero
+ * "ignore" - Ignore fact chunk entirely (default)
+ */
+#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK"
+
/**
* \brief An enumeration of hint priorities
*/
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value);
+/**
+ * \brief type definition of the hint callback function.
+ */
+typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
+
/**
* \brief Add a function to watch a particular hint
*
* \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);
#endif
#include "close_code.h"
-#endif /* _SDL_hints_h */
+#endif /* SDL_hints_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*
*/
-#ifndef _SDL_joystick_h
-#define _SDL_joystick_h
+#ifndef SDL_joystick_h_
+#define SDL_joystick_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/
-/* The joystick structure used to identify an SDL joystick */
+/**
+ * The joystick structure used to identify an SDL joystick
+ */
struct _SDL_Joystick;
typedef struct _SDL_Joystick SDL_Joystick;
Uint8 data[16];
} SDL_JoystickGUID;
+/**
+ * This is a unique ID for a joystick for the time it is connected to the system,
+ * and is never reused for the lifetime of the application. If the joystick is
+ * disconnected and reconnected, it will get a new ID.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
typedef Sint32 SDL_JoystickID;
+typedef enum
+{
+ SDL_JOYSTICK_TYPE_UNKNOWN,
+ SDL_JOYSTICK_TYPE_GAMECONTROLLER,
+ SDL_JOYSTICK_TYPE_WHEEL,
+ SDL_JOYSTICK_TYPE_ARCADE_STICK,
+ SDL_JOYSTICK_TYPE_FLIGHT_STICK,
+ SDL_JOYSTICK_TYPE_DANCE_PAD,
+ SDL_JOYSTICK_TYPE_GUITAR,
+ SDL_JOYSTICK_TYPE_DRUM_KIT,
+ SDL_JOYSTICK_TYPE_ARCADE_PAD,
+ SDL_JOYSTICK_TYPE_THROTTLE
+} SDL_JoystickType;
+
typedef enum
{
SDL_JOYSTICK_POWER_UNKNOWN = -1,
- SDL_JOYSTICK_POWER_EMPTY,
- SDL_JOYSTICK_POWER_LOW,
- SDL_JOYSTICK_POWER_MEDIUM,
- SDL_JOYSTICK_POWER_FULL,
+ SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */
+ SDL_JOYSTICK_POWER_LOW, /* <= 20% */
+ SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */
+ SDL_JOYSTICK_POWER_FULL, /* <= 100% */
SDL_JOYSTICK_POWER_WIRED,
SDL_JOYSTICK_POWER_MAX
} SDL_JoystickPowerLevel;
/* Function prototypes */
+
+/**
+ * Locking for multi-threaded access to the joystick API
+ *
+ * If you are using the joystick API or handling events from multiple threads
+ * you should use these locking functions to protect access to the joysticks.
+ *
+ * In particular, you are guaranteed that the joystick list won't change, so
+ * the API functions that take a joystick index will be valid, and joystick
+ * and game controller events will not be delivered.
+ */
+extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
+extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
+
/**
* Count the number of joysticks attached to the system right now
*/
*/
extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
+/**
+ * Get the player index of a joystick, or -1 if it's not available
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
+
+/**
+ * Return the GUID for the joystick at this index
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+
+/**
+ * Get the USB vendor ID of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
+
+/**
+ * Get the USB product ID of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
+
+/**
+ * Get the product version of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
+
+/**
+ * Get the type of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
+
+/**
+ * Get the instance ID of a joystick.
+ * This can be called before any joysticks are opened.
+ * If the index is out of range, this function will return -1.
+ */
+extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
+
/**
* Open a joystick for use.
* The index passed as an argument refers to the N'th joystick on the system.
extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
/**
- * Return the GUID for the joystick at this index
+ * Get the player index of an opened joystick, or -1 if it's not available
+ *
+ * For XInput controllers this returns the XInput user index.
*/
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick);
/**
* Return the GUID for this opened joystick
*/
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
+/**
+ * Get the USB vendor ID of an opened joystick, if available.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick);
+
+/**
+ * Get the USB product ID of an opened joystick, if available.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
+
+/**
+ * Get the product version of an opened joystick, if available.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
+
+/**
+ * Get the type of an opened joystick.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(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 SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
/**
- * convert a string into a joystick formatted guid
+ * Convert a string into a joystick guid
*/
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
*/
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
+#define SDL_JOYSTICK_AXIS_MAX 32767
+#define SDL_JOYSTICK_AXIS_MIN -32768
/**
* Get the current state of an axis control on a joystick.
*
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
int axis);
+/**
+ * Get the initial 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.
+ *
+ * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,
+ int axis, Sint16 *state);
+
/**
* \name Hat positions
*/
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
int button);
+/**
+ * Trigger a rumble effect
+ * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
+ *
+ * \param joystick The joystick to vibrate
+ * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF
+ * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
+ * \param duration_ms The duration of the rumble effect, in milliseconds
+ *
+ * \return 0, or -1 if rumble isn't supported on this joystick
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
+
/**
* Close a joystick previously opened with SDL_JoystickOpen().
*/
#endif
#include "close_code.h"
-#endif /* _SDL_joystick_h */
+#endif /* SDL_joystick_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL keyboard event handling
*/
-#ifndef _SDL_keyboard_h
-#define _SDL_keyboard_h
+#ifndef SDL_keyboard_h_
+#define SDL_keyboard_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
#include "close_code.h"
-#endif /* _SDL_keyboard_h */
+#endif /* SDL_keyboard_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Defines constants which identify keyboard keys and modifiers.
*/
-#ifndef _SDL_keycode_h
-#define _SDL_keycode_h
+#ifndef SDL_keycode_h_
+#define SDL_keycode_h_
#include "SDL_stdinc.h"
#include "SDL_scancode.h"
* 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.
+ *
+ * A special exception is the number keys at the top of the keyboard which
+ * always map to SDLK_0...SDLK_9, regardless of layout.
*/
typedef Sint32 SDL_Keycode;
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)
+ SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
+ SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
+ SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
+
+ SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
+ SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
};
/**
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
-#endif /* _SDL_keycode_h */
+#endif /* SDL_keycode_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* the results you expect. :)
*/
-#ifndef _SDL_loadso_h
-#define _SDL_loadso_h
+#ifndef SDL_loadso_h_
+#define SDL_loadso_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
#include "close_code.h"
-#endif /* _SDL_loadso_h */
+#endif /* SDL_loadso_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Others: standard error output (stderr)
*/
-#ifndef _SDL_log_h
-#define _SDL_log_h
+#ifndef SDL_log_h_
+#define SDL_log_h_
#include "SDL_stdinc.h"
/**
* \brief The prototype for the log output function
*/
-typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
+typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
/**
* \brief Get the current log output function.
#endif
#include "close_code.h"
-#endif /* _SDL_log_h */
+#endif /* SDL_log_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_main_h
-#define _SDL_main_h
+#ifndef SDL_main_h_
+#define SDL_main_h_
#include "SDL_stdinc.h"
/* On iOS SDL provides a main function that creates an application delegate
and starts the iOS application run loop.
+ If you link with SDL dynamically on iOS, the main function can't be in a
+ shared library, so you need to link with libSDLmain.a, which includes a
+ stub main function that calls into the shared library to start execution.
+
See src/video/uikit/SDL_uikitappdelegate.m for more details.
*/
#define SDL_MAIN_NEEDED
/* On Android SDL provides a Java class in SDLActivity.java that is the
main activity entry point.
- See README-android.md for more details on extending that class.
+ See docs/README-android.md for more details on extending that class.
*/
#define SDL_MAIN_NEEDED
+/* We need to export SDL_main so it can be launched from Java */
+#define SDLMAIN_DECLSPEC DECLSPEC
+
#elif defined(__NACL__)
/* On NACL we use ppapi_simple to set up the application helper code,
then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before
#endif
#endif /* SDL_MAIN_HANDLED */
-#ifdef __cplusplus
-#define C_LINKAGE "C"
-#else
-#define C_LINKAGE
-#endif /* __cplusplus */
+#ifndef SDLMAIN_DECLSPEC
+#define SDLMAIN_DECLSPEC
+#endif
/**
* \file SDL_main.h
#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
+/**
+ * The prototype for the application's main() function
+ */
+typedef int (*SDL_main_func)(int argc, char *argv[]);
+extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
+
+
/**
* This is called by the real SDL main function to let the rest of the
* library know that initialization was done properly.
/**
* 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 int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#endif /* __WIN32__ */
* \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
* information on the failure.
*/
-extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved);
+extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved);
#endif /* __WINRT__ */
+#if defined(__IPHONEOS__)
+
+/**
+ * \brief Initializes and launches an SDL application.
+ *
+ * \param argc The argc parameter from the application's main() function
+ * \param argv The argv parameter from the application's main() function
+ * \param mainFunction The SDL app's C-style main().
+ * \return the return value from mainFunction
+ */
+extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction);
+
+#endif /* __IPHONEOS__ */
+
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_main_h */
+#endif /* SDL_main_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_messagebox_h
-#define _SDL_messagebox_h
+#ifndef SDL_messagebox_h_
+#define SDL_messagebox_h_
#include "SDL_stdinc.h"
#include "SDL_video.h" /* For SDL_Window */
#endif
#include "close_code.h"
-#endif /* _SDL_messagebox_h */
+#endif /* SDL_messagebox_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL mouse event handling.
*/
-#ifndef _SDL_mouse_h
-#define _SDL_mouse_h
+#ifndef SDL_mouse_h_
+#define SDL_mouse_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
extern "C" {
#endif
-typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */
+typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
/**
* \brief Cursor types for SDL_CreateSystemCursor().
#endif
#include "close_code.h"
-#endif /* _SDL_mouse_h */
+#endif /* SDL_mouse_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_mutex_h
-#define _SDL_mutex_h
+#ifndef SDL_mutex_h_
+#define SDL_mutex_h_
/**
* \file SDL_mutex.h
#endif
#include "close_code.h"
-#endif /* _SDL_mutex_h */
+#endif /* SDL_mutex_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDLname_h_
-#define _SDLname_h_
+#ifndef SDLname_h_
+#define SDLname_h_
#if defined(__STDC__) || defined(__cplusplus)
#define NeedFunctionPrototypes 1
#define SDL_NAME(X) SDL_##X
-#endif /* _SDLname_h_ */
+#endif /* SDLname_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* version included in SDL_opengl.h.
*/
-#ifndef _SDL_opengl_h
-#define _SDL_opengl_h
+#ifndef SDL_opengl_h_
+#define SDL_opengl_h_
#include "SDL_config.h"
#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
# define GLAPI extern
# define GLAPIENTRY __stdcall
+#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */
+# define GLAPI extern
+# define GLAPIENTRY _System
+# define APIENTRY _System
+# if defined(__GNUC__) && !defined(_System)
+# define _System
+# endif
#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
# define GLAPI __attribute__((visibility("default")))
# define GLAPIENTRY
#endif /* !__IPHONEOS__ */
-#endif /* _SDL_opengl_h */
+#endif /* SDL_opengl_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header for the enumerated pixel format definitions.
*/
-#ifndef _SDL_pixels_h
-#define _SDL_pixels_h
+#ifndef SDL_pixels_h_
+#define SDL_pixels_h_
#include "SDL_stdinc.h"
#include "SDL_endian.h"
((format) && (SDL_PIXELFLAG(format) != 1))
/* Note: If you modify this list, update SDL_GetPixelFormatName() */
-enum
+typedef enum
{
SDL_PIXELFORMAT_UNKNOWN,
SDL_PIXELFORMAT_INDEX1LSB =
SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
- SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1')
-};
+ SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
+ SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
+ SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
+} SDL_PixelFormatEnum;
typedef struct SDL_Color
{
#endif
#include "close_code.h"
-#endif /* _SDL_pixels_h */
+#endif /* SDL_pixels_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Try to get a standard set of platform defines.
*/
-#ifndef _SDL_platform_h
-#define _SDL_platform_h
+#ifndef SDL_platform_h_
+#define SDL_platform_h_
#if defined(_AIX)
#undef __AIX__
#undef __OPENBSD__
#define __OPENBSD__ 1
#endif
-#if defined(__OS2__)
+#if defined(__OS2__) || defined(__EMX__)
#undef __OS2__
#define __OS2__ 1
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT or non-WinRT */
-/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
-#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */
+#if defined(_MSC_VER) && defined(__has_include)
+#if __has_include(<winapifamily.h>)
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
+#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+#if HAVE_WINAPIFAMILY_H
#include <winapifamily.h>
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#undef __WINDOWS__
-#define __WINDOWS__ 1
-/* See if we're compiling for WinRT: */
-#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
+#else
+#define WINAPI_FAMILY_WINRT 0
+#endif /* HAVE_WINAPIFAMILY_H */
+
+#if WINAPI_FAMILY_WINRT
#undef __WINRT__
#define __WINRT__ 1
-#endif
#else
#undef __WINDOWS__
-#define __WINDOWS__ 1
-#endif /* _MSC_VER < 1700 */
+#define __WINDOWS__ 1
+#endif
#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
#if defined(__WINDOWS__)
#endif
#include "close_code.h"
-#endif /* _SDL_platform_h */
+#endif /* SDL_platform_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_power_h
-#define _SDL_power_h
+#ifndef SDL_power_h_
+#define SDL_power_h_
/**
* \file SDL_power.h
#endif
#include "close_code.h"
-#endif /* _SDL_power_h */
+#endif /* SDL_power_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL quit event handling.
*/
-#ifndef _SDL_quit_h
-#define _SDL_quit_h
+#ifndef SDL_quit_h_
+#define SDL_quit_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#define SDL_QuitRequested() \
(SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
-#endif /* _SDL_quit_h */
+#endif /* SDL_quit_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file for SDL_rect definition and management functions.
*/
-#ifndef _SDL_rect_h
-#define _SDL_rect_h
+#ifndef SDL_rect_h_
+#define SDL_rect_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
/**
- * \brief The structure that defines a point
+ * \brief The structure that defines a point (integer)
*
* \sa SDL_EnclosePoints
* \sa SDL_PointInRect
} SDL_Point;
/**
- * \brief A rectangle, with the origin at the upper left.
+ * \brief The structure that defines a point (floating point)
+ *
+ * \sa SDL_EnclosePoints
+ * \sa SDL_PointInRect
+ */
+typedef struct SDL_FPoint
+{
+ float x;
+ float y;
+} SDL_FPoint;
+
+
+/**
+ * \brief A rectangle, with the origin at the upper left (integer).
*
* \sa SDL_RectEmpty
* \sa SDL_RectEquals
int w, h;
} SDL_Rect;
+
+/**
+ * \brief A rectangle, with the origin at the upper left (floating point).
+ */
+typedef struct SDL_FRect
+{
+ float x;
+ float y;
+ float w;
+ float h;
+} SDL_FRect;
+
+
/**
* \brief Returns true if point resides inside a rectangle.
*/
#endif
#include "close_code.h"
-#endif /* _SDL_rect_h */
+#endif /* SDL_rect_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
*/
-#ifndef _SDL_render_h
-#define _SDL_render_h
+#ifndef SDL_render_h_
+#define SDL_render_h_
#include "SDL_stdinc.h"
#include "SDL_rect.h"
* active, the format was unsupported, or the width or height were out
* of range.
*
+ * \note The contents of the texture are not defined at creation.
+ *
* \sa SDL_QueryTexture()
* \sa SDL_UpdateTexture()
* \sa SDL_DestroyTexture()
* \param texture The texture to update
* \param rect A pointer to the rectangle of pixels to update, or NULL to
* update the entire texture.
- * \param pixels The raw pixel data.
+ * \param pixels The raw pixel data in the format of the texture.
* \param pitch The number of bytes in a row of pixel data, including padding between lines.
*
+ * The pixel data must be in the format of the texture. The pixel format can be
+ * queried with SDL_QueryTexture.
+ *
* \return 0 on success, or -1 if the texture is not valid.
*
* \note This is a fairly slow function.
* texture.
* \param dstrect A pointer to the destination rectangle, or NULL for the
* entire rendering target.
- * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect
+ * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
* \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
* \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
*
const SDL_Point *center,
const SDL_RendererFlip flip);
+
+/**
+ * \brief Draw a point on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a point.
+ * \param x The x coordinate of the point.
+ * \param y The y coordinate of the point.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer,
+ float x, float y);
+
+/**
+ * \brief Draw multiple points on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple points.
+ * \param points The points to draw
+ * \param count The number of points to draw
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer,
+ const SDL_FPoint * points,
+ int count);
+
+/**
+ * \brief Draw a line on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a line.
+ * \param x1 The x coordinate of the start point.
+ * \param y1 The y coordinate of the start point.
+ * \param x2 The x coordinate of the end point.
+ * \param y2 The y coordinate of the end point.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer,
+ float x1, float y1, float x2, float y2);
+
+/**
+ * \brief Draw a series of connected lines on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple lines.
+ * \param points The points along the lines
+ * \param count The number of points, drawing count-1 lines
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer,
+ const SDL_FPoint * points,
+ int count);
+
+/**
+ * \brief Draw a rectangle on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a rectangle.
+ * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer,
+ const SDL_FRect * rect);
+
+/**
+ * \brief Draw some number of rectangles on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple rectangles.
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer,
+ const SDL_FRect * rects,
+ int count);
+
+/**
+ * \brief Fill a rectangle on the current rendering target with the drawing color.
+ *
+ * \param renderer The renderer which should fill a rectangle.
+ * \param rect A pointer to the destination rectangle, or NULL for the entire
+ * rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer,
+ const SDL_FRect * rect);
+
+/**
+ * \brief Fill some number of rectangles on the current rendering target with the drawing color.
+ *
+ * \param renderer The renderer which should fill multiple rectangles.
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer,
+ const SDL_FRect * rects,
+ int count);
+
+/**
+ * \brief Copy a portion of the texture to the current rendering target.
+ *
+ * \param renderer The renderer which should copy parts of a texture.
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_FRect * dstrect);
+
+/**
+ * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
+ *
+ * \param renderer The renderer which should copy parts of a texture.
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
+ * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
+ * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_FRect * dstrect,
+ const double angle,
+ const SDL_FPoint *center,
+ const SDL_RendererFlip flip);
+
/**
* \brief Read pixels from the current rendering target.
*
*/
extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
+/**
+ * \brief Force the rendering context to flush any pending commands to the
+ * underlying rendering API.
+ *
+ * You do not need to (and in fact, shouldn't) call this function unless
+ * you are planning to call into OpenGL/Direct3D/Metal/whatever directly
+ * in addition to using an SDL_Renderer.
+ *
+ * This is for a very-specific case: if you are using SDL's render API,
+ * you asked for a specific renderer backend (OpenGL, Direct3D, etc),
+ * you set SDL_HINT_RENDER_BATCHING to "1", and you plan to make
+ * OpenGL/D3D/whatever calls in addition to SDL render API calls. If all of
+ * this applies, you should call SDL_RenderFlush() between calls to SDL's
+ * render API and the low-level API you're using in cooperation.
+ *
+ * In all other cases, you can ignore this function. This is only here to
+ * get maximum performance out of a specific situation. In all other cases,
+ * SDL will do the right thing, perhaps at a performance loss.
+ *
+ * This function is first available in SDL 2.0.10, and is not needed in
+ * 2.0.9 and earlier, as earlier versions did not queue rendering commands
+ * at all, instead flushing them to the OS immediately.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer * renderer);
+
/**
* \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
*/
extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
+/**
+ * \brief Get the CAMetalLayer associated with the given Metal renderer
+ *
+ * \param renderer The renderer to query
+ *
+ * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer
+ *
+ * \sa SDL_RenderGetMetalCommandEncoder()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
+
+/**
+ * \brief Get the Metal command encoder for the current frame
+ *
+ * \param renderer The renderer to query
+ *
+ * \return id<MTLRenderCommandEncoder> on success, or NULL if the renderer isn't a Metal renderer
+ *
+ * \sa SDL_RenderGetMetalLayer()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
#endif
#include "close_code.h"
-#endif /* _SDL_render_h */
+#endif /* SDL_render_h_ */
/* vi: set ts=4 sw=4 expandtab: */
-#define SDL_REVISION "hg-10556:007dfe83abf8"
-#define SDL_REVISION_NUMBER 10556
+#define SDL_REVISION "hg-12952:bc90ce38f1e2"
+#define SDL_REVISION_NUMBER 12952
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* data streams. It can easily be extended to files, memory, etc.
*/
-#ifndef _SDL_rwops_h
-#define _SDL_rwops_h
+#ifndef SDL_rwops_h_
+#define SDL_rwops_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
/* RWops Types */
-#define SDL_RWOPS_UNKNOWN 0U /* Unknown stream type */
-#define SDL_RWOPS_WINFILE 1U /* Win32 file */
-#define SDL_RWOPS_STDFILE 2U /* Stdio file */
-#define SDL_RWOPS_JNIFILE 3U /* Android asset */
-#define SDL_RWOPS_MEMORY 4U /* Memory stream */
-#define SDL_RWOPS_MEMORY_RO 5U /* Read-Only memory stream */
+#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */
+#define SDL_RWOPS_WINFILE 1U /**< Win32 file */
+#define SDL_RWOPS_STDFILE 2U /**< Stdio file */
+#define SDL_RWOPS_JNIFILE 3U /**< Android asset */
+#define SDL_RWOPS_MEMORY 4U /**< Memory stream */
+#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */
/**
* This is the read/write operation structure -- very basic.
#define RW_SEEK_END 2 /**< Seek relative to the end of data */
/**
- * \name Read/write macros
+ * Return the size of the file in this rwops, or -1 if unknown
+ */
+extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
+
+/**
+ * Seek to \c offset relative to \c whence, one of stdio's whence values:
+ * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
*
- * Macros to easily read and write from an SDL_RWops structure.
+ * \return the final offset in the data stream, or -1 on error.
*/
-/* @{ */
-#define SDL_RWsize(ctx) (ctx)->size(ctx)
-#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
-#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
-#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
-#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
-#define SDL_RWclose(ctx) (ctx)->close(ctx)
-/* @} *//* Read/write macros */
+extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context,
+ Sint64 offset, int whence);
+
+/**
+ * Return the current offset in the data stream, or -1 on error.
+ */
+extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context);
+
+/**
+ * Read up to \c maxnum objects each of size \c size from the data
+ * stream to the area pointed at by \c ptr.
+ *
+ * \return the number of objects read, or 0 at error or end of file.
+ */
+extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context,
+ void *ptr, size_t size, size_t maxnum);
+
+/**
+ * Write exactly \c num objects each of size \c size from the area
+ * pointed at by \c ptr to data stream.
+ *
+ * \return the number of objects written, or 0 at error or end of file.
+ */
+extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context,
+ const void *ptr, size_t size, size_t num);
+
+/**
+ * Close and free an allocated SDL_RWops structure.
+ *
+ * \return 0 if successful or -1 on write error when flushing data.
+ */
+extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context);
+/**
+ * Load all the data from an SDL data stream.
+ *
+ * The data is allocated with a zero byte at the end (null terminated)
+ *
+ * If \c datasize is not NULL, it is filled with the size of the data read.
+ *
+ * If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ * The data should be freed with SDL_free().
+ *
+ * \return the data, or NULL if there was an error.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize,
+ int freesrc);
+
+/**
+ * Load an entire file.
+ *
+ * The data is allocated with a zero byte at the end (null terminated)
+ *
+ * If \c datasize is not NULL, it is filled with the size of the data read.
+ *
+ * If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ * The data should be freed with SDL_free().
+ *
+ * \return the data, or NULL if there was an error.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
/**
* \name Read endian functions
#endif
#include "close_code.h"
-#endif /* _SDL_rwops_h */
+#endif /* SDL_rwops_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Defines keyboard scancodes.
*/
-#ifndef _SDL_scancode_h
-#define _SDL_scancode_h
+#ifndef SDL_scancode_h_
+#define SDL_scancode_h_
#include "SDL_stdinc.h"
* SDL_Event structure.
*
* The values in this enumeration are based on the USB usage page standard:
- * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
+ * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
*/
typedef enum
{
/* @} *//* Walther keys */
+ /**
+ * \name Usage page 0x0C (additional media keys)
+ *
+ * These values are mapped from usage page 0x0C (USB consumer page).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_AUDIOREWIND = 285,
+ SDL_SCANCODE_AUDIOFASTFORWARD = 286,
+
+ /* @} *//* Usage page 0x0C (additional media keys) */
+
/* Add any other keys here. */
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
for array bounds */
} SDL_Scancode;
-#endif /* _SDL_scancode_h */
+#endif /* SDL_scancode_h_ */
/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2019 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_sensor.h
+ *
+ * Include file for SDL sensor event handling
+ *
+ */
+
+#ifndef SDL_sensor_h_
+#define SDL_sensor_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
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/**
+ * \brief SDL_sensor.h
+ *
+ * In order to use these functions, SDL_Init() must have been called
+ * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system
+ * for sensors, and load appropriate drivers.
+ */
+
+struct _SDL_Sensor;
+typedef struct _SDL_Sensor SDL_Sensor;
+
+/**
+ * This is a unique ID for a sensor for the time it is connected to the system,
+ * and is never reused for the lifetime of the application.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
+typedef Sint32 SDL_SensorID;
+
+/* The different sensors defined by SDL
+ *
+ * Additional sensors may be available, using platform dependent semantics.
+ *
+ * Hare are the additional Android sensors:
+ * https://developer.android.com/reference/android/hardware/SensorEvent.html#values
+ */
+typedef enum
+{
+ SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */
+ SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */
+ SDL_SENSOR_ACCEL, /**< Accelerometer */
+ SDL_SENSOR_GYRO /**< Gyroscope */
+} SDL_SensorType;
+
+/**
+ * Accelerometer sensor
+ *
+ * The accelerometer returns the current acceleration in SI meters per
+ * second squared. This includes gravity, so a device at rest will have
+ * an acceleration of SDL_STANDARD_GRAVITY straight down.
+ *
+ * values[0]: Acceleration on the x axis
+ * values[1]: Acceleration on the y axis
+ * values[2]: Acceleration on the z axis
+ *
+ * For phones held in portrait mode, the axes are defined as follows:
+ * -X ... +X : left ... right
+ * -Y ... +Y : bottom ... top
+ * -Z ... +Z : farther ... closer
+ *
+ * The axis data is not changed when the phone is rotated.
+ *
+ * \sa SDL_GetDisplayOrientation()
+ */
+#define SDL_STANDARD_GRAVITY 9.80665f
+
+/**
+ * Gyroscope sensor
+ *
+ * The gyroscope returns the current rate of rotation in radians per second.
+ * The rotation is positive in the counter-clockwise direction. That is,
+ * an observer looking from a positive location on one of the axes would
+ * see positive rotation on that axis when it appeared to be rotating
+ * counter-clockwise.
+ *
+ * values[0]: Angular speed around the x axis
+ * values[1]: Angular speed around the y axis
+ * values[2]: Angular speed around the z axis
+ *
+ * For phones held in portrait mode, the axes are defined as follows:
+ * -X ... +X : left ... right
+ * -Y ... +Y : bottom ... top
+ * -Z ... +Z : farther ... closer
+ *
+ * The axis data is not changed when the phone is rotated.
+ *
+ * \sa SDL_GetDisplayOrientation()
+ */
+
+/* Function prototypes */
+
+/**
+ * \brief Count the number of sensors attached to the system right now
+ */
+extern DECLSPEC int SDLCALL SDL_NumSensors(void);
+
+/**
+ * \brief Get the implementation dependent name of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor name, or NULL if device_index is out of range.
+ */
+extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
+
+/**
+ * \brief Get the type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range.
+ */
+extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index);
+
+/**
+ * \brief Get the platform dependent type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor platform dependent type, or -1 if device_index is out of range.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index);
+
+/**
+ * \brief Get the instance ID of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor instance ID, or -1 if device_index is out of range.
+ */
+extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index);
+
+/**
+ * \brief Open a sensor for use.
+ *
+ * The index passed as an argument refers to the N'th sensor on the system.
+ *
+ * \return A sensor identifier, or NULL if an error occurred.
+ */
+extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
+
+/**
+ * Return the SDL_Sensor associated with an instance id.
+ */
+extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id);
+
+/**
+ * \brief Get the implementation dependent name of a sensor.
+ *
+ * \return The sensor name, or NULL if the sensor is NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
+
+/**
+ * \brief Get the type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL.
+ */
+extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
+
+/**
+ * \brief Get the platform dependent type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor platform dependent type, or -1 if the sensor is NULL.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
+
+/**
+ * \brief Get the instance ID of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor instance ID, or -1 if the sensor is NULL.
+ */
+extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor);
+
+/**
+ * Get the current state of an opened sensor.
+ *
+ * The number of values and interpretation of the data is sensor dependent.
+ *
+ * \param sensor The sensor to query
+ * \param data A pointer filled with the current sensor state
+ * \param num_values The number of values to write to data
+ *
+ * \return 0 or -1 if an error occurred.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values);
+
+/**
+ * Close a sensor previously opened with SDL_SensorOpen()
+ */
+extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor);
+
+/**
+ * Update the current state of the open sensors.
+ *
+ * This is called automatically by the event loop if sensor events are enabled.
+ *
+ * This needs to be called from the thread that initialized the sensor subsystem.
+ */
+extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* SDL_sensor_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_shape_h
-#define _SDL_shape_h
+#ifndef SDL_shape_h_
+#define SDL_shape_h_
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
* \param window The window to query for being shaped.
*
* \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
+ *
* \sa SDL_CreateShapedWindow
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
/** \brief A union containing parameters for shaped windows. */
typedef union {
- /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
+ /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */
Uint8 binarizationCutoff;
SDL_Color colorKey;
} SDL_WindowShapeParams;
* \param shape A surface encoding the desired shape for the window.
* \param shape_mode The parameters to set for the shaped window.
*
- * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
- * if the SDL_Window* given does not reference a valid shaped window.
+ * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
+ * if the SDL_Window given does not reference a valid shaped window.
*
* \sa SDL_WindowShapeMode
* \sa SDL_GetShapedWindowMode.
*
* \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
* data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
- * the SDL_Window* given is a shapeable window currently lacking a shape.
+ * the SDL_Window given is a shapeable window currently lacking a shape.
*
* \sa SDL_WindowShapeMode
* \sa SDL_SetWindowShape
#endif
#include "close_code.h"
-#endif /* _SDL_shape_h */
+#endif /* SDL_shape_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* This is a general header that includes C language support.
*/
-#ifndef _SDL_stdinc_h
-#define _SDL_stdinc_h
+#ifndef SDL_stdinc_h_
+#define SDL_stdinc_h_
#include "SDL_config.h"
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#elif defined(HAVE_STDINT_H)
#ifdef HAVE_FLOAT_H
# include <float.h>
#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
/**
* The number of elements in an array.
*/
/* @{ */
+#ifdef __CC_ARM
+/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
+#define SDL_FALSE 0
+#define SDL_TRUE 1
+typedef int SDL_bool;
+#else
typedef enum
{
SDL_FALSE = 0,
SDL_TRUE = 1
} SDL_bool;
+#endif
/**
* \brief A signed 8-bit integer type.
*/
+#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
+#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
typedef int8_t Sint8;
/**
* \brief An unsigned 8-bit integer type.
*/
+#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
+#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
typedef uint8_t Uint8;
/**
* \brief A signed 16-bit integer type.
*/
+#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
+#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
typedef int16_t Sint16;
/**
* \brief An unsigned 16-bit integer type.
*/
+#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
+#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
typedef uint16_t Uint16;
/**
* \brief A signed 32-bit integer type.
*/
+#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
+#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
typedef int32_t Sint32;
/**
* \brief An unsigned 32-bit integer type.
*/
+#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
+#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
typedef uint32_t Uint32;
/**
* \brief A signed 64-bit integer type.
*/
+#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
+#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
typedef int64_t Sint64;
/**
* \brief An unsigned 64-bit integer type.
*/
+#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
+#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
typedef uint64_t Uint64;
/* @} *//* Basic data types */
#endif /* SDL_DISABLE_ANALYZE_MACROS */
#define SDL_COMPILE_TIME_ASSERT(name, x) \
- typedef int SDL_dummy_ ## name[(x) * 2 - 1]
+ typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
extern "C" {
#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)
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
extern DECLSPEC void SDLCALL SDL_free(void *mem);
+typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
+typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
+typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
+typedef void (SDLCALL *SDL_free_func)(void *mem);
+
+/**
+ * \brief Get the current set of SDL memory functions
+ */
+extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
+ SDL_calloc_func *calloc_func,
+ SDL_realloc_func *realloc_func,
+ SDL_free_func *free_func);
+
+/**
+ * \brief Replace SDL's memory allocation functions with a custom set
+ *
+ * \note If you are replacing SDL's memory functions, you should call
+ * SDL_GetNumAllocations() and be very careful if it returns non-zero.
+ * That means that your free function will be called with memory
+ * allocated by the previous memory allocation functions.
+ */
+extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
+ SDL_calloc_func calloc_func,
+ SDL_realloc_func realloc_func,
+ SDL_free_func free_func);
+
+/**
+ * \brief Get the number of outstanding (unfreed) allocations
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
+
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
return;
switch (dwords % 4)
{
- case 0: do { *_p++ = _val;
- case 3: *_p++ = _val;
- case 2: *_p++ = _val;
- case 1: *_p++ = _val;
+ case 0: do { *_p++ = _val; /* fallthrough */
+ case 3: *_p++ = _val; /* fallthrough */
+ case 2: *_p++ = _val; /* fallthrough */
+ case 1: *_p++ = _val; /* fallthrough */
} while ( --_n );
}
#endif
}
-
extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
+extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
+extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
#ifndef HAVE_M_PI
#ifndef M_PI
-#define M_PI 3.14159265358979323846264338327950288 /* pi */
+#define M_PI 3.14159265358979323846264338327950288 /**< pi */
#endif
#endif
extern DECLSPEC double SDLCALL SDL_acos(double x);
+extern DECLSPEC float SDLCALL SDL_acosf(float x);
extern DECLSPEC double SDLCALL SDL_asin(double x);
+extern DECLSPEC float SDLCALL SDL_asinf(float x);
extern DECLSPEC double SDLCALL SDL_atan(double x);
+extern DECLSPEC float SDLCALL SDL_atanf(float x);
extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
+extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
extern DECLSPEC double SDLCALL SDL_ceil(double x);
+extern DECLSPEC float SDLCALL SDL_ceilf(float x);
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
+extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
extern DECLSPEC double SDLCALL SDL_cos(double x);
extern DECLSPEC float SDLCALL SDL_cosf(float x);
+extern DECLSPEC double SDLCALL SDL_exp(double x);
+extern DECLSPEC float SDLCALL SDL_expf(float x);
extern DECLSPEC double SDLCALL SDL_fabs(double x);
+extern DECLSPEC float SDLCALL SDL_fabsf(float x);
extern DECLSPEC double SDLCALL SDL_floor(double x);
+extern DECLSPEC float SDLCALL SDL_floorf(float x);
+extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
+extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
extern DECLSPEC double SDLCALL SDL_log(double x);
+extern DECLSPEC float SDLCALL SDL_logf(float x);
+extern DECLSPEC double SDLCALL SDL_log10(double x);
+extern DECLSPEC float SDLCALL SDL_log10f(float x);
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
+extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
+extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
extern DECLSPEC double SDLCALL SDL_sin(double x);
extern DECLSPEC float SDLCALL SDL_sinf(float x);
extern DECLSPEC double SDLCALL SDL_sqrt(double x);
#endif
#include "close_code.h"
-#endif /* _SDL_stdinc_h */
+#endif /* SDL_stdinc_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file for ::SDL_Surface definition and management functions.
*/
-#ifndef _SDL_surface_h
-#define _SDL_surface_h
+#ifndef SDL_surface_h_
+#define SDL_surface_h_
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
+#define SDL_SIMD_ALIGNED 0x00000008 /**< Surface uses aligned memory */
/* @} *//* Surface flags */
/**
/**
* \brief The type of function used for surface blitting functions.
*/
-typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
- struct SDL_Surface * dst, SDL_Rect * dstrect);
+typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
+ struct SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief The formula used for converting between YUV and RGB
+ */
+typedef enum
+{
+ SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */
+ SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */
+ SDL_YUV_CONVERSION_BT709, /**< BT.709 */
+ SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */
+} SDL_YUV_CONVERSION_MODE;
/**
* Allocate and free an RGB surface.
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
(Uint32 flags, int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
+
+/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
(Uint32 flags, int width, int height, int depth, Uint32 format);
+
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
int width,
int height,
extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
int flag, Uint32 key);
+/**
+ * \brief Returns whether the surface has a color key
+ *
+ * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface);
+
/**
* \brief Gets the color key (transparent pixel) in a blittable surface.
*
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
SDL_Rect * rect);
+/*
+ * Creates a new surface identical to the existing surface
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
+
/**
* 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
(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect);
+/**
+ * \brief Set the YUV conversion mode
+ */
+extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
+
+/**
+ * \brief Get the YUV conversion mode
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
+
+/**
+ * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
#endif
#include "close_code.h"
-#endif /* _SDL_surface_h */
+#endif /* SDL_surface_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for platform specific SDL API functions
*/
-#ifndef _SDL_system_h
-#define _SDL_system_h
+#ifndef SDL_system_h_
+#define SDL_system_h_
#include "SDL_stdinc.h"
#include "SDL_keyboard.h"
#endif /* __WIN32__ */
+/* Platform specific functions for Linux */
+#ifdef __LINUX__
+
+/**
+ \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available.
+
+ \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
+
+#endif /* __LINUX__ */
+
/* Platform specific functions for iOS */
#if defined(__IPHONEOS__) && __IPHONEOS__
This returns JNIEnv*, but the prototype is void* so we don't need jni.h
*/
-extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
+extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
/**
\brief Get the SDL Activity object for the application
It is the caller's responsibility to properly release it
(using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
*/
-extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
+extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
+
+/**
+ \brief Return true if the application is running on Android TV
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
+
+/**
+ \brief Return true if the application is running on a Chromebook
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
+
+/**
+ \brief Return true is the application is running on a Samsung DeX docking station
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
+
+/**
+ \brief Trigger the Android system back button behavior.
+ */
+extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
/**
See the official Android developer guide for more information:
This path is unique to your application and cannot be written to
by other applications.
*/
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
/**
\brief Get the current state of external storage, a bitmask of these values:
If external storage is currently unavailable, this will return 0.
*/
-extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
+extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
/**
\brief Get the path used for external storage for this application.
This path is unique to your application, but is public and can be
written to by other applications.
*/
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
#endif /* __ANDROID__ */
} SDL_WinRT_Path;
+/**
+ * \brief WinRT Device Family
+ */
+typedef enum
+{
+ /** \brief Unknown family */
+ SDL_WINRT_DEVICEFAMILY_UNKNOWN,
+
+ /** \brief Desktop family*/
+ SDL_WINRT_DEVICEFAMILY_DESKTOP,
+
+ /** \brief Mobile family (for example smartphone) */
+ SDL_WINRT_DEVICEFAMILY_MOBILE,
+
+ /** \brief XBox family */
+ SDL_WINRT_DEVICEFAMILY_XBOX,
+} SDL_WinRT_DeviceFamily;
+
+
/**
* \brief Retrieves a WinRT defined path on the local file system
*
*/
extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
+/**
+ * \brief Detects the device family of WinRT plattform on runtime
+ *
+ * \return Device family
+ */
+extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
+
#endif /* __WINRT__ */
+/**
+ \brief Return true if the current device is a tablet.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_system_h */
+#endif /* SDL_system_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL custom system window manager hooks.
*/
-#ifndef _SDL_syswm_h
-#define _SDL_syswm_h
+#ifndef SDL_syswm_h_
+#define SDL_syswm_h_
#include "SDL_stdinc.h"
#include "SDL_error.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_syswm.h
+ * \brief 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;
-#else
+
+#if !defined(SDL_PROTOTYPES_ONLY)
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
#ifndef WIN32_LEAN_AND_MEAN
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
#include "SDL_egl.h"
#endif
+#endif /* SDL_PROTOTYPES_ONLY */
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(SDL_PROTOTYPES_ONLY)
/**
* These are the various supported windowing subsystems
*/
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND,
- SDL_SYSWM_MIR,
+ SDL_SYSWM_MIR, /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
SDL_SYSWM_WINRT,
SDL_SYSWM_ANDROID,
- SDL_SYSWM_VIVANTE
+ SDL_SYSWM_VIVANTE,
+ SDL_SYSWM_OS2
} SDL_SYSWM_TYPE;
/**
{
HWND window; /**< The window handle */
HDC hdc; /**< The window device context */
+ HINSTANCE hinstance; /**< The instance handle */
} win;
#endif
#if defined(SDL_VIDEO_DRIVER_WINRT)
struct
{
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
- NSWindow __unsafe_unretained *window; /* The Cocoa window */
+ NSWindow __unsafe_unretained *window; /**< The Cocoa window */
#else
- NSWindow *window; /* The Cocoa window */
+ NSWindow *window; /**< The Cocoa window */
#endif
} cocoa;
#endif
struct
{
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
- UIWindow __unsafe_unretained *window; /* The UIKit window */
+ UIWindow __unsafe_unretained *window; /**< The UIKit window */
#else
- UIWindow *window; /* The UIKit window */
+ UIWindow *window; /**< The UIKit window */
#endif
- GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
- GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
- GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
+ GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
+ GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
+ GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
} uikit;
#endif
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
} wl;
#endif
-#if defined(SDL_VIDEO_DRIVER_MIR)
+#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
struct
{
- struct MirConnection *connection; /**< Mir display server connection */
- struct MirSurface *surface; /**< Mir surface */
+ void *connection; /**< Mir display server connection */
+ void *surface; /**< Mir surface */
} mir;
#endif
} vivante;
#endif
- /* Can't have an empty union */
- int dummy;
+ /* Make sure this union is always 64 bytes (8 64-bit pointers). */
+ /* Be careful not to overflow this if you add a new target! */
+ Uint8 dummy[64];
} info;
};
#endif
#include "close_code.h"
-#endif /* _SDL_syswm_h */
+#endif /* SDL_syswm_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* This code is a part of the SDL2_test library, not the main SDL library.
*/
-#ifndef _SDL_test_h
-#define _SDL_test_h
+#ifndef SDL_test_h_
+#define SDL_test_h_
#include "SDL.h"
+#include "SDL_test_assert.h"
#include "SDL_test_common.h"
+#include "SDL_test_compare.h"
+#include "SDL_test_crc32.h"
#include "SDL_test_font.h"
-#include "SDL_test_random.h"
#include "SDL_test_fuzzer.h"
-#include "SDL_test_crc32.h"
-#include "SDL_test_md5.h"
-#include "SDL_test_log.h"
-#include "SDL_test_assert.h"
#include "SDL_test_harness.h"
#include "SDL_test_images.h"
-#include "SDL_test_compare.h"
+#include "SDL_test_log.h"
+#include "SDL_test_md5.h"
+#include "SDL_test_memory.h"
+#include "SDL_test_random.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_test_h */
+#endif /* SDL_test_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*
*/
-#ifndef _SDL_test_assert_h
-#define _SDL_test_assert_h
+#ifndef SDL_test_assert_h_
+#define SDL_test_assert_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
/**
* \brief Resets the assert summary counters to zero.
*/
-void SDLTest_ResetAssertSummary();
+void SDLTest_ResetAssertSummary(void);
/**
* \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
*/
-void SDLTest_LogAssertSummary();
+void SDLTest_LogAssertSummary(void);
/**
*
* \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
*/
-int SDLTest_AssertSummaryToTestResult();
+int SDLTest_AssertSummaryToTestResult(void);
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_test_assert_h */
+#endif /* SDL_test_assert_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/* Ported from original test\common.h file. */
-#ifndef _SDL_test_common_h
-#define _SDL_test_common_h
+#ifndef SDL_test_common_h_
+#define SDL_test_common_h_
#include "SDL.h"
*/
int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
+
/**
- * \brief Returns common usage information
+ * \brief Logs command line usage info.
*
- * \param state The common state describing the test window to create.
+ * This logs the appropriate command line options for the subsystems in use
+ * plus other common options, and then any application-specific options.
+ * This uses the SDL_Log() function and splits up output to be friendly to
+ * 80-character-wide terminals.
*
- * \returns String with usage information
+ * \param state The common state describing the test window for the app.
+ * \param argv0 argv[0], as passed to main/SDL_main.
+ * \param options an array of strings for application specific options. The last element of the array should be NULL.
*/
-const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
+void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options);
/**
* \brief Open test window.
*/
SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
+/**
+ * \brief Easy argument handling when test app doesn't need any custom args.
+ *
+ * \param state The common state describing the test window to create.
+ * \param argc argc, as supplied to SDL_main
+ * \param argv argv, as supplied to SDL_main
+ *
+ * \returns False if app should quit, true otherwise.
+ */
+SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc, char **argv);
+
/**
* \brief Common event handler for test windows.
*
#endif
#include "close_code.h"
-#endif /* _SDL_test_common_h */
+#endif /* SDL_test_common_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_test_compare_h
-#define _SDL_test_compare_h
+#ifndef SDL_test_compare_h_
+#define SDL_test_compare_h_
#include "SDL.h"
#endif
#include "close_code.h"
-#endif /* _SDL_test_compare_h */
+#endif /* SDL_test_compare_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_test_crc32_h
-#define _SDL_test_crc32_h
+#ifndef SDL_test_crc32_h_
+#define SDL_test_crc32_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
* \returns 0 for OK, -1 on error
*
*/
-int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
/* Same routine broken down into three steps */
int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
#endif
#include "close_code.h"
-#endif /* _SDL_test_crc32_h */
+#endif /* SDL_test_crc32_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* This code is a part of the SDL2_test library, not the main SDL library.
*/
-#ifndef _SDL_test_font_h
-#define _SDL_test_font_h
+#ifndef SDL_test_font_h_
+#define SDL_test_font_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
*
* \returns Returns 0 on success, -1 on failure.
*/
-int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c );
+int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
/**
* \brief Draw a string in the currently set font.
*
* \returns Returns 0 on success, -1 on failure.
*/
-int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s );
+int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
+/**
+ * \brief Cleanup textures used by font drawing functions.
+ */
+void SDLTest_CleanupTextDrawing(void);
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_test_font_h */
+#endif /* SDL_test_font_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_test_fuzzer_h
-#define _SDL_test_fuzzer_h
+#ifndef SDL_test_fuzzer_h_
+#define SDL_test_fuzzer_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
*
* \returns Generated integer
*/
-Uint8 SDLTest_RandomUint8();
+Uint8 SDLTest_RandomUint8(void);
/**
* Returns a random Sint8
*
* \returns Generated signed integer
*/
-Sint8 SDLTest_RandomSint8();
+Sint8 SDLTest_RandomSint8(void);
/**
*
* \returns Generated integer
*/
-Uint16 SDLTest_RandomUint16();
+Uint16 SDLTest_RandomUint16(void);
/**
* Returns a random Sint16
*
* \returns Generated signed integer
*/
-Sint16 SDLTest_RandomSint16();
+Sint16 SDLTest_RandomSint16(void);
/**
*
* \returns Generated integer
*/
-Sint32 SDLTest_RandomSint32();
+Sint32 SDLTest_RandomSint32(void);
/**
*
* \returns Generated integer
*/
-Uint32 SDLTest_RandomUint32();
+Uint32 SDLTest_RandomUint32(void);
/**
* Returns random Uint64.
*
* \returns Generated integer
*/
-Uint64 SDLTest_RandomUint64();
+Uint64 SDLTest_RandomUint64(void);
/**
*
* \returns Generated signed integer
*/
-Sint64 SDLTest_RandomSint64();
+Sint64 SDLTest_RandomSint64(void);
/**
* \returns random float in range [0.0 - 1.0[
*/
-float SDLTest_RandomUnitFloat();
+float SDLTest_RandomUnitFloat(void);
/**
* \returns random double in range [0.0 - 1.0[
*/
-double SDLTest_RandomUnitDouble();
+double SDLTest_RandomUnitDouble(void);
/**
* \returns random float.
*
*/
-float SDLTest_RandomFloat();
+float SDLTest_RandomFloat(void);
/**
* \returns random double.
*
*/
-double SDLTest_RandomDouble();
+double SDLTest_RandomDouble(void);
/**
* Returns a random boundary value for Uint8 within the given boundaries.
*
* \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
*/
-char * SDLTest_RandomAsciiString();
+char * SDLTest_RandomAsciiString(void);
/**
/**
* Returns the invocation count for the fuzzer since last ...FuzzerInit.
*/
-int SDLTest_GetFuzzerInvocationCount();
+int SDLTest_GetFuzzerInvocationCount(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
#endif
#include "close_code.h"
-#endif /* _SDL_test_fuzzer_h */
+#endif /* SDL_test_fuzzer_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
Based on original GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
*/
-#ifndef _SDL_test_harness_h
-#define _SDL_test_harness_h
+#ifndef SDL_test_h_arness_h
+#define SDL_test_h_arness_h
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
} SDLTest_TestSuiteReference;
+/**
+ * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).
+ *
+ * Note: The returned string needs to be deallocated by the caller.
+ *
+ * \param length The length of the seed string to generate
+ *
+ * \returns The generated seed string
+ */
+char *SDLTest_GenerateRunSeed(const int length);
+
/**
* \brief Execute a test suite using the given run seed and execution key.
*
#endif
#include "close_code.h"
-#endif /* _SDL_test_harness_h */
+#endif /* SDL_test_h_arness_h */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_test_images_h
-#define _SDL_test_images_h
+#ifndef SDL_test_images_h_
+#define SDL_test_images_h_
#include "SDL.h"
} SDLTest_SurfaceImage_t;
/* Test images */
-SDL_Surface *SDLTest_ImageBlit();
-SDL_Surface *SDLTest_ImageBlitColor();
-SDL_Surface *SDLTest_ImageBlitAlpha();
-SDL_Surface *SDLTest_ImageBlitBlendAdd();
-SDL_Surface *SDLTest_ImageBlitBlend();
-SDL_Surface *SDLTest_ImageBlitBlendMod();
-SDL_Surface *SDLTest_ImageBlitBlendNone();
-SDL_Surface *SDLTest_ImageBlitBlendAll();
-SDL_Surface *SDLTest_ImageFace();
-SDL_Surface *SDLTest_ImagePrimitives();
-SDL_Surface *SDLTest_ImagePrimitivesBlend();
+SDL_Surface *SDLTest_ImageBlit(void);
+SDL_Surface *SDLTest_ImageBlitColor(void);
+SDL_Surface *SDLTest_ImageBlitAlpha(void);
+SDL_Surface *SDLTest_ImageBlitBlendAdd(void);
+SDL_Surface *SDLTest_ImageBlitBlend(void);
+SDL_Surface *SDLTest_ImageBlitBlendMod(void);
+SDL_Surface *SDLTest_ImageBlitBlendNone(void);
+SDL_Surface *SDLTest_ImageBlitBlendAll(void);
+SDL_Surface *SDLTest_ImageFace(void);
+SDL_Surface *SDLTest_ImagePrimitives(void);
+SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
#endif
#include "close_code.h"
-#endif /* _SDL_test_images_h */
+#endif /* SDL_test_images_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*
*/
-#ifndef _SDL_test_log_h
-#define _SDL_test_log_h
+#ifndef SDL_test_log_h_
+#define SDL_test_log_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_test_log_h */
+#endif /* SDL_test_log_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
***********************************************************************
*/
-#ifndef _SDL_test_md5_h
-#define _SDL_test_md5_h
+#ifndef SDL_test_md5_h_
+#define SDL_test_md5_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_test_md5_h */
+#endif /* SDL_test_md5_h_ */
/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2019 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_test_memory.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef SDL_test_memory_h_
+#define SDL_test_memory_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * \brief Start tracking SDL memory allocations
+ *
+ * \note This should be called before any other SDL functions for complete tracking coverage
+ */
+int SDLTest_TrackAllocations(void);
+
+/**
+ * \brief Print a log of any outstanding allocations
+ *
+ * \note This can be called after SDL_Quit()
+ */
+void SDLTest_LogAllocations(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_memory_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_test_random_h
-#define _SDL_test_random_h
+#ifndef SDL_test_random_h_
+#define SDL_test_random_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_test_random_h */
+#endif /* SDL_test_random_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_thread_h
-#define _SDL_thread_h
+#ifndef SDL_thread_h_
+#define SDL_thread_h_
/**
* \file SDL_thread.h
/**
* The SDL thread priority.
*
- * \note On many systems you require special privileges to set high priority.
+ * \note On many systems you require special privileges to set high or time critical priority.
*/
typedef enum {
SDL_THREAD_PRIORITY_LOW,
SDL_THREAD_PRIORITY_NORMAL,
- SDL_THREAD_PRIORITY_HIGH
+ SDL_THREAD_PRIORITY_HIGH,
+ SDL_THREAD_PRIORITY_TIME_CRITICAL
} SDL_ThreadPriority;
/**
*
* We compile SDL into a DLL. 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
+ * API. There is a problem with this, that only the RTL of the SDL2.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
+ * start a new thread. This way, if it's the SDL2.DLL which uses this API,
+ * then the RTL of SDL2.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:
* library!
*/
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#include <process.h> /* This has _beginthread() and _endthread() defined! */
-
-typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *
- func) (void
- *),
- void *arg, unsigned,
- unsigned *threadID);
+#include <process.h> /* _beginthreadex() and _endthreadex() */
+
+typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
+ (void *, unsigned, unsigned (__stdcall *func)(void *),
+ void * /*arg*/, unsigned, unsigned * /* threadID */);
typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
/**
pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
+ const char *name, const size_t stacksize, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+
+
/**
* Create a thread.
*/
#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
#undef SDL_CreateThread
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#undef SDL_CreateThreadWithStackSize
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
#else
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#endif
+
+#elif defined(__OS2__)
+/*
+ * just like the windows case above: We compile SDL2
+ * into a dll with Watcom's runtime statically linked.
+ */
+#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#ifndef __EMX__
+#include <process.h>
+#else
+#include <stdlib.h>
+#endif
+typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
+typedef void (*pfnSDL_CurrentEndThread)(void);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
+#undef SDL_CreateThread
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#undef SDL_CreateThreadWithStackSize
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#else
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
#endif
#else
+/**
+ * Create a thread with a default stack size.
+ *
+ * This is equivalent to calling:
+ * SDL_CreateThreadWithStackSize(fn, name, 0, data);
+ */
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
+
/**
* Create a thread.
*
* If a system imposes requirements, SDL will try to munge the string for
* it (truncate, etc), but the original string contents will be available
* from SDL_GetThreadName().
+ *
+ * The size (in bytes) of the new stack can be specified. Zero means "use
+ * the system default" which might be wildly different between platforms
+ * (x86 Linux generally defaults to eight megabytes, an embedded device
+ * might be a few kilobytes instead).
+ *
+ * In SDL 2.1, stacksize will be folded into the original SDL_CreateThread
+ * function.
*/
extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
+SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data);
#endif
* \sa SDL_TLSCreate()
* \sa SDL_TLSGet()
*/
-extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
/* Ends C function definitions when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_thread_h */
+#endif /* SDL_thread_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_timer_h
-#define _SDL_timer_h
+#ifndef SDL_timer_h_
+#define SDL_timer_h_
/**
* \file SDL_timer.h
#endif
#include "close_code.h"
-#endif /* _SDL_timer_h */
+#endif /* SDL_timer_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL touch event handling.
*/
-#ifndef _SDL_touch_h
-#define _SDL_touch_h
+#ifndef SDL_touch_h_
+#define SDL_touch_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
typedef Sint64 SDL_TouchID;
typedef Sint64 SDL_FingerID;
+typedef enum
+{
+ SDL_TOUCH_DEVICE_INVALID = -1,
+ SDL_TOUCH_DEVICE_DIRECT, /* touch screen with window-relative coordinates */
+ SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */
+ SDL_TOUCH_DEVICE_INDIRECT_RELATIVE /* trackpad with screen cursor-relative coordinates */
+} SDL_TouchDeviceType;
+
typedef struct SDL_Finger
{
SDL_FingerID id;
/* Used as the device ID for mouse events simulated with touch input */
#define SDL_TOUCH_MOUSEID ((Uint32)-1)
+/* Used as the SDL_TouchID for touch events simulated with mouse input */
+#define SDL_MOUSE_TOUCHID ((Sint64)-1)
+
/* Function prototypes */
*/
extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
+/**
+ * \brief Get the type of the given touch device.
+ */
+extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
+
/**
* \brief Get the number of active fingers for a given touch device.
*/
#endif
#include "close_code.h"
-#endif /* _SDL_touch_h */
+#endif /* SDL_touch_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* This header defines the current SDL version.
*/
-#ifndef _SDL_version_h
-#define _SDL_version_h
+#ifndef SDL_version_h_
+#define SDL_version_h_
#include "SDL_stdinc.h"
*/
#define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 0
-#define SDL_PATCHLEVEL 5
+#define SDL_PATCHLEVEL 10
/**
* \brief Macro to determine SDL version program was compiled against.
#endif
#include "close_code.h"
-#endif /* _SDL_version_h */
+#endif /* SDL_version_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file for SDL video functions.
*/
-#ifndef _SDL_video_h
-#define _SDL_video_h
+#ifndef SDL_video_h_
+#define SDL_video_h_
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
- SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */
+ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported.
+ On macOS NSHighResolutionCapable must be set true in the
+ application's Info.plist for this to have any effect. */
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
- SDL_WINDOW_POPUP_MENU = 0x00080000 /**< window should be treated as a popup menu */
+ SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
+ SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
} SDL_WindowFlags;
/**
SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
} SDL_WindowEventID;
+/**
+ * \brief Event subtype for display events
+ */
+typedef enum
+{
+ SDL_DISPLAYEVENT_NONE, /**< Never used */
+ SDL_DISPLAYEVENT_ORIENTATION /**< Display orientation has changed to data1 */
+} SDL_DisplayEventID;
+
+typedef enum
+{
+ SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */
+ SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */
+ SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */
+ SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */
+ SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */
+} SDL_DisplayOrientation;
+
/**
* \brief An opaque handle to an OpenGL context.
*/
SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR
+ SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
+ SDL_GL_CONTEXT_RESET_NOTIFICATION,
+ SDL_GL_CONTEXT_NO_ERROR
} SDL_GLattr;
typedef enum
{
SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
- SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
+ SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
} SDL_GLprofile;
typedef enum
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
} SDL_GLcontextReleaseFlag;
+typedef enum
+{
+ SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
+ SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
+} SDL_GLContextResetNotification;
/* Function prototypes */
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
-/**
- * \brief Get the dots/pixels-per-inch for a display
- *
- * \note Diagonal, horizontal and vertical DPI can all be optionally
- * returned if the parameter is non-NULL.
- *
- * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
- *
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
-
/**
* \brief Get the usable desktop area represented by a display, with the
* primary display located at 0,0
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
+/**
+ * \brief Get the dots/pixels-per-inch for a display
+ *
+ * \note Diagonal, horizontal and vertical DPI can all be optionally
+ * returned if the parameter is non-NULL.
+ *
+ * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
+
+/**
+ * \brief Get the orientation of a display
+ *
+ * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex);
+
/**
* \brief Returns the number of available display modes.
*
* ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
* ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
* ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
- * ::SDL_WINDOW_ALLOW_HIGHDPI.
+ * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
*
* \return The created window, or NULL if window creation failed.
*
* If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
* in pixels may differ from its size in screen coordinates on platforms with
* high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
- * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize()
- * or SDL_GetRendererOutputSize() to query the drawable size in pixels.
+ * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(),
+ * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the
+ * drawable size in pixels.
+ *
+ * If the window is created with any of the SDL_WINDOW_OPENGL or
+ * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
+ * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
+ * corresponding UnloadLibrary function is called by SDL_DestroyWindow().
+ *
+ * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
+ * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
+ *
+ * \note On non-Apple devices, SDL requires you to either not link to the
+ * Vulkan loader or link to a dynamic library version. This limitation
+ * may be removed in a future version of SDL.
*
* \sa SDL_DestroyWindow()
+ * \sa SDL_GL_LoadLibrary()
+ * \sa SDL_Vulkan_LoadLibrary()
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
int x, int y, int w,
* \param w The width of the window, in screen coordinates. Must be >0.
* \param h The height of the window, in screen coordinates. Must be >0.
*
- * \note You can't change the size of a fullscreen window, it automatically
- * matches the size of the display mode.
+ * \note Fullscreen windows automatically match the size of the display mode,
+ * and you should use SDL_SetWindowDisplayMode() to change their size.
*
* The window size in screen coordinates may differ from the size in pixels, if
* the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
* SDL_GetRendererOutputSize() to get the real client area size in pixels.
*
* \sa SDL_GetWindowSize()
+ * \sa SDL_SetWindowDisplayMode()
*/
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
int h);
* \param window The window which will be made transparent or opaque
* \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
* clamped internally between 0.0f and 1.0f.
- *
+ *
* \return 0 on success, or -1 if setting the opacity isn't supported.
*
* \sa SDL_GetWindowOpacity()
*
* \param modal_window The window that should be modal
* \param parent_window The parent window
- *
+ *
* \return 0 on success, or -1 otherwise.
*/
extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
* obscured by other windows.
*
* \param window The window that should get the input focus
- *
+ *
* \return 0 on success, or -1 otherwise.
* \sa SDL_RaiseWindow()
*/
/**
* \brief Set an OpenGL window attribute before window creation.
+ *
+ * \return 0 on success, or -1 if the attribute could not be set.
*/
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
/**
* \brief Get the actual value for an attribute from the current context.
+ *
+ * \return 0 on success, or -1 if the attribute could not be retrieved.
+ * The integer at \c value will be modified in either case.
*/
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
#endif
#include "close_code.h"
-#endif /* _SDL_video_h */
+#endif /* SDL_video_h_ */
/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 2017, Mark Callow
+
+ 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_vulkan.h
+ *
+ * Header file for functions to creating Vulkan surfaces on SDL windows.
+ */
+
+#ifndef SDL_vulkan_h_
+#define SDL_vulkan_h_
+
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Avoid including vulkan.h, don't define VkInstance if it's already included */
+#ifdef VULKAN_H_
+#define NO_SDL_VULKAN_TYPEDEFS
+#endif
+#ifndef NO_SDL_VULKAN_TYPEDEFS
+#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
+
+#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
+#else
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
+#endif
+
+VK_DEFINE_HANDLE(VkInstance)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
+
+#endif /* !NO_SDL_VULKAN_TYPEDEFS */
+
+typedef VkInstance SDL_vulkanInstance;
+typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
+
+/**
+ * \name Vulkan support functions
+ *
+ * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API
+ * is compatable with Tizen's implementation of Vulkan in SDL.
+ */
+/* @{ */
+
+/**
+ * \brief Dynamically load a Vulkan loader library.
+ *
+ * \param [in] path The platform dependent Vulkan loader library name, or
+ * \c NULL.
+ *
+ * \return \c 0 on success, or \c -1 if the library couldn't be loaded.
+ *
+ * If \a path is NULL SDL will use the value of the environment variable
+ * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan
+ * loader library.
+ *
+ * This should be called after initializing the video driver, but before
+ * creating any Vulkan windows. If no Vulkan loader library is loaded, the
+ * default library will be loaded upon creation of the first Vulkan window.
+ *
+ * \note It is fairly common for Vulkan applications to link with \a libvulkan
+ * instead of explicitly loading it at run time. This will work with
+ * SDL provided the application links to a dynamic library and both it
+ * and SDL use the same search path.
+ *
+ * \note If you specify a non-NULL \c path, an application should retrieve all
+ * of the Vulkan functions it uses from the dynamic library using
+ * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee
+ * \c path points to the same vulkan loader library the application
+ * linked to.
+ *
+ * \note On Apple devices, if \a path is NULL, SDL will attempt to find
+ * the vkGetInstanceProcAddr address within all the mach-o images of
+ * the current process. This is because it is fairly common for Vulkan
+ * applications to link with libvulkan (and historically MoltenVK was
+ * provided as a static library). If it is not found then, on macOS, SDL
+ * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib,
+ * followed by \c libvulkan.dylib, in that order.
+ * On iOS SDL will attempt to load \c libvulkan.dylib only. Applications
+ * using a dynamic framework or .dylib must ensure it is included in its
+ * application bundle.
+ *
+ * \note On non-Apple devices, application linking with a static libvulkan is
+ * not supported. Either do not link to the Vulkan loader or link to a
+ * dynamic library version.
+ *
+ * \note This function will fail if there are no working Vulkan drivers
+ * installed.
+ *
+ * \sa SDL_Vulkan_GetVkGetInstanceProcAddr()
+ * \sa SDL_Vulkan_UnloadLibrary()
+ */
+extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
+
+/**
+ * \brief Get the address of the \c vkGetInstanceProcAddr function.
+ *
+ * \note This should be called after either calling SDL_Vulkan_LoadLibrary
+ * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag.
+ */
+extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
+
+/**
+ * \brief Unload the Vulkan loader library previously loaded by
+ * \c SDL_Vulkan_LoadLibrary().
+ *
+ * \sa SDL_Vulkan_LoadLibrary()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
+
+/**
+ * \brief Get the names of the Vulkan instance extensions needed to create
+ * a surface with \c SDL_Vulkan_CreateSurface().
+ *
+ * \param [in] \c NULL or window Window for which the required Vulkan instance
+ * extensions should be retrieved
+ * \param [in,out] pCount pointer to an \c unsigned related to the number of
+ * required Vulkan instance extensions
+ * \param [out] pNames \c NULL or a pointer to an array to be filled with the
+ * required Vulkan instance extensions
+ *
+ * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ * If \a pNames is \c NULL, then the number of required Vulkan instance
+ * extensions is returned in pCount. Otherwise, \a pCount must point to a
+ * variable set to the number of elements in the \a pNames array, and on
+ * return the variable is overwritten with the number of names actually
+ * written to \a pNames. If \a pCount is less than the number of required
+ * extensions, at most \a pCount structures will be written. If \a pCount
+ * is smaller than the number of required extensions, \c SDL_FALSE will be
+ * returned instead of \c SDL_TRUE, to indicate that not all the required
+ * extensions were returned.
+ *
+ * \note If \c window is not NULL, it will be checked against its creation
+ * flags to ensure that the Vulkan flag is present. This parameter
+ * will be removed in a future major release.
+ *
+ * \note The returned list of extensions will contain \c VK_KHR_surface
+ * and zero or more platform specific extensions
+ *
+ * \note The extension names queried here must be enabled when calling
+ * VkCreateInstance, otherwise surface creation will fail.
+ *
+ * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag
+ * or be \c NULL
+ *
+ * \code
+ * unsigned int count;
+ * // get count of required extensions
+ * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL))
+ * handle_error();
+ *
+ * static const char *const additionalExtensions[] =
+ * {
+ * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension
+ * };
+ * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]);
+ * size_t extensionCount = count + additionalExtensionsCount;
+ * const char **names = malloc(sizeof(const char *) * extensionCount);
+ * if(!names)
+ * handle_error();
+ *
+ * // get names of required extensions
+ * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names))
+ * handle_error();
+ *
+ * // copy additional extensions after required extensions
+ * for(size_t i = 0; i < additionalExtensionsCount; i++)
+ * names[i + count] = additionalExtensions[i];
+ *
+ * VkInstanceCreateInfo instanceCreateInfo = {};
+ * instanceCreateInfo.enabledExtensionCount = extensionCount;
+ * instanceCreateInfo.ppEnabledExtensionNames = names;
+ * // fill in rest of instanceCreateInfo
+ *
+ * VkInstance instance;
+ * // create the Vulkan instance
+ * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance);
+ * free(names);
+ * \endcode
+ *
+ * \sa SDL_Vulkan_CreateSurface()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
+ SDL_Window *window,
+ unsigned int *pCount,
+ const char **pNames);
+
+/**
+ * \brief Create a Vulkan rendering surface for a window.
+ *
+ * \param [in] window SDL_Window to which to attach the rendering surface.
+ * \param [in] instance handle to the Vulkan instance to use.
+ * \param [out] surface pointer to a VkSurfaceKHR handle to receive the
+ * handle of the newly created surface.
+ *
+ * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ * \code
+ * VkInstance instance;
+ * SDL_Window *window;
+ *
+ * // create instance and window
+ *
+ * // create the Vulkan surface
+ * VkSurfaceKHR surface;
+ * if(!SDL_Vulkan_CreateSurface(window, instance, &surface))
+ * handle_error();
+ * \endcode
+ *
+ * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag.
+ *
+ * \note \a instance should have been created with the extensions returned
+ * by \c SDL_Vulkan_CreateSurface() enabled.
+ *
+ * \sa SDL_Vulkan_GetInstanceExtensions()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR* surface);
+
+/**
+ * \brief Get the size of a window's underlying drawable in pixels (for use
+ * with setting viewport, scissor & etc).
+ *
+ * \param window SDL_Window from which the drawable size should be queried
+ * \param w Pointer to variable for storing the width in pixels,
+ * may be NULL
+ * \param h Pointer to variable for storing the height in pixels,
+ * may be NULL
+ *
+ * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
+ * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
+ * platform with high-DPI support (Apple calls this "Retina"), and not disabled
+ * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
+ *
+ * \note On macOS high-DPI support must be enabled for an application by
+ * setting NSHighResolutionCapable to true in its Info.plist.
+ *
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_CreateWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window,
+ int *w, int *h);
+
+/* @} *//* Vulkan support functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_vulkan_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
# else
# define DECLSPEC __declspec(dllexport)
# endif
+# elif defined(__OS2__)
+# ifdef BUILD_SDL
+# define DECLSPEC __declspec(dllexport)
+# else
+# define DECLSPEC
+# endif
# else
# if defined(__GNUC__) && __GNUC__ >= 4
# define DECLSPEC __attribute__ ((visibility("default")))
#ifndef SDLCALL
#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
#define SDLCALL __cdecl
+#elif defined(__OS2__) || defined(__EMX__)
+#define SDLCALL _System
+# if defined (__GNUC__) && !defined(_System)
+# define _System /* for old EMX/GCC compat. */
+# endif
#else
#define SDLCALL
#endif
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wpragma-pack"
+#endif
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \
defined(__WATCOMC__) || defined(__LCC__) || \
- defined(__DECC)
+ defined(__DECC) || defined(__CC_ARM)
#define SDL_INLINE __inline
#ifndef __inline__
#define __inline__ __inline
#endif
#endif /* SDL_FORCE_INLINE not defined */
+#ifndef SDL_NORETURN
+#if defined(__GNUC__)
+#define SDL_NORETURN __attribute__((noreturn))
+#elif defined(_MSC_VER)
+#define SDL_NORETURN __declspec(noreturn)
+#else
+#define SDL_NORETURN
+#endif
+#endif /* SDL_NORETURN not defined */
+
/* Apparently this is needed by several Windows compilers */
#if !defined(__MACH__)
#ifndef NULL
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* after you finish any function and structure declarations in your headers
*/
+#ifndef _begin_code_h
+#error close_code.h included without matching begin_code.h
+#endif
#undef _begin_code_h
/* Reset structure packing at previous byte alignment */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
# sdl2 cmake project-config input for ./configure scripts
-set(prefix "/var/home/rpolzer/xonotic/misc/buildsrc/tmp/SDL2-2.0.5/../32")
+set(prefix "/opt/local/i686-w64-mingw32")
set(exec_prefix "${prefix}")
set(libdir "${exec_prefix}/lib")
-set(SDL2_PREFIX "/var/home/rpolzer/xonotic/misc/buildsrc/tmp/SDL2-2.0.5/../32")
-set(SDL2_EXEC_PREFIX "/var/home/rpolzer/xonotic/misc/buildsrc/tmp/SDL2-2.0.5/../32")
+set(SDL2_PREFIX "/opt/local/i686-w64-mingw32")
+set(SDL2_EXEC_PREFIX "/opt/local/i686-w64-mingw32")
set(SDL2_LIBDIR "${exec_prefix}/lib")
set(SDL2_INCLUDE_DIRS "${prefix}/include/SDL2")
-set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -lSDL2 -mwindows")
+set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -lSDL2 -mwindows")
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
inherited_linker_flags=''
# Libraries that this one depends upon.
-dependency_libs=' -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid'
+dependency_libs=' -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libSDL2.
-current=4
-age=4
-revision=1
+current=10
+age=10
+revision=0
# Is this an already installed library?
installed=yes
dlpreopen=''
# Directory that this library needs to be installed in:
-libdir='/var/home/rpolzer/xonotic/misc/buildsrc/tmp/SDL2-2.0.5/../32/lib'
+libdir='/Users/valve/release/SDL/SDL2-2.0.10/i686-w64-mingw32/lib'
# sdl pkg-config source file
-prefix=/var/home/rpolzer/xonotic/misc/buildsrc/tmp/SDL2-2.0.5/../32
+prefix=/opt/local/i686-w64-mingw32
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: sdl2
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
-Version: 2.0.5
+Version: 2.0.10
Requires:
Conflicts:
-Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows
-Libs.private: -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc
+Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows
+Libs.private: -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc
Cflags: -I${includedir}/SDL2 -Dmain=SDL_main
done
fi
- if test -d $sdl_framework; then
+ if test x"$sdl_framework" != x && test -d "$sdl_framework"; then
AC_MSG_RESULT($sdl_framework)
sdl_framework_dir=`dirname $sdl_framework`
SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include"
#!/bin/sh
-prefix=${0%/bin/sdl2-config}
+prefix=/opt/local/x86_64-w64-mingw32
exec_prefix=${prefix}
exec_prefix_set=no
libdir=${exec_prefix}/lib
echo $exec_prefix
;;
--version)
- echo 2.0.5
+ echo 2.0.10
;;
--cflags)
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
;;
# --libs)
-# echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
+# echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
# ;;
# --static-libs)
--libs|--static-libs)
- echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc
+ echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc
;;
*)
echo "${usage}" 1>&2
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_H
-#define _SDL_H
+#ifndef SDL_h_
+#define SDL_h_
#include "SDL_main.h"
#include "SDL_stdinc.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_joystick.h"
#include "SDL_loadso.h"
#include "SDL_log.h"
#include "SDL_messagebox.h"
#include "SDL_power.h"
#include "SDL_render.h"
#include "SDL_rwops.h"
+#include "SDL_sensor.h"
+#include "SDL_shape.h"
#include "SDL_system.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
#define SDL_INIT_HAPTIC 0x00001000u
#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000u
+#define SDL_INIT_SENSOR 0x00008000u
#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
#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 \
+ SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
)
/* @} */
#endif
#include "close_code.h"
-#endif /* _SDL_H */
+#endif /* SDL_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_assert_h
-#define _SDL_assert_h
+#ifndef SDL_assert_h_
+#define SDL_assert_h_
#include "SDL_config.h"
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
-#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
+#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
-#elif defined(HAVE_SIGNAL_H)
+#elif defined(__386__) && defined(__WATCOMC__)
+ #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
+#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
#include <signal.h>
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
# define SDL_FUNCTION __func__
-#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
+#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
# define SDL_FUNCTION __FUNCTION__
#else
# define SDL_FUNCTION "???"
*
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
*
- * \return SDL_AssertState value of how to handle the assertion failure.
+ * Return SDL_AssertState 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.
* <code>
* const SDL_AssertData *item = SDL_GetAssertionReport();
* while (item) {
- * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
+ * 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");
#endif
#include "close_code.h"
-#endif /* _SDL_assert_h */
+#endif /* SDL_assert_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* All of the atomic operations that modify memory are full memory barriers.
*/
-#ifndef _SDL_atomic_h_
-#define _SDL_atomic_h_
+#ifndef SDL_atomic_h_
+#define SDL_atomic_h_
#include "SDL_stdinc.h"
#include "SDL_platform.h"
* 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)
+#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier()
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
+#elif defined(__WATCOMC__)
+extern _inline void SDL_CompilerBarrier (void);
+#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
#else
#define SDL_CompilerBarrier() \
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
* For more information on these semantics, take a look at the blog post:
* http://preshing.com/20120913/acquire-and-release-semantics
*/
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
+
#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(__aarch64__)
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "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__)
+#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */
+/* Information from:
+ https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19
+
+ The Linux kernel provides a helper function which provides the right code for a memory barrier,
+ hard-coded at address 0xffff0fa0
+*/
+typedef void (*SDL_KernelMemoryBarrierFunc)();
+#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
+#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
+#elif 0 /* defined(__QNXNTO__) */
+#include <sys/cpuinline.h>
+
+#define SDL_MemoryBarrierRelease() __cpu_membarrier()
+#define SDL_MemoryBarrierAcquire() __cpu_membarrier()
+#else
+#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__) || defined(__ARM_ARCH_8A__)
#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__)
+#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__) || defined(__ARM_ARCH_5TE__)
#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();
+#define SDL_MEMORY_BARRIER_USES_FUNCTION
+#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
+#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
#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")
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
+#endif /* __LINUX__ || __ANDROID__ */
#endif /* __GNUC__ && __arm__ */
#else
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
#include "close_code.h"
-#endif /* _SDL_atomic_h_ */
+#endif /* SDL_atomic_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Access to the raw audio mixing buffer for the SDL library.
*/
-#ifndef _SDL_audio_h
-#define _SDL_audio_h
+#ifndef SDL_audio_h_
+#define SDL_audio_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#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)
+#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008
+#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE)
/* @} */
/* @} *//* Audio flags */
/**
* The calculated values in this structure are calculated by SDL_OpenAudio().
+ *
+ * For multi-channel audio, the default SDL channel mapping is:
+ * 2: FL FR (stereo)
+ * 3: FL FR LFE (2.1 surround)
+ * 4: FL FR BL BR (quad)
+ * 5: FL FR FC BL BR (quad + center)
+ * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
+ * 7: FL FR FC LFE BC SL SR (6.1 surround)
+ * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
*/
typedef struct SDL_AudioSpec
{
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 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
Uint16 padding; /**< Necessary for some compile environments */
Uint32 size; /**< Audio buffer size in bytes (calculated) */
SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
SDL_AudioFormat format);
/**
- * A structure to hold a set of audio conversion filters and buffers.
+ * \brief Upper limit of filters in SDL_AudioCVT
+ *
+ * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
+ * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
+ * one of which is the terminating NULL pointer.
+ */
+#define SDL_AUDIOCVT_MAX_FILTERS 9
+
+/**
+ * \struct SDL_AudioCVT
+ * \brief A structure to hold a set of audio conversion filters and buffers.
+ *
+ * Note that various parts of the conversion pipeline can take advantage
+ * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
+ * you to pass it aligned data, but can possibly run much faster if you
+ * set both its (buf) field to a pointer that is aligned to 16 bytes, and its
+ * (len) field to something that's a multiple of 16, if possible.
*/
#ifdef __GNUC__
/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
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 */
+ SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
int filter_index; /**< Current audio conversion function */
} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
/* @} *//* 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:
+ * \brief Load the audio data of a WAVE file into memory
+ *
+ * Loading a WAVE file requires \c src, \c spec, \c audio_buf and \c audio_len
+ * to be valid pointers. The entire data portion of the file is then loaded
+ * into memory and decoded if necessary.
+ *
+ * If \c freesrc is non-zero, the data source gets automatically closed and
+ * freed before the function returns.
+ *
+ * Supported are RIFF WAVE files with the formats PCM (8, 16, 24, and 32 bits),
+ * IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and A-law and
+ * µ-law (8 bits). Other formats are currently unsupported and cause an error.
+ *
+ * If this function succeeds, the pointer returned by it is equal to \c spec
+ * and the pointer to the audio data allocated by the function is written to
+ * \c audio_buf and its length in bytes to \c audio_len. The \ref SDL_AudioSpec
+ * members \c freq, \c channels, and \c format are set to the values of the
+ * audio data in the buffer. The \c samples member is set to a sane default and
+ * all others are set to zero.
+ *
+ * It's necessary to use SDL_FreeWAV() to free the audio data returned in
+ * \c audio_buf when it is no longer used.
+ *
+ * Because of the underspecification of the Waveform format, there are many
+ * problematic files in the wild that cause issues with strict decoders. To
+ * provide compatibility with these files, this decoder is lenient in regards
+ * to the truncation of the file, the fact chunk, and the size of the RIFF
+ * chunk. The hints SDL_HINT_WAVE_RIFF_CHUNK_SIZE, SDL_HINT_WAVE_TRUNCATION,
+ * and SDL_HINT_WAVE_FACT_CHUNK can be used to tune the behavior of the
+ * loading process.
+ *
+ * Any file that is invalid (due to truncation, corruption, or wrong values in
+ * the headers), too big, or unsupported causes an error. Additionally, any
+ * critical I/O error from the data source will terminate the loading process
+ * with an error. The function returns NULL on error and in all cases (with the
+ * exception of \c src being NULL), an appropriate error message will be set.
+ *
+ * It is required that the data source supports seeking.
+ *
+ * Example:
* \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.
+ * \param src The data source with the WAVE data
+ * \param freesrc A integer value that makes the function close the data source if non-zero
+ * \param spec A pointer filled with the audio format of the audio data
+ * \param audio_buf A pointer filled with the audio data allocated by the function
+ * \param audio_len A pointer filled with the length of the audio data buffer in bytes
+ * \return NULL on error, or non-NULL on success.
*/
extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
int freesrc,
* 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.
+ * to the other. An unsupported format causes an error and -1 will be returned.
*
- * \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.
+ * \return 0 if no conversion is needed, 1 if the audio filter is set up,
+ * or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
SDL_AudioFormat src_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.
+ *
+ * \return 0 on success or -1 if \c cvt->buf is NULL.
*/
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
+/* SDL_AudioStream is a new audio conversion interface.
+ The benefits vs SDL_AudioCVT:
+ - it can handle resampling data in chunks without generating
+ artifacts, when it doesn't have the complete buffer available.
+ - it can handle incoming data in any variable size.
+ - You push data as you have it, and pull it when you need it
+ */
+/* this is opaque to the outside world. */
+struct _SDL_AudioStream;
+typedef struct _SDL_AudioStream SDL_AudioStream;
+
+/**
+ * Create a new audio stream
+ *
+ * \param src_format The format of the source audio
+ * \param src_channels The number of channels of the source audio
+ * \param src_rate The sampling rate of the source audio
+ * \param dst_format The format of the desired audio output
+ * \param dst_channels The number of channels of the desired audio output
+ * \param dst_rate The sampling rate of the desired audio output
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format,
+ const Uint8 src_channels,
+ const int src_rate,
+ const SDL_AudioFormat dst_format,
+ const Uint8 dst_channels,
+ const int dst_rate);
+
+/**
+ * Add data to be converted/resampled to the stream
+ *
+ * \param stream The stream the audio data is being added to
+ * \param buf A pointer to the audio data to add
+ * \param len The number of bytes to write to the stream
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len);
+
+/**
+ * Get converted/resampled data from the stream
+ *
+ * \param stream The stream the audio is being requested from
+ * \param buf A buffer to fill with audio data
+ * \param len The maximum number of bytes to fill
+ * \return The number of bytes read from the stream, or -1 on error
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len);
+
+/**
+ * Get the number of converted/resampled bytes available. The stream may be
+ * buffering data behind the scenes until it has enough to resample
+ * correctly, so this number might be lower than what you expect, or even
+ * be zero. Add more data or flush the stream if you need the data now.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream);
+
+/**
+ * Tell the stream that you're done sending data, and anything being buffered
+ * should be converted/resampled and made available immediately.
+ *
+ * It is legal to add more data to a stream after flushing, but there will
+ * be audio gaps in the output. Generally this is intended to signal the
+ * end of input, so the complete output becomes available.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream);
+
+/**
+ * Clear any pending data in the stream without converting it
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
+
+/**
+ * Free an audio stream
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ */
+extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
+
#define SDL_MIX_MAXVOLUME 128
/**
* This takes two audio buffers of the playing audio format and mixes
* \param dev The device ID to which we will queue audio.
* \param data The data to queue to the device for later playback.
* \param len The number of bytes (not samples!) to which (data) points.
- * \return zero on success, -1 on error.
+ * \return 0 on success, or -1 on error.
*
* \sa SDL_GetQueuedAudioSize
* \sa SDL_ClearQueuedAudio
#endif
#include "close_code.h"
-#endif /* _SDL_audio_h */
+#endif /* SDL_audio_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Functions for fiddling with bits and bitmasks.
*/
-#ifndef _SDL_bits_h
-#define _SDL_bits_h
+#ifndef SDL_bits_h_
+#define SDL_bits_h_
#include "SDL_stdinc.h"
*
* \return Index of the most significant bit, or -1 if the value is 0.
*/
+#if defined(__WATCOMC__) && defined(__386__)
+extern _inline int _SDL_clz_watcom (Uint32);
+#pragma aux _SDL_clz_watcom = \
+ "bsr eax, eax" \
+ "xor eax, 31" \
+ parm [eax] nomemory \
+ value [eax] \
+ modify exact [eax] nomemory;
+#endif
+
SDL_FORCE_INLINE int
SDL_MostSignificantBitIndex32(Uint32 x)
{
-#if defined(__GNUC__) && __GNUC__ >= 4
+#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
/* Count Leading Zeroes builtin in GCC.
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
*/
return -1;
}
return 31 - __builtin_clz(x);
+#elif defined(__WATCOMC__) && defined(__386__)
+ if (x == 0) {
+ return -1;
+ }
+ return 31 - _SDL_clz_watcom(x);
#else
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
* <seander@cs.stanford.edu>, released in the public domain.
#endif
}
+SDL_FORCE_INLINE SDL_bool
+SDL_HasExactlyOneBitSet32(Uint32 x)
+{
+ if (x && !(x & (x - 1))) {
+ return SDL_TRUE;
+ }
+ return SDL_FALSE;
+}
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_bits_h */
+#endif /* SDL_bits_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file declaring the SDL_BlendMode enumeration
*/
-#ifndef _SDL_blendmode_h
-#define _SDL_blendmode_h
+#ifndef SDL_blendmode_h_
+#define SDL_blendmode_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
dstRGB = (srcRGB * srcA) + dstRGB
dstA = dstA */
- SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate
+ SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
dstRGB = srcRGB * dstRGB
dstA = dstA */
+ SDL_BLENDMODE_INVALID = 0x7FFFFFFF
+
+ /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
+
} SDL_BlendMode;
+/**
+ * \brief The blend operation used when combining source and destination pixel components
+ */
+typedef enum
+{
+ SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
+ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
+ SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
+ SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
+ SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */
+
+} SDL_BlendOperation;
+
+/**
+ * \brief The normalized factor used to multiply pixel components
+ */
+typedef enum
+{
+ SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
+ SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
+ SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
+ SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
+ SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
+ SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
+ SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
+ SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
+
+} SDL_BlendFactor;
+
+/**
+ * \brief Create a custom blend mode, which may or may not be supported by a given renderer
+ *
+ * \param srcColorFactor source color factor
+ * \param dstColorFactor destination color factor
+ * \param colorOperation color operation
+ * \param srcAlphaFactor source alpha factor
+ * \param dstAlphaFactor destination alpha factor
+ * \param alphaOperation alpha operation
+ *
+ * The result of the blend mode operation will be:
+ * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
+ * and
+ * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
+ */
+extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
+ SDL_BlendFactor dstColorFactor,
+ SDL_BlendOperation colorOperation,
+ SDL_BlendFactor srcAlphaFactor,
+ SDL_BlendFactor dstAlphaFactor,
+ SDL_BlendOperation alphaOperation);
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_blendmode_h */
+#endif /* SDL_blendmode_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL clipboard handling
*/
-#ifndef _SDL_clipboard_h
-#define _SDL_clipboard_h
+#ifndef SDL_clipboard_h_
+#define SDL_clipboard_h_
#include "SDL_stdinc.h"
#endif
#include "close_code.h"
-#endif /* _SDL_clipboard_h */
+#endif /* SDL_clipboard_h_ */
/* vi: set ts=4 sw=4 expandtab: */
-/* include/SDL_config.h. Generated from SDL_config.h.in by configure. */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_windows_h_
+#define SDL_config_windows_h_
+#define SDL_config_h_
-/**
- * \file SDL_config.h.in
- *
- * 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 run hg revert SDL_config.h
-#endif
+/* This is a set of defines to configure the SDL features */
-/* C language features */
-/* #undef const */
-/* #undef inline */
-/* #undef volatile */
+#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 */
-/* C datatypes */
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
+#ifdef _WIN64
+# define SIZEOF_VOIDP 8
#else
-#define SIZEOF_VOIDP 4
+# define SIZEOF_VOIDP 4
#endif
-#define HAVE_GCC_ATOMICS 1
-/* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */
#define HAVE_DDRAW_H 1
#define HAVE_DINPUT_H 1
#define HAVE_DSOUND_H 1
#define HAVE_DXGI_H 1
#define HAVE_XINPUT_H 1
+#define HAVE_MMDEVICEAPI_H 1
+#define HAVE_AUDIOCLIENT_H 1
+#define HAVE_ENDPOINTVOLUME_H 1
-/* Comment this if you want to build without any C library requirements */
-#define HAVE_LIBC 1
-#if HAVE_LIBC
-
+/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
+#ifdef HAVE_LIBC
/* Useful headers */
-/* #undef HAVE_ALLOCA_H */
-#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_FLOAT_H 1
+#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
-/* #undef HAVE_ICONV_H */
#define HAVE_SIGNAL_H 1
-/* #undef HAVE_ALTIVEC_H */
-/* #undef HAVE_PTHREAD_NP_H */
-/* #undef HAVE_LIBUDEV_H */
-/* #undef HAVE_DBUS_DBUS_H */
-/* #undef HAVE_IBUS_IBUS_H */
-/* #undef HAVE_FCITX_FRONTEND_H */
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
-/* #undef HAVE_ALLOCA */
-#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
-#define HAVE_GETENV 1
-/* #undef HAVE_SETENV */
-#define HAVE_PUTENV 1
-/* #undef HAVE_UNSETENV */
-#endif
+#define HAVE_ALLOCA 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
-/* #undef HAVE_BCOPY */
#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
#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
-/* #undef HAVE_INDEX */
-/* #undef HAVE_RINDEX */
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__STRUPR */
+/* #undef HAVE__STRLWR */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
-#define HAVE_ITOA 1
-#define HAVE__LTOA 1
-/* #undef HAVE__UITOA */
-#define HAVE__ULTOA 1
+/* These functions have security warnings, so we won't use them */
+/* #undef HAVE__LTOA */
+/* #undef HAVE__ULTOA */
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
-#define HAVE__I64TOA 1
-#define HAVE__UI64TOA 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__STRICMP 1
-#define HAVE_STRCASECMP 1
#define HAVE__STRNICMP 1
-#define HAVE_STRNCASECMP 1
-/* #undef HAVE_SSCANF */
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
+#define HAVE_CEILF 1
+#define HAVE__COPYSIGN 1
+#define HAVE_COS 1
+#define HAVE_COSF 1
+#define HAVE_EXP 1
+#define HAVE_EXPF 1
+#define HAVE_FABS 1
+#define HAVE_FABSF 1
+#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
+#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
+#define HAVE_POW 1
+#define HAVE_POWF 1
+#define HAVE_SIN 1
+#define HAVE_SINF 1
+#define HAVE_SQRT 1
+#define HAVE_SQRTF 1
+#define HAVE_TAN 1
+#define HAVE_TANF 1
+#if defined(_MSC_VER)
+/* These functions were added with the VC++ 2013 C runtime library */
+#if _MSC_VER >= 1800
+#define HAVE_STRTOLL 1
#define HAVE_VSSCANF 1
-/* #undef HAVE_SNPRINTF */
-#define HAVE_VSNPRINTF 1
-#define HAVE_M_PI /**/
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 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_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SINF 1
-#define HAVE_SQRT 1
-#define HAVE_SQRTF 1
-#define HAVE_TAN 1
-#define HAVE_TANF 1
-#define HAVE_FSEEKO 1
-#define HAVE_FSEEKO64 1
-/* #undef HAVE_SIGACTION */
-/* #undef HAVE_SA_SIGACTION */
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-/* #undef HAVE_SYSCONF */
-/* #undef HAVE_SYSCTLBYNAME */
-/* #undef HAVE_CLOCK_GETTIME */
-/* #undef HAVE_GETPAGESIZE */
-/* #undef HAVE_MPROTECT */
-/* #undef HAVE_ICONV */
-/* #undef HAVE_PTHREAD_SETNAME_NP */
-/* #undef HAVE_PTHREAD_SET_NAME_NP */
-/* #undef HAVE_SEM_TIMEDWAIT */
-
+#define HAVE_SCALBNF 1
+#endif
+/* This function is available with at least the VC++ 2008 C runtime library */
+#if _MSC_VER >= 1400
+#define HAVE__FSEEKI64 1
+#endif
+#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
-#define HAVE_STDINT_H 1
-#endif /* HAVE_LIBC */
-
-/* SDL internal assertion support */
-/* #undef SDL_DEFAULT_ASSERT_LEVEL */
-
-/* Allow disabling of core subsystems */
-/* #undef SDL_ATOMIC_DISABLED */
-/* #undef SDL_AUDIO_DISABLED */
-/* #undef SDL_CPUINFO_DISABLED */
-/* #undef SDL_EVENTS_DISABLED */
-/* #undef SDL_FILE_DISABLED */
-/* #undef SDL_JOYSTICK_DISABLED */
-/* #undef SDL_HAPTIC_DISABLED */
-/* #undef SDL_LOADSO_DISABLED */
-/* #undef SDL_RENDER_DISABLED */
-/* #undef SDL_THREADS_DISABLED */
-/* #undef SDL_TIMERS_DISABLED */
-/* #undef SDL_VIDEO_DISABLED */
-/* #undef SDL_POWER_DISABLED */
-/* #undef SDL_FILESYSTEM_DISABLED */
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#endif
/* 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_PULSEAUDIO */
-/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_HAIKU */
-/* #undef SDL_AUDIO_DRIVER_BSD */
-/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-/* #undef SDL_AUDIO_DRIVER_ANDROID */
-/* #undef SDL_AUDIO_DRIVER_XAUDIO2 */
+#define SDL_AUDIO_DRIVER_WASAPI 1
#define SDL_AUDIO_DRIVER_DSOUND 1
-/* #undef SDL_AUDIO_DRIVER_ESD */
-/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_NACL */
-/* #undef SDL_AUDIO_DRIVER_NAS */
-/* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_SNDIO */
-/* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_OSS */
-/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */
-/* #undef SDL_AUDIO_DRIVER_PAUDIO */
-/* #undef SDL_AUDIO_DRIVER_QSA */
-/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
-#define SDL_AUDIO_DRIVER_WINMM 1
-/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */
-/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */
-/* #undef SDL_AUDIO_DRIVER_EMSCRIPTEN */
+#define SDL_AUDIO_DRIVER_WINMM 1
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
-/* #undef SDL_INPUT_LINUXEV */
-/* #undef SDL_INPUT_LINUXKD */
-/* #undef SDL_INPUT_TSLIB */
-/* #undef SDL_JOYSTICK_HAIKU */
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_XINPUT 1
-/* #undef SDL_JOYSTICK_DUMMY */
-/* #undef SDL_JOYSTICK_IOKIT */
-/* #undef SDL_JOYSTICK_LINUX */
-/* #undef SDL_JOYSTICK_ANDROID */
-/* #undef SDL_JOYSTICK_WINMM */
-/* #undef SDL_JOYSTICK_USBHID */
-/* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
-/* #undef SDL_JOYSTICK_EMSCRIPTEN */
-/* #undef SDL_HAPTIC_DUMMY */
-/* #undef SDL_HAPTIC_LINUX */
-/* #undef SDL_HAPTIC_IOKIT */
-#define SDL_HAPTIC_DINPUT 1
-#define SDL_HAPTIC_XINPUT 1
+#define SDL_JOYSTICK_HIDAPI 1
+#define SDL_HAPTIC_DINPUT 1
+#define SDL_HAPTIC_XINPUT 1
+
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY 1
/* Enable various shared object loading systems */
-/* #undef SDL_LOADSO_HAIKU */
-/* #undef SDL_LOADSO_DLOPEN */
-/* #undef SDL_LOADSO_DUMMY */
-/* #undef SDL_LOADSO_LDG */
-#define SDL_LOADSO_WINDOWS 1
+#define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */
-/* #undef SDL_THREAD_PTHREAD */
-/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX */
-/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
-#define SDL_THREAD_WINDOWS 1
+#define SDL_THREAD_WINDOWS 1
/* Enable various timer systems */
-/* #undef SDL_TIMER_HAIKU */
-/* #undef SDL_TIMER_DUMMY */
-/* #undef SDL_TIMER_UNIX */
-#define SDL_TIMER_WINDOWS 1
+#define SDL_TIMER_WINDOWS 1
/* Enable various video drivers */
-/* #undef SDL_VIDEO_DRIVER_HAIKU */
-/* #undef SDL_VIDEO_DRIVER_COCOA */
-/* #undef SDL_VIDEO_DRIVER_DIRECTFB */
-/* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_WINDOWS 1
-/* #undef SDL_VIDEO_DRIVER_WAYLAND */
-/* #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
-/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
-/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */
-/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */
-/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */
-/* #undef SDL_VIDEO_DRIVER_MIR */
-/* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC */
-/* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON */
-/* #undef SDL_VIDEO_DRIVER_X11 */
-/* #undef SDL_VIDEO_DRIVER_RPI */
-/* #undef SDL_VIDEO_DRIVER_ANDROID */
-/* #undef SDL_VIDEO_DRIVER_EMSCRIPTEN */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS */
-/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE */
-/* #undef SDL_VIDEO_DRIVER_X11_XCURSOR */
-/* #undef SDL_VIDEO_DRIVER_X11_XDBE */
-/* #undef SDL_VIDEO_DRIVER_X11_XINERAMA */
-/* #undef SDL_VIDEO_DRIVER_X11_XINPUT2 */
-/* #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */
-/* #undef SDL_VIDEO_DRIVER_X11_XRANDR */
-/* #undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER */
-/* #undef SDL_VIDEO_DRIVER_X11_XSHAPE */
-/* #undef SDL_VIDEO_DRIVER_X11_XVIDMODE */
-/* #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */
-/* #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY */
-/* #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM */
-/* #undef SDL_VIDEO_DRIVER_NACL */
-/* #undef SDL_VIDEO_DRIVER_VIVANTE */
-/* #undef SDL_VIDEO_DRIVER_VIVANTE_VDK */
+#define SDL_VIDEO_DRIVER_DUMMY 1
+#define SDL_VIDEO_DRIVER_WINDOWS 1
-#define SDL_VIDEO_RENDER_D3D 1
-/* #undef SDL_VIDEO_RENDER_D3D11 */
-#define SDL_VIDEO_RENDER_OGL 1
-/* #undef SDL_VIDEO_RENDER_OGL_ES */
-/* #undef SDL_VIDEO_RENDER_OGL_ES2 */
-/* #undef SDL_VIDEO_RENDER_DIRECTFB */
+#ifndef SDL_VIDEO_RENDER_D3D
+#define SDL_VIDEO_RENDER_D3D 1
+#endif
+#ifndef SDL_VIDEO_RENDER_D3D11
+#define SDL_VIDEO_RENDER_D3D11 0
+#endif
/* Enable OpenGL support */
-#define SDL_VIDEO_OPENGL 1
-/* #undef SDL_VIDEO_OPENGL_ES */
-/* #undef SDL_VIDEO_OPENGL_ES2 */
-/* #undef SDL_VIDEO_OPENGL_BGL */
-/* #undef SDL_VIDEO_OPENGL_CGL */
-/* #undef SDL_VIDEO_OPENGL_EGL */
-/* #undef SDL_VIDEO_OPENGL_GLX */
-#define SDL_VIDEO_OPENGL_WGL 1
-/* #undef SDL_VIDEO_OPENGL_OSMESA */
-/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
+#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
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_OPENGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_EGL
+#define SDL_VIDEO_OPENGL_EGL 1
+#endif
+
+/* Enable Vulkan support */
+#define SDL_VIDEO_VULKAN 1
/* Enable system power support */
-/* #undef SDL_POWER_LINUX */
#define SDL_POWER_WINDOWS 1
-/* #undef SDL_POWER_MACOSX */
-/* #undef SDL_POWER_HAIKU */
-/* #undef SDL_POWER_ANDROID */
-/* #undef SDL_POWER_EMSCRIPTEN */
-/* #undef SDL_POWER_HARDWIRED */
-/* Enable system filesystem support */
-/* #undef SDL_FILESYSTEM_HAIKU */
-/* #undef SDL_FILESYSTEM_COCOA */
-/* #undef SDL_FILESYSTEM_DUMMY */
-/* #undef SDL_FILESYSTEM_UNIX */
-#define SDL_FILESYSTEM_WINDOWS 1
-/* #undef SDL_FILESYSTEM_NACL */
-/* #undef SDL_FILESYSTEM_ANDROID */
-/* #undef SDL_FILESYSTEM_EMSCRIPTEN */
+/* Enable filesystem support */
+#define SDL_FILESYSTEM_WINDOWS 1
-/* Enable assembly routines */
-#define SDL_ASSEMBLY_ROUTINES 1
-/* #undef SDL_ALTIVEC_BLITTERS */
-
-/* Enable ime support */
-/* #undef SDL_USE_IME */
+/* Enable assembly routines (Win64 doesn't have inline asm) */
+#ifndef _WIN64
+#define SDL_ASSEMBLY_ROUTINES 1
+#endif
-#endif /* _SDL_config_h */
+#endif /* SDL_config_windows_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* CPU feature detection for SDL.
*/
-#ifndef _SDL_cpuinfo_h
-#define _SDL_cpuinfo_h
+#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) && (defined(_M_IX86) || defined(_M_X64))
+#ifdef __clang__
+/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
+#undef __MMX__
+#undef __SSE__
+#undef __SSE2__
+#else
#include <intrin.h>
#ifndef _WIN64
+#ifndef __MMX__
#define __MMX__
+#endif
+#ifndef __3dNOW__
#define __3dNOW__
#endif
+#endif
+#ifndef __SSE__
#define __SSE__
+#endif
+#ifndef __SSE2__
#define __SSE2__
+#endif
+#endif /* __clang__ */
#elif defined(__MINGW64_VERSION_MAJOR)
#include <intrin.h>
#else
-#ifdef __ALTIVEC__
-#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
+/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */
+#if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H)
#include <altivec.h>
-#undef pixel
#endif
+#if !defined(SDL_DISABLE_ARM_NEON_H)
+# if defined(__ARM_NEON)
+# include <arm_neon.h>
+# elif defined(__WINDOWS__) || defined(__WINRT__)
+/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
+# if defined(_M_ARM)
+# include <armintr.h>
+# include <arm_neon.h>
+# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
+# endif
+# if defined (_M_ARM64)
+# include <armintr.h>
+# include <arm_neon.h>
+# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
+# endif
+# endif
#endif
-#ifdef __MMX__
-#include <mmintrin.h>
-#endif
-#ifdef __3dNOW__
+#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
#include <mm3dnow.h>
#endif
-#ifdef __SSE__
+#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
+#include <immintrin.h>
+#else
+#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
+#include <mmintrin.h>
+#endif
+#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
#include <xmmintrin.h>
#endif
-#ifdef __SSE2__
+#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
#include <emmintrin.h>
#endif
+#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
+#include <pmmintrin.h>
#endif
+#endif /* HAVE_IMMINTRIN_H */
+#endif /* compiler version */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
+/**
+ * This function returns true if the CPU has AVX-512F (foundation) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
+
+/**
+ * This function returns true if the CPU has NEON (ARM SIMD) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
+
/**
* This function returns the amount of RAM configured in the system, in MB.
*/
extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
+/**
+ * \brief Report the alignment this system needs for SIMD allocations.
+ *
+ * This will return the minimum number of bytes to which a pointer must be
+ * aligned to be compatible with SIMD instructions on the current machine.
+ * For example, if the machine supports SSE only, it will return 16, but if
+ * it supports AVX-512F, it'll return 64 (etc). This only reports values for
+ * instruction sets SDL knows about, so if your SDL build doesn't have
+ * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
+ * not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
+ * Plan accordingly.
+ */
+extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
+
+/**
+ * \brief Allocate memory in a SIMD-friendly way.
+ *
+ * This will allocate a block of memory that is suitable for use with SIMD
+ * instructions. Specifically, it will be properly aligned and padded for
+ * the system's supported vector instructions.
+ *
+ * The memory returned will be padded such that it is safe to read or write
+ * an incomplete vector at the end of the memory block. This can be useful
+ * so you don't have to drop back to a scalar fallback at the end of your
+ * SIMD processing loop to deal with the final elements without overflowing
+ * the allocated buffer.
+ *
+ * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free()
+ * or delete[], etc.
+ *
+ * Note that SDL will only deal with SIMD instruction sets it is aware of;
+ * for example, SDL 2.0.8 knows that SSE wants 16-byte vectors
+ * (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't
+ * know that AVX-512 wants 64. To be clear: if you can't decide to use an
+ * instruction set with an SDL_Has*() function, don't use that instruction
+ * set with memory allocated through here.
+ *
+ * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't
+ * out of memory.
+ *
+ * \param len The length, in bytes, of the block to allocated. The actual
+ * allocated block might be larger due to padding, etc.
+ * \return Pointer to newly-allocated block, NULL if out of memory.
+ *
+ * \sa SDL_SIMDAlignment
+ * \sa SDL_SIMDFree
+ */
+extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
+
+/**
+ * \brief Deallocate memory obtained from SDL_SIMDAlloc
+ *
+ * It is not valid to use this function on a pointer from anything but
+ * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
+ * SDL_malloc, memalign, new[], etc.
+ *
+ * However, SDL_SIMDFree(NULL) is a legal no-op.
+ *
+ * \sa SDL_SIMDAlloc
+ */
+extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr);
+/* vi: set ts=4 sw=4 expandtab: */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_cpuinfo_h */
+#endif /* SDL_cpuinfo_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*
* This is a simple file to encapsulate the EGL API headers.
*/
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__ANDROID__)
#include <EGL/egl.h>
#include <EGL/eglext.h>
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Functions for reading and writing endian-specific values
*/
-#ifndef _SDL_endian_h
-#define _SDL_endian_h
+#ifndef SDL_endian_h_
+#define SDL_endian_h_
#include "SDL_stdinc.h"
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint16 SDL_Swap16(Uint16);
+#pragma aux SDL_Swap16 = \
+ "xchg al, ah" \
+ parm [ax] \
+ modify [ax];
#else
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint32 SDL_Swap32(Uint32);
+#ifndef __SW_3 /* 486+ */
+#pragma aux SDL_Swap32 = \
+ "bswap eax" \
+ parm [eax] \
+ modify [eax];
+#else /* 386-only */
+#pragma aux SDL_Swap32 = \
+ "xchg al, ah" \
+ "ror eax, 16" \
+ "xchg al, ah" \
+ parm [eax] \
+ modify [eax];
+#endif
#else
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
#endif
#include "close_code.h"
-#endif /* _SDL_endian_h */
+#endif /* SDL_endian_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Simple error message routines for SDL.
*/
-#ifndef _SDL_error_h
-#define _SDL_error_h
+#ifndef SDL_error_h_
+#define SDL_error_h_
#include "SDL_stdinc.h"
#endif
#include "close_code.h"
-#endif /* _SDL_error_h */
+#endif /* SDL_error_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL event handling.
*/
-#ifndef _SDL_events_h
-#define _SDL_events_h
+#ifndef SDL_events_h_
+#define SDL_events_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
Called on Android in onResume()
*/
+ /* Display events */
+ SDL_DISPLAYEVENT = 0x150, /**< Display state change */
+
/* Window events */
SDL_WINDOWEVENT = 0x200, /**< Window state change */
SDL_SYSWMEVENT, /**< System specific event */
SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
+ /* Sensor events */
+ SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */
+
/* Render events */
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
typedef struct SDL_CommonEvent
{
Uint32 type;
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_CommonEvent;
+/**
+ * \brief Display state change event data (event.display.*)
+ */
+typedef struct SDL_DisplayEvent
+{
+ Uint32 type; /**< ::SDL_DISPLAYEVENT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 display; /**< The associated display index */
+ Uint8 event; /**< ::SDL_DisplayEventID */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint32 data1; /**< event dependent data */
+} SDL_DisplayEvent;
+
/**
* \brief Window state change event data (event.window.*)
*/
typedef struct SDL_WindowEvent
{
Uint32 type; /**< ::SDL_WINDOWEVENT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The associated window */
Uint8 event; /**< ::SDL_WindowEventID */
Uint8 padding1;
typedef struct SDL_KeyboardEvent
{
Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_TextEditingEvent
{
Uint32 type; /**< ::SDL_TEXTEDITING */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_TextInputEvent
{
Uint32 type; /**< ::SDL_TEXTINPUT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
} SDL_TextInputEvent;
typedef struct SDL_MouseMotionEvent
{
Uint32 type; /**< ::SDL_MOUSEMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_MouseButtonEvent
{
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_MouseWheelEvent
{
Uint32 type; /**< ::SDL_MOUSEWHEEL */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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, positive to the right and negative to the left */
typedef struct SDL_JoyAxisEvent
{
Uint32 type; /**< ::SDL_JOYAXISMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */
Uint8 padding1;
typedef struct SDL_JoyBallEvent
{
Uint32 type; /**< ::SDL_JOYBALLMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 ball; /**< The joystick trackball index */
Uint8 padding1;
typedef struct SDL_JoyHatEvent
{
Uint32 type; /**< ::SDL_JOYHATMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */
Uint8 value; /**< The hat position value.
typedef struct SDL_JoyButtonEvent
{
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
typedef struct SDL_JoyDeviceEvent
{
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
} SDL_JoyDeviceEvent;
typedef struct SDL_ControllerAxisEvent
{
Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
Uint8 padding1;
typedef struct SDL_ControllerButtonEvent
{
Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The controller button (SDL_GameControllerButton) */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
typedef struct SDL_ControllerDeviceEvent
{
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
} SDL_ControllerDeviceEvent;
typedef struct SDL_AudioDeviceEvent
{
Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
Uint8 padding1;
typedef struct SDL_TouchFingerEvent
{
Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId;
float x; /**< Normalized in the range 0...1 */
typedef struct SDL_MultiGestureEvent
{
Uint32 type; /**< ::SDL_MULTIGESTURE */
- Uint32 timestamp;
- SDL_TouchID touchId; /**< The touch device index */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_TouchID touchId; /**< The touch device id */
float dTheta;
float dDist;
float x;
typedef struct SDL_DollarGestureEvent
{
Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */
SDL_GestureID gestureId;
Uint32 numFingers;
typedef struct SDL_DropEvent
{
Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
Uint32 windowID; /**< The window that was dropped on, if any */
} SDL_DropEvent;
+/**
+ * \brief Sensor event structure (event.sensor.*)
+ */
+typedef struct SDL_SensorEvent
+{
+ Uint32 type; /**< ::SDL_SENSORUPDATE */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Sint32 which; /**< The instance ID of the sensor */
+ float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
+} SDL_SensorEvent;
+
/**
* \brief The "quit requested" event
*/
typedef struct SDL_QuitEvent
{
Uint32 type; /**< ::SDL_QUIT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_QuitEvent;
/**
typedef struct SDL_OSEvent
{
Uint32 type; /**< ::SDL_QUIT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_OSEvent;
/**
typedef struct SDL_UserEvent
{
Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The associated window if any */
Sint32 code; /**< User defined event code */
void *data1; /**< User defined data pointer */
typedef struct SDL_SysWMEvent
{
Uint32 type; /**< ::SDL_SYSWMEVENT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
} SDL_SysWMEvent;
{
Uint32 type; /**< Event type, shared with all events */
SDL_CommonEvent common; /**< Common event data */
+ SDL_DisplayEvent display; /**< Window event data */
SDL_WindowEvent window; /**< Window event data */
SDL_KeyboardEvent key; /**< Keyboard event data */
SDL_TextEditingEvent edit; /**< Text editing event data */
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
SDL_AudioDeviceEvent adevice; /**< Audio device event data */
+ SDL_SensorEvent sensor; /**< Sensor event data */
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */
Uint8 padding[56];
} SDL_Event;
+/* Make sure we haven't broken binary compatibility */
+SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == 56);
+
/* Function prototypes */
/**
* 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.
+ * dropped from the event queue and will not 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
#endif
#include "close_code.h"
-#endif /* _SDL_events_h */
+#endif /* SDL_events_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* \brief Include file for filesystem SDL API functions
*/
-#ifndef _SDL_filesystem_h
-#define _SDL_filesystem_h
+#ifndef SDL_filesystem_h_
+#define SDL_filesystem_h_
#include "SDL_stdinc.h"
#endif
#include "close_code.h"
-#endif /* _SDL_filesystem_h */
+#endif /* SDL_filesystem_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL game controller event handling
*/
-#ifndef _SDL_gamecontroller_h
-#define _SDL_gamecontroller_h
+#ifndef SDL_gamecontroller_h_
+#define SDL_gamecontroller_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/
-/* The gamecontroller structure used to identify an SDL game controller */
+/**
+ * The gamecontroller structure used to identify an SDL game controller
+ */
struct _SDL_GameController;
typedef struct _SDL_GameController SDL_GameController;
* 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) ) {
+ * for (int i = 0; i < nJoysticks; i++) {
+ * if (SDL_IsGameController(i)) {
* nGameControllers++;
* }
* }
* 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",
+ * "03000000341a00003608000000000000,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",
*
*/
*
* \return number of mappings added, -1 on error
*/
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw );
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
/**
* Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
*
* \return 1 if mapping is added, 0 if updated, -1 on error
*/
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString );
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
+
+/**
+ * Get the number of mappings installed
+ *
+ * \return the number of mappings
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
+
+/**
+ * Get the mapping at a particular index.
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range.
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
/**
* 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 );
+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 );
+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.
*/
extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
+/**
+ * Get the mapping of a game controller.
+ * This can be called before any controllers are opened.
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
+ */
+extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(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.
*/
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
+/**
+ * Get the player index of an opened game controller, or -1 if it's not available
+ *
+ * For XInput controllers this returns the XInput user index.
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
+
+/**
+ * Get the USB vendor ID of an opened controller, if available.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller);
+
+/**
+ * Get the USB product ID of an opened controller, if available.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller);
+
+/**
+ * Get the product version of an opened controller, if available.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller);
+
/**
* Returns SDL_TRUE if the controller has been opened and currently connected,
* or SDL_FALSE if it has not.
/**
* The list of axes available from a controller
+ *
+ * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
+ * and are centered within ~8000 of zero, though advanced UI will allow users to set
+ * or autodetect the dead zone, which varies between controllers.
+ *
+ * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
*/
typedef enum
{
extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
SDL_GameControllerButton button);
+/**
+ * Trigger a rumble effect
+ * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
+ *
+ * \param gamecontroller The controller to vibrate
+ * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF
+ * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
+ * \param duration_ms The duration of the rumble effect, in milliseconds
+ *
+ * \return 0, or -1 if rumble isn't supported on this joystick
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
+
/**
* Close a controller previously opened with SDL_GameControllerOpen().
*/
#endif
#include "close_code.h"
-#endif /* _SDL_gamecontroller_h */
+#endif /* SDL_gamecontroller_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL gesture event handling.
*/
-#ifndef _SDL_gesture_h
-#define _SDL_gesture_h
+#ifndef SDL_gesture_h_
+#define SDL_gesture_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
#include "close_code.h"
-#endif /* _SDL_gesture_h */
+#endif /* SDL_gesture_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/**
* \file SDL_haptic.h
*
- * \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
+ * \brief The SDL haptic subsystem allows you to control haptic (force feedback)
* devices.
*
* The basic usage is as follows:
- * - Initialize the Subsystem (::SDL_INIT_HAPTIC).
- * - Open a Haptic Device.
+ * - Initialize the subsystem (::SDL_INIT_HAPTIC).
+ * - Open a haptic device.
* - SDL_HapticOpen() to open from index.
* - SDL_HapticOpenFromJoystick() to open from an existing joystick.
* - Create an effect (::SDL_HapticEffect).
* \endcode
*/
-#ifndef _SDL_haptic_h
-#define _SDL_haptic_h
+#ifndef SDL_haptic_h_
+#define SDL_haptic_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
extern "C" {
#endif /* __cplusplus */
+/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF).
+ *
+ * At the moment the magnitude variables are mixed between signed/unsigned, and
+ * it is also not made clear that ALL of those variables expect a max of 0x7FFF.
+ *
+ * Some platforms may have higher precision than that (Linux FF, Windows XInput)
+ * so we should fix the inconsistency in favor of higher possible precision,
+ * adjusting for platforms that use different scales.
+ * -flibit
+ */
+
/**
* \typedef SDL_Haptic
*
/**
* \brief Device can be queried for effect status.
*
- * Device can be queried for effect status.
+ * Device supports querying effect status.
*
* \sa SDL_HapticGetEffectStatus
*/
/**
* \brief Device can be paused.
*
+ * Devices supports being paused.
+ *
* \sa SDL_HapticPause
* \sa SDL_HapticUnpause
*/
/**
* \brief A structure containing a template for a Constant effect.
*
- * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
+ * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
*
* A constant effect applies a constant force in the specified direction
* to the joystick.
* This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
*
* The Left/Right effect is used to explicitly control the large and small
- * motors, commonly found in modern game controllers. One motor is high
- * frequency, the other is low frequency.
+ * motors, commonly found in modern game controllers. The small (right) motor
+ * is high frequency, and the large (left) motor is low frequency.
*
* \sa SDL_HAPTIC_LEFTRIGHT
* \sa SDL_HapticEffect
Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */
/* Replay */
- Uint32 length; /**< Duration of the effect. */
+ Uint32 length; /**< Duration of the effect in milliseconds. */
/* Rumble */
Uint16 large_magnitude; /**< Control of the large controller motor. */
/**
* \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
*
+ * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
+ *
* A custom force feedback effect is much like a periodic effect, where the
* application can define its exact shape. You will have to allocate the
* data yourself. Data should consist of channels * samples Uint16 samples.
extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
/**
- * \brief Get the implementation dependent name of a Haptic device.
+ * \brief Get the implementation dependent name of a haptic device.
*
* 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_HapticName(int device_index);
/**
- * \brief Opens a Haptic device for usage.
+ * \brief Opens a haptic device for use.
*
- * The index passed as an argument refers to the N'th Haptic device on this
+ * The index passed as an argument refers to the N'th haptic device on this
* system.
*
* When opening a haptic device, its gain will be set to maximum and
* \brief Checks to see if a joystick has haptic features.
*
* \param joystick Joystick to test for haptic capabilities.
- * \return 1 if the joystick is haptic, 0 if it isn't
- * or -1 if an error ocurred.
+ * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
+ * or -1 if an error occurred.
*
* \sa SDL_HapticOpenFromJoystick
*/
extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
/**
- * \brief Opens a Haptic device for usage from a Joystick device.
+ * \brief Opens a haptic device for use from a joystick device.
*
* You must still close the haptic device separately. It will not be closed
* with the joystick.
joystick);
/**
- * \brief Closes a Haptic device previously opened with SDL_HapticOpen().
+ * \brief Closes a haptic device previously opened with SDL_HapticOpen().
*
* \param haptic Haptic device to close.
*/
* Example:
* \code
* if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
- * printf("We have constant haptic effect!");
+ * printf("We have constant haptic effect!\n");
* }
* \endcode
*
*
* \param haptic Haptic device to create the effect on.
* \param effect Properties of the effect to create.
- * \return The id of the effect on success or -1 on error.
+ * \return The identifier of the effect on success or -1 on error.
*
* \sa SDL_HapticUpdateEffect
* \sa SDL_HapticRunEffect
/**
* \brief Updates the properties of an effect.
*
- * Can be used dynamically, although behaviour when dynamically changing
+ * Can be used dynamically, although behavior when dynamically changing
* direction may be strange. Specifically the effect may reupload itself
* and start playing from the start. You cannot change the type either when
* running SDL_HapticUpdateEffect().
*
* \param haptic Haptic device that has the effect.
- * \param effect Effect to update.
+ * \param effect Identifier of the effect to update.
* \param data New effect properties to use.
* \return 0 on success or -1 on error.
*
#endif
#include "close_code.h"
-#endif /* _SDL_haptic_h */
+#endif /* SDL_haptic_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* to how they would like the library to work.
*/
-#ifndef _SDL_hints_h
-#define _SDL_hints_h
+#ifndef SDL_hints_h_
+#define SDL_hints_h_
#include "SDL_stdinc.h"
* "opengl"
* "opengles2"
* "opengles"
+ * "metal"
* "software"
*
* The default varies by platform, but it's the first one in the list that
*/
#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG"
+/**
+ * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
+ *
+ * This variable can be set to the following values:
+ * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen
+ * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
+ *
+ * By default letterbox is used
+ */
+#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE"
+
/**
* \brief A variable controlling the scaling quality
*
*/
#define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING"
+/**
+ * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable _NET_WM_BYPASS_COMPOSITOR
+ * "1" - Enable _NET_WM_BYPASS_COMPOSITOR
+ *
+ * By default SDL will use _NET_WM_BYPASS_COMPOSITOR
+ *
+ */
+#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
+
/**
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
*
*/
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
+/**
+ * \brief A variable to specify custom icon resource id from RC file on Windows platform
+ */
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON"
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
+
/**
* \brief A variable controlling whether the windows message loop is processed by SDL
*
*/
#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
+/**
+ * \brief A variable setting the double click time, in milliseconds.
+ */
+#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME"
+
+/**
+ * \brief A variable setting the double click radius, in pixels.
+ */
+#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS"
+
+/**
+ * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode
+ */
+#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE"
+
+/**
+ * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
+ */
+#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
+
/**
* \brief A variable controlling whether relative mouse mode is implemented using mouse warping
*
*/
#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
+/**
+ * \brief A variable controlling whether touch events should generate synthetic mouse events
+ *
+ * This variable can be set to the following values:
+ * "0" - Touch events will not generate mouse events
+ * "1" - Touch events will generate mouse events
+ *
+ * By default SDL will generate mouse events for touch events
+ */
+#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS"
+
+/**
+ * \brief A variable controlling whether mouse events should generate synthetic touch events
+ *
+ * This variable can be set to the following values:
+ * "0" - Mouse events will not generate touch events (default for desktop platforms)
+ * "1" - Mouse events will generate touch events (default for mobile platforms, such as Android and iOS)
+ */
+
+#define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS"
+
/**
* \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
*
#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
/**
- * \brief A variable controlling which orientations are allowed on iOS.
+ * \brief A variable controlling which orientations are allowed on iOS/Android.
*
* In some circumstances it is necessary to be able to explicitly control
* which UI orientations are allowed.
*/
#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
+/**
+ * \brief A variable controlling whether the home indicator bar on iPhone X
+ * should be hidden.
+ *
+ * This variable can be set to the following values:
+ * "0" - The indicator bar is not hidden (default for windowed applications)
+ * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications)
+ * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications)
+ */
+#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR"
+
/**
* \brief A variable controlling whether the Android / iOS built-in
- * accelerometer should be listed as a joystick device, rather than listing
- * actual joysticks only.
+ * accelerometer should be listed as a joystick device.
*
* This variable can be set to the following values:
- * "0" - List only real joysticks and accept input from them
- * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default).
+ * "0" - The accelerometer is not listed as a joystick
+ * "1" - The accelerometer is available as a 3 axis joystick (the default).
*/
#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
+/**
+ * \brief A variable controlling whether the Android / tvOS remotes
+ * should be listed as joystick devices, instead of sending keyboard events.
+ *
+ * This variable can be set to the following values:
+ * "0" - Remotes send enter/escape/arrow key events
+ * "1" - Remotes are available as 2 axis, 2 button joysticks (the default).
+ */
+#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK"
/**
* \brief A variable that lets you disable the detection and use of Xinput gamepad devices
*/
#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
-
/**
* \brief A variable that causes SDL to use the old axis and button mapping for XInput devices.
*
*/
#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
-
/**
- * \brief A variable that lets you manually hint extra gamecontroller db entries
+ * \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
*
*/
#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
+/**
+ * \brief A variable that lets you provide a file with extra gamecontroller db entries.
+ *
+ * The file should contain lines 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_FILE "SDL_GAMECONTROLLERCONFIG_FILE"
+
+/**
+ * \brief A variable containing a list of devices to skip when scanning for game controllers.
+ *
+ * The format of the string is a comma separated list of USB VID/PID pairs
+ * in hexadecimal form, e.g.
+ *
+ * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ * The variable can also take the form of @file, in which case the named
+ * file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES"
+
+/**
+ * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable.
+ *
+ * The format of the string is a comma separated list of USB VID/PID pairs
+ * in hexadecimal form, e.g.
+ *
+ * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ * The variable can also take the form of @file, in which case the named
+ * file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
/**
* \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
*/
#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
+/**
+ * \brief A variable controlling whether the HIDAPI joystick drivers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI drivers are not used
+ * "1" - HIDAPI drivers are used (the default)
+ *
+ * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below.
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4"
+
+/**
+ * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver.
+ *
+ * This variable can be set to the following values:
+ * "0" - extended reports are not enabled (the default)
+ * "1" - extended reports
+ *
+ * Extended input reports allow rumble on Bluetooth PS4 controllers, but
+ * break DirectInput handling for applications that don't use SDL.
+ *
+ * Once extended reports are enabled, they can not be disabled without
+ * power cycling the controller.
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX"
+
+/**
+ * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
+ *
+ * The variable can be set to the following values:
+ * "0" - Do not scan for Steam Controllers
+ * "1" - Scan for Steam Controllers (the default)
+ *
+ * The default value is "1". This hint must be set before initializing the joystick subsystem.
+ */
+#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS"
+
/**
* \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
*/
#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
-
/**
* \brief A variable that controls the timer resolution, in milliseconds.
*
#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
+/**
+ * \brief A variable describing the content orientation on QtWayland-based platforms.
+ *
+ * On QtWayland platforms, windows are rotated client-side to allow for custom
+ * transitions. In order to correctly position overlays (e.g. volume bar) and
+ * gestures (e.g. events view, close/minimize gestures), the system needs to
+ * know in which orientation the application is currently drawing its contents.
+ *
+ * This does not cause the window to be rotated or resized, the application
+ * needs to take care of drawing the content in the right orientation (the
+ * framebuffer is always in portrait mode).
+ *
+ * This variable can be one of the following values:
+ * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape"
+ */
+#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION"
+
+/**
+ * \brief Flags to set on QtWayland windows to integrate with the native window manager.
+ *
+ * On QtWayland platforms, this hint controls the flags to set on the windows.
+ * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures.
+ *
+ * This variable is a space-separated list of the following values (empty = no flags):
+ * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager"
+ */
+#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS"
/**
* \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size
* This is specially useful if you build SDL against a non glibc libc library (such as musl) which
* provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
* Support for this hint is currently available only in the pthread, Windows, and PSP backend.
+*
+* Instead of this hint, in 2.0.9 and later, you can use
+* SDL_CreateThreadWithStackSize(). This hint only works with the classic
+* SDL_CreateThread().
*/
#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE"
*/
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
+/**
+ * \brief A variable to control whether we trap the Android back button to handle it manually.
+ * This is necessary for the right mouse button to work on some Android devices, or
+ * to be able to trap the back button for use in your code reliably. If set to true,
+ * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of
+ * SDL_SCANCODE_AC_BACK.
+ *
+ * The variable can be set to the following values:
+ * "0" - Back button will be handled as usual for system. (default)
+ * "1" - Back button will be trapped, allowing you to handle the key press
+ * manually. (This will also let right mouse click work on systems
+ * where the right mouse button functions as back.)
+ *
+ * The value of this hint is used at runtime, so it can be changed at any time.
+ */
+#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON"
+
+/**
+ * \brief A variable to control whether the event loop will block itself when the app is paused.
+ *
+ * The variable can be set to the following values:
+ * "0" - Non blocking.
+ * "1" - Blocking. (default)
+ *
+ * The value should be set before SDL is initialized.
+ */
+#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE"
+
/**
- * \brief A variable to control whether mouse and touch events are to be treated together or separately
+ * \brief A variable to control whether the return key on the soft keyboard
+ * should hide the soft keyboard on Android and iOS.
*
* The variable can be set to the following values:
- * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse
- * events. This is the behaviour of SDL <= 2.0.3. (default)
- * "1" - Mouse events will be handled separately from pure touch events.
+ * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default)
+ * "1" - The return key will hide the keyboard.
*
* The value of this hint is used at runtime, so it can be changed at any time.
*/
-#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
+#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME"
/**
* \brief override the binding element for keyboard inputs for Emscripten builds
* "0" - SDL will generate a window-close event when it sees Alt+F4.
* "1" - SDL will only do normal key handling for Alt+F4.
*/
-#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
+#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
/**
* \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs.
#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
/**
- * \brief Tell SDL not to name threads on Windows.
+ * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
+ * The 0x406D1388 Exception is a trick used to inform Visual Studio of a
+ * thread's name, but it tends to cause problems with other debuggers,
+ * and the .NET runtime. Note that SDL 2.0.6 and later will still use
+ * the (safer) SetThreadDescription API, introduced in the Windows 10
+ * Creators Update, if available.
*
* The variable can be set to the following values:
* "0" - SDL will raise the 0x406D1388 Exception to name threads.
- * This is the default behavior of SDL <= 2.0.4. (default)
- * "1" - SDL will not raise this exception, and threads will be unnamed.
- * For .NET languages this is required when running under a debugger.
+ * This is the default behavior of SDL <= 2.0.4.
+ * "1" - SDL will not raise this exception, and threads will be unnamed. (default)
+ * This is necessary with .NET languages or debuggers that aren't Visual Studio.
*/
#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
*/
#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER"
+/**
+ * \brief Tell the video driver that we only want a double buffer.
+ *
+ * By default, most lowlevel 2D APIs will use a triple buffer scheme that
+ * wastes no CPU time on waiting for vsync after issuing a flip, but
+ * introduces a frame of latency. On the other hand, using a double buffer
+ * scheme instead is recommended for cases where low latency is an important
+ * factor because we save a whole frame of latency.
+ * We do so by waiting for vsync immediately after issuing a flip, usually just
+ * after eglSwapBuffers call in the backend's *_SwapWindow function.
+ *
+ * Since it's driver-specific, it's only supported where possible and
+ * implemented. Currently supported the following drivers:
+ * - KMSDRM (kmsdrm)
+ * - Raspberry Pi (raspberrypi)
+ */
+#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER"
+
+/**
+ * \brief A variable controlling what driver to use for OpenGL ES contexts.
+ *
+ * On some platforms, currently Windows and X11, OpenGL drivers may support
+ * creating contexts with an OpenGL ES profile. By default SDL uses these
+ * profiles, when available, otherwise it attempts to load an OpenGL ES
+ * library, e.g. that provided by the ANGLE project. This variable controls
+ * whether SDL follows this default behaviour or will always load an
+ * OpenGL ES library.
+ *
+ * Circumstances where this is useful include
+ * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE,
+ * or emulator, e.g. those from ARM, Imagination or Qualcomm.
+ * - Resolving OpenGL ES function addresses at link time by linking with
+ * the OpenGL ES library instead of querying them at run time with
+ * SDL_GL_GetProcAddress().
+ *
+ * Caution: for an application to work with the default behaviour across
+ * different OpenGL drivers it must query the OpenGL ES function
+ * addresses at run time using SDL_GL_GetProcAddress().
+ *
+ * This variable is ignored on most platforms because OpenGL ES is native
+ * or not supported.
+ *
+ * This variable can be set to the following values:
+ * "0" - Use ES profile of OpenGL, if available. (Default when not set.)
+ * "1" - Load OpenGL ES library using the default library names.
+ *
+ */
+#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER"
+
+/**
+ * \brief A variable controlling speed/quality tradeoff of audio resampling.
+ *
+ * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ )
+ * to handle audio resampling. There are different resampling modes available
+ * that produce different levels of quality, using more CPU.
+ *
+ * If this hint isn't specified to a valid setting, or libsamplerate isn't
+ * available, SDL will use the default, internal resampling algorithm.
+ *
+ * Note that this is currently only applicable to resampling audio that is
+ * being written to a device for playback or audio being read from a device
+ * for capture. SDL_AudioCVT always uses the default resampler (although this
+ * might change for SDL 2.1).
+ *
+ * This hint is currently only checked at audio subsystem initialization.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast)
+ * "1" or "fast" - Use fast, slightly higher quality resampling, if available
+ * "2" or "medium" - Use medium quality resampling, if available
+ * "3" or "best" - Use high quality resampling, if available
+ */
+#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE"
+
+/**
+ * \brief A variable controlling the audio category on iOS and Mac OS X
+ *
+ * This variable can be set to the following values:
+ *
+ * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default)
+ * "playback" - Use the AVAudioSessionCategoryPlayback category
+ *
+ * For more information, see Apple's documentation:
+ * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html
+ */
+#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY"
+
+/**
+ * \brief A variable controlling whether the 2D render API is compatible or efficient.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" - Don't use batching to make rendering more efficient.
+ * "1" - Use batching, but might cause problems if app makes its own direct OpenGL calls.
+ *
+ * Up to SDL 2.0.9, the render API would draw immediately when requested. Now
+ * it batches up draw requests and sends them all to the GPU only when forced
+ * to (during SDL_RenderPresent, when changing render targets, by updating a
+ * texture that the batch needs, etc). This is significantly more efficient,
+ * but it can cause problems for apps that expect to render on top of the
+ * render API's output. As such, SDL will disable batching if a specific
+ * render backend is requested (since this might indicate that the app is
+ * planning to use the underlying graphics API directly). This hint can
+ * be used to explicitly request batching in this instance. It is a contract
+ * that you will either never use the underlying graphics API directly, or
+ * if you do, you will call SDL_RenderFlush() before you do so any current
+ * batch goes to the GPU before your work begins. Not following this contract
+ * will result in undefined behavior.
+ */
+#define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING"
+
+
+/**
+ * \brief A variable controlling whether SDL logs all events pushed onto its internal queue.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" - Don't log any events (default)
+ * "1" - Log all events except mouse and finger motion, which are pretty spammy.
+ * "2" - Log all events.
+ *
+ * This is generally meant to be used to debug SDL itself, but can be useful
+ * for application developers that need better visibility into what is going
+ * on in the event queue. Logged events are sent through SDL_Log(), which
+ * means by default they appear on stdout on most platforms or maybe
+ * OutputDebugString() on Windows, and can be funneled by the app with
+ * SDL_LogSetOutputFunction(), etc.
+ *
+ * This hint can be toggled on and off at runtime, if you only need to log
+ * events for a small subset of program execution.
+ */
+#define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING"
+
+
+
+/**
+ * \brief Controls how the size of the RIFF chunk affects the loading of a WAVE file.
+ *
+ * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE
+ * file) is not always reliable. In case the size is wrong, it's possible to
+ * just ignore it and step through the chunks until a fixed limit is reached.
+ *
+ * Note that files that have trailing data unrelated to the WAVE file or
+ * corrupt files may slow down the loading process without a reliable boundary.
+ * By default, SDL stops after 10000 chunks to prevent wasting time. Use the
+ * environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value.
+ *
+ * This variable can be set to the following values:
+ *
+ * "force" - Always use the RIFF chunk size as a boundary for the chunk search
+ * "ignorezero" - Like "force", but a zero size searches up to 4 GiB (default)
+ * "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB
+ * "maximum" - Search for chunks until the end of file (not recommended)
+ */
+#define SDL_HINT_WAVE_RIFF_CHUNK_SIZE "SDL_WAVE_RIFF_CHUNK_SIZE"
+
+/**
+ * \brief Controls how a truncated WAVE file is handled.
+ *
+ * A WAVE file is considered truncated if any of the chunks are incomplete or
+ * the data chunk size is not a multiple of the block size. By default, SDL
+ * decodes until the first incomplete block, as most applications seem to do.
+ *
+ * This variable can be set to the following values:
+ *
+ * "verystrict" - Raise an error if the file is truncated
+ * "strict" - Like "verystrict", but the size of the RIFF chunk is ignored
+ * "dropframe" - Decode until the first incomplete sample frame
+ * "dropblock" - Decode until the first incomplete block (default)
+ */
+#define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION"
+
+/**
+ * \brief Controls how the fact chunk affects the loading of a WAVE file.
+ *
+ * The fact chunk stores information about the number of samples of a WAVE
+ * file. The Standards Update from Microsoft notes that this value can be used
+ * to 'determine the length of the data in seconds'. This is especially useful
+ * for compressed formats (for which this is a mandatory chunk) if they produce
+ * multiple sample frames per block and truncating the block is not allowed.
+ * The fact chunk can exactly specify how many sample frames there should be
+ * in this case.
+ *
+ * Unfortunately, most application seem to ignore the fact chunk and so SDL
+ * ignores it by default as well.
+ *
+ * This variable can be set to the following values:
+ *
+ * "truncate" - Use the number of samples to truncate the wave data if
+ * the fact chunk is present and valid
+ * "strict" - Like "truncate", but raise an error if the fact chunk
+ * is invalid, not present for non-PCM formats, or if the
+ * data chunk doesn't have that many samples
+ * "ignorezero" - Like "truncate", but ignore fact chunk if the number of
+ * samples is zero
+ * "ignore" - Ignore fact chunk entirely (default)
+ */
+#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK"
+
/**
* \brief An enumeration of hint priorities
*/
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value);
+/**
+ * \brief type definition of the hint callback function.
+ */
+typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
+
/**
* \brief Add a function to watch a particular hint
*
* \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);
#endif
#include "close_code.h"
-#endif /* _SDL_hints_h */
+#endif /* SDL_hints_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*
*/
-#ifndef _SDL_joystick_h
-#define _SDL_joystick_h
+#ifndef SDL_joystick_h_
+#define SDL_joystick_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/
-/* The joystick structure used to identify an SDL joystick */
+/**
+ * The joystick structure used to identify an SDL joystick
+ */
struct _SDL_Joystick;
typedef struct _SDL_Joystick SDL_Joystick;
Uint8 data[16];
} SDL_JoystickGUID;
+/**
+ * This is a unique ID for a joystick for the time it is connected to the system,
+ * and is never reused for the lifetime of the application. If the joystick is
+ * disconnected and reconnected, it will get a new ID.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
typedef Sint32 SDL_JoystickID;
+typedef enum
+{
+ SDL_JOYSTICK_TYPE_UNKNOWN,
+ SDL_JOYSTICK_TYPE_GAMECONTROLLER,
+ SDL_JOYSTICK_TYPE_WHEEL,
+ SDL_JOYSTICK_TYPE_ARCADE_STICK,
+ SDL_JOYSTICK_TYPE_FLIGHT_STICK,
+ SDL_JOYSTICK_TYPE_DANCE_PAD,
+ SDL_JOYSTICK_TYPE_GUITAR,
+ SDL_JOYSTICK_TYPE_DRUM_KIT,
+ SDL_JOYSTICK_TYPE_ARCADE_PAD,
+ SDL_JOYSTICK_TYPE_THROTTLE
+} SDL_JoystickType;
+
typedef enum
{
SDL_JOYSTICK_POWER_UNKNOWN = -1,
- SDL_JOYSTICK_POWER_EMPTY,
- SDL_JOYSTICK_POWER_LOW,
- SDL_JOYSTICK_POWER_MEDIUM,
- SDL_JOYSTICK_POWER_FULL,
+ SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */
+ SDL_JOYSTICK_POWER_LOW, /* <= 20% */
+ SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */
+ SDL_JOYSTICK_POWER_FULL, /* <= 100% */
SDL_JOYSTICK_POWER_WIRED,
SDL_JOYSTICK_POWER_MAX
} SDL_JoystickPowerLevel;
/* Function prototypes */
+
+/**
+ * Locking for multi-threaded access to the joystick API
+ *
+ * If you are using the joystick API or handling events from multiple threads
+ * you should use these locking functions to protect access to the joysticks.
+ *
+ * In particular, you are guaranteed that the joystick list won't change, so
+ * the API functions that take a joystick index will be valid, and joystick
+ * and game controller events will not be delivered.
+ */
+extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
+extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
+
/**
* Count the number of joysticks attached to the system right now
*/
*/
extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
+/**
+ * Get the player index of a joystick, or -1 if it's not available
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
+
+/**
+ * Return the GUID for the joystick at this index
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+
+/**
+ * Get the USB vendor ID of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
+
+/**
+ * Get the USB product ID of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
+
+/**
+ * Get the product version of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
+
+/**
+ * Get the type of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
+
+/**
+ * Get the instance ID of a joystick.
+ * This can be called before any joysticks are opened.
+ * If the index is out of range, this function will return -1.
+ */
+extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
+
/**
* Open a joystick for use.
* The index passed as an argument refers to the N'th joystick on the system.
extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
/**
- * Return the GUID for the joystick at this index
+ * Get the player index of an opened joystick, or -1 if it's not available
+ *
+ * For XInput controllers this returns the XInput user index.
*/
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick);
/**
* Return the GUID for this opened joystick
*/
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
+/**
+ * Get the USB vendor ID of an opened joystick, if available.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick);
+
+/**
+ * Get the USB product ID of an opened joystick, if available.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
+
+/**
+ * Get the product version of an opened joystick, if available.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
+
+/**
+ * Get the type of an opened joystick.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(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 SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
/**
- * convert a string into a joystick formatted guid
+ * Convert a string into a joystick guid
*/
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
*/
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
+#define SDL_JOYSTICK_AXIS_MAX 32767
+#define SDL_JOYSTICK_AXIS_MIN -32768
/**
* Get the current state of an axis control on a joystick.
*
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
int axis);
+/**
+ * Get the initial 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.
+ *
+ * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,
+ int axis, Sint16 *state);
+
/**
* \name Hat positions
*/
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
int button);
+/**
+ * Trigger a rumble effect
+ * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
+ *
+ * \param joystick The joystick to vibrate
+ * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF
+ * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
+ * \param duration_ms The duration of the rumble effect, in milliseconds
+ *
+ * \return 0, or -1 if rumble isn't supported on this joystick
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
+
/**
* Close a joystick previously opened with SDL_JoystickOpen().
*/
#endif
#include "close_code.h"
-#endif /* _SDL_joystick_h */
+#endif /* SDL_joystick_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL keyboard event handling
*/
-#ifndef _SDL_keyboard_h
-#define _SDL_keyboard_h
+#ifndef SDL_keyboard_h_
+#define SDL_keyboard_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
#include "close_code.h"
-#endif /* _SDL_keyboard_h */
+#endif /* SDL_keyboard_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Defines constants which identify keyboard keys and modifiers.
*/
-#ifndef _SDL_keycode_h
-#define _SDL_keycode_h
+#ifndef SDL_keycode_h_
+#define SDL_keycode_h_
#include "SDL_stdinc.h"
#include "SDL_scancode.h"
* 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.
+ *
+ * A special exception is the number keys at the top of the keyboard which
+ * always map to SDLK_0...SDLK_9, regardless of layout.
*/
typedef Sint32 SDL_Keycode;
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)
+ SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
+ SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
+ SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
+
+ SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
+ SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
};
/**
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
-#endif /* _SDL_keycode_h */
+#endif /* SDL_keycode_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* the results you expect. :)
*/
-#ifndef _SDL_loadso_h
-#define _SDL_loadso_h
+#ifndef SDL_loadso_h_
+#define SDL_loadso_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
#include "close_code.h"
-#endif /* _SDL_loadso_h */
+#endif /* SDL_loadso_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Others: standard error output (stderr)
*/
-#ifndef _SDL_log_h
-#define _SDL_log_h
+#ifndef SDL_log_h_
+#define SDL_log_h_
#include "SDL_stdinc.h"
/**
* \brief The prototype for the log output function
*/
-typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
+typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
/**
* \brief Get the current log output function.
#endif
#include "close_code.h"
-#endif /* _SDL_log_h */
+#endif /* SDL_log_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_main_h
-#define _SDL_main_h
+#ifndef SDL_main_h_
+#define SDL_main_h_
#include "SDL_stdinc.h"
/* On iOS SDL provides a main function that creates an application delegate
and starts the iOS application run loop.
+ If you link with SDL dynamically on iOS, the main function can't be in a
+ shared library, so you need to link with libSDLmain.a, which includes a
+ stub main function that calls into the shared library to start execution.
+
See src/video/uikit/SDL_uikitappdelegate.m for more details.
*/
#define SDL_MAIN_NEEDED
/* On Android SDL provides a Java class in SDLActivity.java that is the
main activity entry point.
- See README-android.md for more details on extending that class.
+ See docs/README-android.md for more details on extending that class.
*/
#define SDL_MAIN_NEEDED
+/* We need to export SDL_main so it can be launched from Java */
+#define SDLMAIN_DECLSPEC DECLSPEC
+
#elif defined(__NACL__)
/* On NACL we use ppapi_simple to set up the application helper code,
then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before
#endif
#endif /* SDL_MAIN_HANDLED */
-#ifdef __cplusplus
-#define C_LINKAGE "C"
-#else
-#define C_LINKAGE
-#endif /* __cplusplus */
+#ifndef SDLMAIN_DECLSPEC
+#define SDLMAIN_DECLSPEC
+#endif
/**
* \file SDL_main.h
#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
+/**
+ * The prototype for the application's main() function
+ */
+typedef int (*SDL_main_func)(int argc, char *argv[]);
+extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
+
+
/**
* This is called by the real SDL main function to let the rest of the
* library know that initialization was done properly.
/**
* 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 int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#endif /* __WIN32__ */
* \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
* information on the failure.
*/
-extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved);
+extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved);
#endif /* __WINRT__ */
+#if defined(__IPHONEOS__)
+
+/**
+ * \brief Initializes and launches an SDL application.
+ *
+ * \param argc The argc parameter from the application's main() function
+ * \param argv The argv parameter from the application's main() function
+ * \param mainFunction The SDL app's C-style main().
+ * \return the return value from mainFunction
+ */
+extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction);
+
+#endif /* __IPHONEOS__ */
+
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_main_h */
+#endif /* SDL_main_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_messagebox_h
-#define _SDL_messagebox_h
+#ifndef SDL_messagebox_h_
+#define SDL_messagebox_h_
#include "SDL_stdinc.h"
#include "SDL_video.h" /* For SDL_Window */
#endif
#include "close_code.h"
-#endif /* _SDL_messagebox_h */
+#endif /* SDL_messagebox_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL mouse event handling.
*/
-#ifndef _SDL_mouse_h
-#define _SDL_mouse_h
+#ifndef SDL_mouse_h_
+#define SDL_mouse_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
extern "C" {
#endif
-typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */
+typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
/**
* \brief Cursor types for SDL_CreateSystemCursor().
#endif
#include "close_code.h"
-#endif /* _SDL_mouse_h */
+#endif /* SDL_mouse_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_mutex_h
-#define _SDL_mutex_h
+#ifndef SDL_mutex_h_
+#define SDL_mutex_h_
/**
* \file SDL_mutex.h
#endif
#include "close_code.h"
-#endif /* _SDL_mutex_h */
+#endif /* SDL_mutex_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDLname_h_
-#define _SDLname_h_
+#ifndef SDLname_h_
+#define SDLname_h_
#if defined(__STDC__) || defined(__cplusplus)
#define NeedFunctionPrototypes 1
#define SDL_NAME(X) SDL_##X
-#endif /* _SDLname_h_ */
+#endif /* SDLname_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* version included in SDL_opengl.h.
*/
-#ifndef _SDL_opengl_h
-#define _SDL_opengl_h
+#ifndef SDL_opengl_h_
+#define SDL_opengl_h_
#include "SDL_config.h"
#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
# define GLAPI extern
# define GLAPIENTRY __stdcall
+#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */
+# define GLAPI extern
+# define GLAPIENTRY _System
+# define APIENTRY _System
+# if defined(__GNUC__) && !defined(_System)
+# define _System
+# endif
#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
# define GLAPI __attribute__((visibility("default")))
# define GLAPIENTRY
#endif /* !__IPHONEOS__ */
-#endif /* _SDL_opengl_h */
+#endif /* SDL_opengl_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header for the enumerated pixel format definitions.
*/
-#ifndef _SDL_pixels_h
-#define _SDL_pixels_h
+#ifndef SDL_pixels_h_
+#define SDL_pixels_h_
#include "SDL_stdinc.h"
#include "SDL_endian.h"
((format) && (SDL_PIXELFLAG(format) != 1))
/* Note: If you modify this list, update SDL_GetPixelFormatName() */
-enum
+typedef enum
{
SDL_PIXELFORMAT_UNKNOWN,
SDL_PIXELFORMAT_INDEX1LSB =
SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
- SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1')
-};
+ SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
+ SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
+ SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
+} SDL_PixelFormatEnum;
typedef struct SDL_Color
{
#endif
#include "close_code.h"
-#endif /* _SDL_pixels_h */
+#endif /* SDL_pixels_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Try to get a standard set of platform defines.
*/
-#ifndef _SDL_platform_h
-#define _SDL_platform_h
+#ifndef SDL_platform_h_
+#define SDL_platform_h_
#if defined(_AIX)
#undef __AIX__
#undef __OPENBSD__
#define __OPENBSD__ 1
#endif
-#if defined(__OS2__)
+#if defined(__OS2__) || defined(__EMX__)
#undef __OS2__
#define __OS2__ 1
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT or non-WinRT */
-/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
-#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */
+#if defined(_MSC_VER) && defined(__has_include)
+#if __has_include(<winapifamily.h>)
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
+#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+#if HAVE_WINAPIFAMILY_H
#include <winapifamily.h>
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#undef __WINDOWS__
-#define __WINDOWS__ 1
-/* See if we're compiling for WinRT: */
-#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
+#else
+#define WINAPI_FAMILY_WINRT 0
+#endif /* HAVE_WINAPIFAMILY_H */
+
+#if WINAPI_FAMILY_WINRT
#undef __WINRT__
#define __WINRT__ 1
-#endif
#else
#undef __WINDOWS__
-#define __WINDOWS__ 1
-#endif /* _MSC_VER < 1700 */
+#define __WINDOWS__ 1
+#endif
#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
#if defined(__WINDOWS__)
#endif
#include "close_code.h"
-#endif /* _SDL_platform_h */
+#endif /* SDL_platform_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_power_h
-#define _SDL_power_h
+#ifndef SDL_power_h_
+#define SDL_power_h_
/**
* \file SDL_power.h
#endif
#include "close_code.h"
-#endif /* _SDL_power_h */
+#endif /* SDL_power_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL quit event handling.
*/
-#ifndef _SDL_quit_h
-#define _SDL_quit_h
+#ifndef SDL_quit_h_
+#define SDL_quit_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#define SDL_QuitRequested() \
(SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
-#endif /* _SDL_quit_h */
+#endif /* SDL_quit_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file for SDL_rect definition and management functions.
*/
-#ifndef _SDL_rect_h
-#define _SDL_rect_h
+#ifndef SDL_rect_h_
+#define SDL_rect_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
/**
- * \brief The structure that defines a point
+ * \brief The structure that defines a point (integer)
*
* \sa SDL_EnclosePoints
* \sa SDL_PointInRect
} SDL_Point;
/**
- * \brief A rectangle, with the origin at the upper left.
+ * \brief The structure that defines a point (floating point)
+ *
+ * \sa SDL_EnclosePoints
+ * \sa SDL_PointInRect
+ */
+typedef struct SDL_FPoint
+{
+ float x;
+ float y;
+} SDL_FPoint;
+
+
+/**
+ * \brief A rectangle, with the origin at the upper left (integer).
*
* \sa SDL_RectEmpty
* \sa SDL_RectEquals
int w, h;
} SDL_Rect;
+
+/**
+ * \brief A rectangle, with the origin at the upper left (floating point).
+ */
+typedef struct SDL_FRect
+{
+ float x;
+ float y;
+ float w;
+ float h;
+} SDL_FRect;
+
+
/**
* \brief Returns true if point resides inside a rectangle.
*/
#endif
#include "close_code.h"
-#endif /* _SDL_rect_h */
+#endif /* SDL_rect_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
*/
-#ifndef _SDL_render_h
-#define _SDL_render_h
+#ifndef SDL_render_h_
+#define SDL_render_h_
#include "SDL_stdinc.h"
#include "SDL_rect.h"
* active, the format was unsupported, or the width or height were out
* of range.
*
+ * \note The contents of the texture are not defined at creation.
+ *
* \sa SDL_QueryTexture()
* \sa SDL_UpdateTexture()
* \sa SDL_DestroyTexture()
* \param texture The texture to update
* \param rect A pointer to the rectangle of pixels to update, or NULL to
* update the entire texture.
- * \param pixels The raw pixel data.
+ * \param pixels The raw pixel data in the format of the texture.
* \param pitch The number of bytes in a row of pixel data, including padding between lines.
*
+ * The pixel data must be in the format of the texture. The pixel format can be
+ * queried with SDL_QueryTexture.
+ *
* \return 0 on success, or -1 if the texture is not valid.
*
* \note This is a fairly slow function.
* texture.
* \param dstrect A pointer to the destination rectangle, or NULL for the
* entire rendering target.
- * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect
+ * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
* \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
* \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
*
const SDL_Point *center,
const SDL_RendererFlip flip);
+
+/**
+ * \brief Draw a point on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a point.
+ * \param x The x coordinate of the point.
+ * \param y The y coordinate of the point.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer,
+ float x, float y);
+
+/**
+ * \brief Draw multiple points on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple points.
+ * \param points The points to draw
+ * \param count The number of points to draw
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer,
+ const SDL_FPoint * points,
+ int count);
+
+/**
+ * \brief Draw a line on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a line.
+ * \param x1 The x coordinate of the start point.
+ * \param y1 The y coordinate of the start point.
+ * \param x2 The x coordinate of the end point.
+ * \param y2 The y coordinate of the end point.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer,
+ float x1, float y1, float x2, float y2);
+
+/**
+ * \brief Draw a series of connected lines on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple lines.
+ * \param points The points along the lines
+ * \param count The number of points, drawing count-1 lines
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer,
+ const SDL_FPoint * points,
+ int count);
+
+/**
+ * \brief Draw a rectangle on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a rectangle.
+ * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer,
+ const SDL_FRect * rect);
+
+/**
+ * \brief Draw some number of rectangles on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple rectangles.
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer,
+ const SDL_FRect * rects,
+ int count);
+
+/**
+ * \brief Fill a rectangle on the current rendering target with the drawing color.
+ *
+ * \param renderer The renderer which should fill a rectangle.
+ * \param rect A pointer to the destination rectangle, or NULL for the entire
+ * rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer,
+ const SDL_FRect * rect);
+
+/**
+ * \brief Fill some number of rectangles on the current rendering target with the drawing color.
+ *
+ * \param renderer The renderer which should fill multiple rectangles.
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer,
+ const SDL_FRect * rects,
+ int count);
+
+/**
+ * \brief Copy a portion of the texture to the current rendering target.
+ *
+ * \param renderer The renderer which should copy parts of a texture.
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_FRect * dstrect);
+
+/**
+ * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
+ *
+ * \param renderer The renderer which should copy parts of a texture.
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
+ * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
+ * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_FRect * dstrect,
+ const double angle,
+ const SDL_FPoint *center,
+ const SDL_RendererFlip flip);
+
/**
* \brief Read pixels from the current rendering target.
*
*/
extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
+/**
+ * \brief Force the rendering context to flush any pending commands to the
+ * underlying rendering API.
+ *
+ * You do not need to (and in fact, shouldn't) call this function unless
+ * you are planning to call into OpenGL/Direct3D/Metal/whatever directly
+ * in addition to using an SDL_Renderer.
+ *
+ * This is for a very-specific case: if you are using SDL's render API,
+ * you asked for a specific renderer backend (OpenGL, Direct3D, etc),
+ * you set SDL_HINT_RENDER_BATCHING to "1", and you plan to make
+ * OpenGL/D3D/whatever calls in addition to SDL render API calls. If all of
+ * this applies, you should call SDL_RenderFlush() between calls to SDL's
+ * render API and the low-level API you're using in cooperation.
+ *
+ * In all other cases, you can ignore this function. This is only here to
+ * get maximum performance out of a specific situation. In all other cases,
+ * SDL will do the right thing, perhaps at a performance loss.
+ *
+ * This function is first available in SDL 2.0.10, and is not needed in
+ * 2.0.9 and earlier, as earlier versions did not queue rendering commands
+ * at all, instead flushing them to the OS immediately.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer * renderer);
+
/**
* \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
*/
extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
+/**
+ * \brief Get the CAMetalLayer associated with the given Metal renderer
+ *
+ * \param renderer The renderer to query
+ *
+ * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer
+ *
+ * \sa SDL_RenderGetMetalCommandEncoder()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
+
+/**
+ * \brief Get the Metal command encoder for the current frame
+ *
+ * \param renderer The renderer to query
+ *
+ * \return id<MTLRenderCommandEncoder> on success, or NULL if the renderer isn't a Metal renderer
+ *
+ * \sa SDL_RenderGetMetalLayer()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
#endif
#include "close_code.h"
-#endif /* _SDL_render_h */
+#endif /* SDL_render_h_ */
/* vi: set ts=4 sw=4 expandtab: */
-#define SDL_REVISION "hg-10556:007dfe83abf8"
-#define SDL_REVISION_NUMBER 10556
+#define SDL_REVISION "hg-12952:bc90ce38f1e2"
+#define SDL_REVISION_NUMBER 12952
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* data streams. It can easily be extended to files, memory, etc.
*/
-#ifndef _SDL_rwops_h
-#define _SDL_rwops_h
+#ifndef SDL_rwops_h_
+#define SDL_rwops_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
/* RWops Types */
-#define SDL_RWOPS_UNKNOWN 0U /* Unknown stream type */
-#define SDL_RWOPS_WINFILE 1U /* Win32 file */
-#define SDL_RWOPS_STDFILE 2U /* Stdio file */
-#define SDL_RWOPS_JNIFILE 3U /* Android asset */
-#define SDL_RWOPS_MEMORY 4U /* Memory stream */
-#define SDL_RWOPS_MEMORY_RO 5U /* Read-Only memory stream */
+#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */
+#define SDL_RWOPS_WINFILE 1U /**< Win32 file */
+#define SDL_RWOPS_STDFILE 2U /**< Stdio file */
+#define SDL_RWOPS_JNIFILE 3U /**< Android asset */
+#define SDL_RWOPS_MEMORY 4U /**< Memory stream */
+#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */
/**
* This is the read/write operation structure -- very basic.
#define RW_SEEK_END 2 /**< Seek relative to the end of data */
/**
- * \name Read/write macros
+ * Return the size of the file in this rwops, or -1 if unknown
+ */
+extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
+
+/**
+ * Seek to \c offset relative to \c whence, one of stdio's whence values:
+ * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
*
- * Macros to easily read and write from an SDL_RWops structure.
+ * \return the final offset in the data stream, or -1 on error.
*/
-/* @{ */
-#define SDL_RWsize(ctx) (ctx)->size(ctx)
-#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
-#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
-#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
-#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
-#define SDL_RWclose(ctx) (ctx)->close(ctx)
-/* @} *//* Read/write macros */
+extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context,
+ Sint64 offset, int whence);
+
+/**
+ * Return the current offset in the data stream, or -1 on error.
+ */
+extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context);
+
+/**
+ * Read up to \c maxnum objects each of size \c size from the data
+ * stream to the area pointed at by \c ptr.
+ *
+ * \return the number of objects read, or 0 at error or end of file.
+ */
+extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context,
+ void *ptr, size_t size, size_t maxnum);
+
+/**
+ * Write exactly \c num objects each of size \c size from the area
+ * pointed at by \c ptr to data stream.
+ *
+ * \return the number of objects written, or 0 at error or end of file.
+ */
+extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context,
+ const void *ptr, size_t size, size_t num);
+
+/**
+ * Close and free an allocated SDL_RWops structure.
+ *
+ * \return 0 if successful or -1 on write error when flushing data.
+ */
+extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context);
+/**
+ * Load all the data from an SDL data stream.
+ *
+ * The data is allocated with a zero byte at the end (null terminated)
+ *
+ * If \c datasize is not NULL, it is filled with the size of the data read.
+ *
+ * If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ * The data should be freed with SDL_free().
+ *
+ * \return the data, or NULL if there was an error.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize,
+ int freesrc);
+
+/**
+ * Load an entire file.
+ *
+ * The data is allocated with a zero byte at the end (null terminated)
+ *
+ * If \c datasize is not NULL, it is filled with the size of the data read.
+ *
+ * If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ * The data should be freed with SDL_free().
+ *
+ * \return the data, or NULL if there was an error.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
/**
* \name Read endian functions
#endif
#include "close_code.h"
-#endif /* _SDL_rwops_h */
+#endif /* SDL_rwops_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Defines keyboard scancodes.
*/
-#ifndef _SDL_scancode_h
-#define _SDL_scancode_h
+#ifndef SDL_scancode_h_
+#define SDL_scancode_h_
#include "SDL_stdinc.h"
* SDL_Event structure.
*
* The values in this enumeration are based on the USB usage page standard:
- * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
+ * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
*/
typedef enum
{
/* @} *//* Walther keys */
+ /**
+ * \name Usage page 0x0C (additional media keys)
+ *
+ * These values are mapped from usage page 0x0C (USB consumer page).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_AUDIOREWIND = 285,
+ SDL_SCANCODE_AUDIOFASTFORWARD = 286,
+
+ /* @} *//* Usage page 0x0C (additional media keys) */
+
/* Add any other keys here. */
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
for array bounds */
} SDL_Scancode;
-#endif /* _SDL_scancode_h */
+#endif /* SDL_scancode_h_ */
/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2019 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_sensor.h
+ *
+ * Include file for SDL sensor event handling
+ *
+ */
+
+#ifndef SDL_sensor_h_
+#define SDL_sensor_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
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/**
+ * \brief SDL_sensor.h
+ *
+ * In order to use these functions, SDL_Init() must have been called
+ * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system
+ * for sensors, and load appropriate drivers.
+ */
+
+struct _SDL_Sensor;
+typedef struct _SDL_Sensor SDL_Sensor;
+
+/**
+ * This is a unique ID for a sensor for the time it is connected to the system,
+ * and is never reused for the lifetime of the application.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
+typedef Sint32 SDL_SensorID;
+
+/* The different sensors defined by SDL
+ *
+ * Additional sensors may be available, using platform dependent semantics.
+ *
+ * Hare are the additional Android sensors:
+ * https://developer.android.com/reference/android/hardware/SensorEvent.html#values
+ */
+typedef enum
+{
+ SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */
+ SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */
+ SDL_SENSOR_ACCEL, /**< Accelerometer */
+ SDL_SENSOR_GYRO /**< Gyroscope */
+} SDL_SensorType;
+
+/**
+ * Accelerometer sensor
+ *
+ * The accelerometer returns the current acceleration in SI meters per
+ * second squared. This includes gravity, so a device at rest will have
+ * an acceleration of SDL_STANDARD_GRAVITY straight down.
+ *
+ * values[0]: Acceleration on the x axis
+ * values[1]: Acceleration on the y axis
+ * values[2]: Acceleration on the z axis
+ *
+ * For phones held in portrait mode, the axes are defined as follows:
+ * -X ... +X : left ... right
+ * -Y ... +Y : bottom ... top
+ * -Z ... +Z : farther ... closer
+ *
+ * The axis data is not changed when the phone is rotated.
+ *
+ * \sa SDL_GetDisplayOrientation()
+ */
+#define SDL_STANDARD_GRAVITY 9.80665f
+
+/**
+ * Gyroscope sensor
+ *
+ * The gyroscope returns the current rate of rotation in radians per second.
+ * The rotation is positive in the counter-clockwise direction. That is,
+ * an observer looking from a positive location on one of the axes would
+ * see positive rotation on that axis when it appeared to be rotating
+ * counter-clockwise.
+ *
+ * values[0]: Angular speed around the x axis
+ * values[1]: Angular speed around the y axis
+ * values[2]: Angular speed around the z axis
+ *
+ * For phones held in portrait mode, the axes are defined as follows:
+ * -X ... +X : left ... right
+ * -Y ... +Y : bottom ... top
+ * -Z ... +Z : farther ... closer
+ *
+ * The axis data is not changed when the phone is rotated.
+ *
+ * \sa SDL_GetDisplayOrientation()
+ */
+
+/* Function prototypes */
+
+/**
+ * \brief Count the number of sensors attached to the system right now
+ */
+extern DECLSPEC int SDLCALL SDL_NumSensors(void);
+
+/**
+ * \brief Get the implementation dependent name of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor name, or NULL if device_index is out of range.
+ */
+extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
+
+/**
+ * \brief Get the type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range.
+ */
+extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index);
+
+/**
+ * \brief Get the platform dependent type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor platform dependent type, or -1 if device_index is out of range.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index);
+
+/**
+ * \brief Get the instance ID of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor instance ID, or -1 if device_index is out of range.
+ */
+extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index);
+
+/**
+ * \brief Open a sensor for use.
+ *
+ * The index passed as an argument refers to the N'th sensor on the system.
+ *
+ * \return A sensor identifier, or NULL if an error occurred.
+ */
+extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
+
+/**
+ * Return the SDL_Sensor associated with an instance id.
+ */
+extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id);
+
+/**
+ * \brief Get the implementation dependent name of a sensor.
+ *
+ * \return The sensor name, or NULL if the sensor is NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
+
+/**
+ * \brief Get the type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL.
+ */
+extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
+
+/**
+ * \brief Get the platform dependent type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor platform dependent type, or -1 if the sensor is NULL.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
+
+/**
+ * \brief Get the instance ID of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor instance ID, or -1 if the sensor is NULL.
+ */
+extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor);
+
+/**
+ * Get the current state of an opened sensor.
+ *
+ * The number of values and interpretation of the data is sensor dependent.
+ *
+ * \param sensor The sensor to query
+ * \param data A pointer filled with the current sensor state
+ * \param num_values The number of values to write to data
+ *
+ * \return 0 or -1 if an error occurred.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values);
+
+/**
+ * Close a sensor previously opened with SDL_SensorOpen()
+ */
+extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor);
+
+/**
+ * Update the current state of the open sensors.
+ *
+ * This is called automatically by the event loop if sensor events are enabled.
+ *
+ * This needs to be called from the thread that initialized the sensor subsystem.
+ */
+extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* SDL_sensor_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_shape_h
-#define _SDL_shape_h
+#ifndef SDL_shape_h_
+#define SDL_shape_h_
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
* \param window The window to query for being shaped.
*
* \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
+ *
* \sa SDL_CreateShapedWindow
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
/** \brief A union containing parameters for shaped windows. */
typedef union {
- /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
+ /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */
Uint8 binarizationCutoff;
SDL_Color colorKey;
} SDL_WindowShapeParams;
* \param shape A surface encoding the desired shape for the window.
* \param shape_mode The parameters to set for the shaped window.
*
- * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
- * if the SDL_Window* given does not reference a valid shaped window.
+ * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
+ * if the SDL_Window given does not reference a valid shaped window.
*
* \sa SDL_WindowShapeMode
* \sa SDL_GetShapedWindowMode.
*
* \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
* data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
- * the SDL_Window* given is a shapeable window currently lacking a shape.
+ * the SDL_Window given is a shapeable window currently lacking a shape.
*
* \sa SDL_WindowShapeMode
* \sa SDL_SetWindowShape
#endif
#include "close_code.h"
-#endif /* _SDL_shape_h */
+#endif /* SDL_shape_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* This is a general header that includes C language support.
*/
-#ifndef _SDL_stdinc_h
-#define _SDL_stdinc_h
+#ifndef SDL_stdinc_h_
+#define SDL_stdinc_h_
#include "SDL_config.h"
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#elif defined(HAVE_STDINT_H)
#ifdef HAVE_FLOAT_H
# include <float.h>
#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
/**
* The number of elements in an array.
*/
/* @{ */
+#ifdef __CC_ARM
+/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
+#define SDL_FALSE 0
+#define SDL_TRUE 1
+typedef int SDL_bool;
+#else
typedef enum
{
SDL_FALSE = 0,
SDL_TRUE = 1
} SDL_bool;
+#endif
/**
* \brief A signed 8-bit integer type.
*/
+#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
+#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
typedef int8_t Sint8;
/**
* \brief An unsigned 8-bit integer type.
*/
+#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
+#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
typedef uint8_t Uint8;
/**
* \brief A signed 16-bit integer type.
*/
+#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
+#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
typedef int16_t Sint16;
/**
* \brief An unsigned 16-bit integer type.
*/
+#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
+#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
typedef uint16_t Uint16;
/**
* \brief A signed 32-bit integer type.
*/
+#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
+#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
typedef int32_t Sint32;
/**
* \brief An unsigned 32-bit integer type.
*/
+#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
+#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
typedef uint32_t Uint32;
/**
* \brief A signed 64-bit integer type.
*/
+#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
+#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
typedef int64_t Sint64;
/**
* \brief An unsigned 64-bit integer type.
*/
+#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
+#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
typedef uint64_t Uint64;
/* @} *//* Basic data types */
#endif /* SDL_DISABLE_ANALYZE_MACROS */
#define SDL_COMPILE_TIME_ASSERT(name, x) \
- typedef int SDL_dummy_ ## name[(x) * 2 - 1]
+ typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
extern "C" {
#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)
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
extern DECLSPEC void SDLCALL SDL_free(void *mem);
+typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
+typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
+typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
+typedef void (SDLCALL *SDL_free_func)(void *mem);
+
+/**
+ * \brief Get the current set of SDL memory functions
+ */
+extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
+ SDL_calloc_func *calloc_func,
+ SDL_realloc_func *realloc_func,
+ SDL_free_func *free_func);
+
+/**
+ * \brief Replace SDL's memory allocation functions with a custom set
+ *
+ * \note If you are replacing SDL's memory functions, you should call
+ * SDL_GetNumAllocations() and be very careful if it returns non-zero.
+ * That means that your free function will be called with memory
+ * allocated by the previous memory allocation functions.
+ */
+extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
+ SDL_calloc_func calloc_func,
+ SDL_realloc_func realloc_func,
+ SDL_free_func free_func);
+
+/**
+ * \brief Get the number of outstanding (unfreed) allocations
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
+
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
return;
switch (dwords % 4)
{
- case 0: do { *_p++ = _val;
- case 3: *_p++ = _val;
- case 2: *_p++ = _val;
- case 1: *_p++ = _val;
+ case 0: do { *_p++ = _val; /* fallthrough */
+ case 3: *_p++ = _val; /* fallthrough */
+ case 2: *_p++ = _val; /* fallthrough */
+ case 1: *_p++ = _val; /* fallthrough */
} while ( --_n );
}
#endif
}
-
extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
+extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
+extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
#ifndef HAVE_M_PI
#ifndef M_PI
-#define M_PI 3.14159265358979323846264338327950288 /* pi */
+#define M_PI 3.14159265358979323846264338327950288 /**< pi */
#endif
#endif
extern DECLSPEC double SDLCALL SDL_acos(double x);
+extern DECLSPEC float SDLCALL SDL_acosf(float x);
extern DECLSPEC double SDLCALL SDL_asin(double x);
+extern DECLSPEC float SDLCALL SDL_asinf(float x);
extern DECLSPEC double SDLCALL SDL_atan(double x);
+extern DECLSPEC float SDLCALL SDL_atanf(float x);
extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
+extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
extern DECLSPEC double SDLCALL SDL_ceil(double x);
+extern DECLSPEC float SDLCALL SDL_ceilf(float x);
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
+extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
extern DECLSPEC double SDLCALL SDL_cos(double x);
extern DECLSPEC float SDLCALL SDL_cosf(float x);
+extern DECLSPEC double SDLCALL SDL_exp(double x);
+extern DECLSPEC float SDLCALL SDL_expf(float x);
extern DECLSPEC double SDLCALL SDL_fabs(double x);
+extern DECLSPEC float SDLCALL SDL_fabsf(float x);
extern DECLSPEC double SDLCALL SDL_floor(double x);
+extern DECLSPEC float SDLCALL SDL_floorf(float x);
+extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
+extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
extern DECLSPEC double SDLCALL SDL_log(double x);
+extern DECLSPEC float SDLCALL SDL_logf(float x);
+extern DECLSPEC double SDLCALL SDL_log10(double x);
+extern DECLSPEC float SDLCALL SDL_log10f(float x);
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
+extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
+extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
extern DECLSPEC double SDLCALL SDL_sin(double x);
extern DECLSPEC float SDLCALL SDL_sinf(float x);
extern DECLSPEC double SDLCALL SDL_sqrt(double x);
#endif
#include "close_code.h"
-#endif /* _SDL_stdinc_h */
+#endif /* SDL_stdinc_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file for ::SDL_Surface definition and management functions.
*/
-#ifndef _SDL_surface_h
-#define _SDL_surface_h
+#ifndef SDL_surface_h_
+#define SDL_surface_h_
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
+#define SDL_SIMD_ALIGNED 0x00000008 /**< Surface uses aligned memory */
/* @} *//* Surface flags */
/**
/**
* \brief The type of function used for surface blitting functions.
*/
-typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
- struct SDL_Surface * dst, SDL_Rect * dstrect);
+typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
+ struct SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief The formula used for converting between YUV and RGB
+ */
+typedef enum
+{
+ SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */
+ SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */
+ SDL_YUV_CONVERSION_BT709, /**< BT.709 */
+ SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */
+} SDL_YUV_CONVERSION_MODE;
/**
* Allocate and free an RGB surface.
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
(Uint32 flags, int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
+
+/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
(Uint32 flags, int width, int height, int depth, Uint32 format);
+
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
int width,
int height,
extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
int flag, Uint32 key);
+/**
+ * \brief Returns whether the surface has a color key
+ *
+ * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface);
+
/**
* \brief Gets the color key (transparent pixel) in a blittable surface.
*
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
SDL_Rect * rect);
+/*
+ * Creates a new surface identical to the existing surface
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
+
/**
* 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
(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect);
+/**
+ * \brief Set the YUV conversion mode
+ */
+extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
+
+/**
+ * \brief Get the YUV conversion mode
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
+
+/**
+ * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
#endif
#include "close_code.h"
-#endif /* _SDL_surface_h */
+#endif /* SDL_surface_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for platform specific SDL API functions
*/
-#ifndef _SDL_system_h
-#define _SDL_system_h
+#ifndef SDL_system_h_
+#define SDL_system_h_
#include "SDL_stdinc.h"
#include "SDL_keyboard.h"
#endif /* __WIN32__ */
+/* Platform specific functions for Linux */
+#ifdef __LINUX__
+
+/**
+ \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available.
+
+ \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
+
+#endif /* __LINUX__ */
+
/* Platform specific functions for iOS */
#if defined(__IPHONEOS__) && __IPHONEOS__
This returns JNIEnv*, but the prototype is void* so we don't need jni.h
*/
-extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
+extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
/**
\brief Get the SDL Activity object for the application
It is the caller's responsibility to properly release it
(using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
*/
-extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
+extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
+
+/**
+ \brief Return true if the application is running on Android TV
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
+
+/**
+ \brief Return true if the application is running on a Chromebook
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
+
+/**
+ \brief Return true is the application is running on a Samsung DeX docking station
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
+
+/**
+ \brief Trigger the Android system back button behavior.
+ */
+extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
/**
See the official Android developer guide for more information:
This path is unique to your application and cannot be written to
by other applications.
*/
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
/**
\brief Get the current state of external storage, a bitmask of these values:
If external storage is currently unavailable, this will return 0.
*/
-extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
+extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
/**
\brief Get the path used for external storage for this application.
This path is unique to your application, but is public and can be
written to by other applications.
*/
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
#endif /* __ANDROID__ */
} SDL_WinRT_Path;
+/**
+ * \brief WinRT Device Family
+ */
+typedef enum
+{
+ /** \brief Unknown family */
+ SDL_WINRT_DEVICEFAMILY_UNKNOWN,
+
+ /** \brief Desktop family*/
+ SDL_WINRT_DEVICEFAMILY_DESKTOP,
+
+ /** \brief Mobile family (for example smartphone) */
+ SDL_WINRT_DEVICEFAMILY_MOBILE,
+
+ /** \brief XBox family */
+ SDL_WINRT_DEVICEFAMILY_XBOX,
+} SDL_WinRT_DeviceFamily;
+
+
/**
* \brief Retrieves a WinRT defined path on the local file system
*
*/
extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
+/**
+ * \brief Detects the device family of WinRT plattform on runtime
+ *
+ * \return Device family
+ */
+extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
+
#endif /* __WINRT__ */
+/**
+ \brief Return true if the current device is a tablet.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_system_h */
+#endif /* SDL_system_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL custom system window manager hooks.
*/
-#ifndef _SDL_syswm_h
-#define _SDL_syswm_h
+#ifndef SDL_syswm_h_
+#define SDL_syswm_h_
#include "SDL_stdinc.h"
#include "SDL_error.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_syswm.h
+ * \brief 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;
-#else
+
+#if !defined(SDL_PROTOTYPES_ONLY)
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
#ifndef WIN32_LEAN_AND_MEAN
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
#include "SDL_egl.h"
#endif
+#endif /* SDL_PROTOTYPES_ONLY */
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(SDL_PROTOTYPES_ONLY)
/**
* These are the various supported windowing subsystems
*/
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND,
- SDL_SYSWM_MIR,
+ SDL_SYSWM_MIR, /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
SDL_SYSWM_WINRT,
SDL_SYSWM_ANDROID,
- SDL_SYSWM_VIVANTE
+ SDL_SYSWM_VIVANTE,
+ SDL_SYSWM_OS2
} SDL_SYSWM_TYPE;
/**
{
HWND window; /**< The window handle */
HDC hdc; /**< The window device context */
+ HINSTANCE hinstance; /**< The instance handle */
} win;
#endif
#if defined(SDL_VIDEO_DRIVER_WINRT)
struct
{
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
- NSWindow __unsafe_unretained *window; /* The Cocoa window */
+ NSWindow __unsafe_unretained *window; /**< The Cocoa window */
#else
- NSWindow *window; /* The Cocoa window */
+ NSWindow *window; /**< The Cocoa window */
#endif
} cocoa;
#endif
struct
{
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
- UIWindow __unsafe_unretained *window; /* The UIKit window */
+ UIWindow __unsafe_unretained *window; /**< The UIKit window */
#else
- UIWindow *window; /* The UIKit window */
+ UIWindow *window; /**< The UIKit window */
#endif
- GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
- GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
- GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
+ GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
+ GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
+ GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
} uikit;
#endif
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
} wl;
#endif
-#if defined(SDL_VIDEO_DRIVER_MIR)
+#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
struct
{
- struct MirConnection *connection; /**< Mir display server connection */
- struct MirSurface *surface; /**< Mir surface */
+ void *connection; /**< Mir display server connection */
+ void *surface; /**< Mir surface */
} mir;
#endif
} vivante;
#endif
- /* Can't have an empty union */
- int dummy;
+ /* Make sure this union is always 64 bytes (8 64-bit pointers). */
+ /* Be careful not to overflow this if you add a new target! */
+ Uint8 dummy[64];
} info;
};
#endif
#include "close_code.h"
-#endif /* _SDL_syswm_h */
+#endif /* SDL_syswm_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* This code is a part of the SDL2_test library, not the main SDL library.
*/
-#ifndef _SDL_test_h
-#define _SDL_test_h
+#ifndef SDL_test_h_
+#define SDL_test_h_
#include "SDL.h"
+#include "SDL_test_assert.h"
#include "SDL_test_common.h"
+#include "SDL_test_compare.h"
+#include "SDL_test_crc32.h"
#include "SDL_test_font.h"
-#include "SDL_test_random.h"
#include "SDL_test_fuzzer.h"
-#include "SDL_test_crc32.h"
-#include "SDL_test_md5.h"
-#include "SDL_test_log.h"
-#include "SDL_test_assert.h"
#include "SDL_test_harness.h"
#include "SDL_test_images.h"
-#include "SDL_test_compare.h"
+#include "SDL_test_log.h"
+#include "SDL_test_md5.h"
+#include "SDL_test_memory.h"
+#include "SDL_test_random.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_test_h */
+#endif /* SDL_test_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*
*/
-#ifndef _SDL_test_assert_h
-#define _SDL_test_assert_h
+#ifndef SDL_test_assert_h_
+#define SDL_test_assert_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
/**
* \brief Resets the assert summary counters to zero.
*/
-void SDLTest_ResetAssertSummary();
+void SDLTest_ResetAssertSummary(void);
/**
* \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
*/
-void SDLTest_LogAssertSummary();
+void SDLTest_LogAssertSummary(void);
/**
*
* \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
*/
-int SDLTest_AssertSummaryToTestResult();
+int SDLTest_AssertSummaryToTestResult(void);
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_test_assert_h */
+#endif /* SDL_test_assert_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/* Ported from original test\common.h file. */
-#ifndef _SDL_test_common_h
-#define _SDL_test_common_h
+#ifndef SDL_test_common_h_
+#define SDL_test_common_h_
#include "SDL.h"
*/
int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
+
/**
- * \brief Returns common usage information
+ * \brief Logs command line usage info.
*
- * \param state The common state describing the test window to create.
+ * This logs the appropriate command line options for the subsystems in use
+ * plus other common options, and then any application-specific options.
+ * This uses the SDL_Log() function and splits up output to be friendly to
+ * 80-character-wide terminals.
*
- * \returns String with usage information
+ * \param state The common state describing the test window for the app.
+ * \param argv0 argv[0], as passed to main/SDL_main.
+ * \param options an array of strings for application specific options. The last element of the array should be NULL.
*/
-const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
+void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options);
/**
* \brief Open test window.
*/
SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
+/**
+ * \brief Easy argument handling when test app doesn't need any custom args.
+ *
+ * \param state The common state describing the test window to create.
+ * \param argc argc, as supplied to SDL_main
+ * \param argv argv, as supplied to SDL_main
+ *
+ * \returns False if app should quit, true otherwise.
+ */
+SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc, char **argv);
+
/**
* \brief Common event handler for test windows.
*
#endif
#include "close_code.h"
-#endif /* _SDL_test_common_h */
+#endif /* SDL_test_common_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_test_compare_h
-#define _SDL_test_compare_h
+#ifndef SDL_test_compare_h_
+#define SDL_test_compare_h_
#include "SDL.h"
#endif
#include "close_code.h"
-#endif /* _SDL_test_compare_h */
+#endif /* SDL_test_compare_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_test_crc32_h
-#define _SDL_test_crc32_h
+#ifndef SDL_test_crc32_h_
+#define SDL_test_crc32_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
* \returns 0 for OK, -1 on error
*
*/
-int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
+int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
/* Same routine broken down into three steps */
int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
#endif
#include "close_code.h"
-#endif /* _SDL_test_crc32_h */
+#endif /* SDL_test_crc32_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* This code is a part of the SDL2_test library, not the main SDL library.
*/
-#ifndef _SDL_test_font_h
-#define _SDL_test_font_h
+#ifndef SDL_test_font_h_
+#define SDL_test_font_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
*
* \returns Returns 0 on success, -1 on failure.
*/
-int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c );
+int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c);
/**
* \brief Draw a string in the currently set font.
*
* \returns Returns 0 on success, -1 on failure.
*/
-int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s );
+int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
+/**
+ * \brief Cleanup textures used by font drawing functions.
+ */
+void SDLTest_CleanupTextDrawing(void);
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_test_font_h */
+#endif /* SDL_test_font_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_test_fuzzer_h
-#define _SDL_test_fuzzer_h
+#ifndef SDL_test_fuzzer_h_
+#define SDL_test_fuzzer_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
*
* \returns Generated integer
*/
-Uint8 SDLTest_RandomUint8();
+Uint8 SDLTest_RandomUint8(void);
/**
* Returns a random Sint8
*
* \returns Generated signed integer
*/
-Sint8 SDLTest_RandomSint8();
+Sint8 SDLTest_RandomSint8(void);
/**
*
* \returns Generated integer
*/
-Uint16 SDLTest_RandomUint16();
+Uint16 SDLTest_RandomUint16(void);
/**
* Returns a random Sint16
*
* \returns Generated signed integer
*/
-Sint16 SDLTest_RandomSint16();
+Sint16 SDLTest_RandomSint16(void);
/**
*
* \returns Generated integer
*/
-Sint32 SDLTest_RandomSint32();
+Sint32 SDLTest_RandomSint32(void);
/**
*
* \returns Generated integer
*/
-Uint32 SDLTest_RandomUint32();
+Uint32 SDLTest_RandomUint32(void);
/**
* Returns random Uint64.
*
* \returns Generated integer
*/
-Uint64 SDLTest_RandomUint64();
+Uint64 SDLTest_RandomUint64(void);
/**
*
* \returns Generated signed integer
*/
-Sint64 SDLTest_RandomSint64();
+Sint64 SDLTest_RandomSint64(void);
/**
* \returns random float in range [0.0 - 1.0[
*/
-float SDLTest_RandomUnitFloat();
+float SDLTest_RandomUnitFloat(void);
/**
* \returns random double in range [0.0 - 1.0[
*/
-double SDLTest_RandomUnitDouble();
+double SDLTest_RandomUnitDouble(void);
/**
* \returns random float.
*
*/
-float SDLTest_RandomFloat();
+float SDLTest_RandomFloat(void);
/**
* \returns random double.
*
*/
-double SDLTest_RandomDouble();
+double SDLTest_RandomDouble(void);
/**
* Returns a random boundary value for Uint8 within the given boundaries.
*
* \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
*/
-char * SDLTest_RandomAsciiString();
+char * SDLTest_RandomAsciiString(void);
/**
/**
* Returns the invocation count for the fuzzer since last ...FuzzerInit.
*/
-int SDLTest_GetFuzzerInvocationCount();
+int SDLTest_GetFuzzerInvocationCount(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
#endif
#include "close_code.h"
-#endif /* _SDL_test_fuzzer_h */
+#endif /* SDL_test_fuzzer_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
Based on original GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
*/
-#ifndef _SDL_test_harness_h
-#define _SDL_test_harness_h
+#ifndef SDL_test_h_arness_h
+#define SDL_test_h_arness_h
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
} SDLTest_TestSuiteReference;
+/**
+ * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).
+ *
+ * Note: The returned string needs to be deallocated by the caller.
+ *
+ * \param length The length of the seed string to generate
+ *
+ * \returns The generated seed string
+ */
+char *SDLTest_GenerateRunSeed(const int length);
+
/**
* \brief Execute a test suite using the given run seed and execution key.
*
#endif
#include "close_code.h"
-#endif /* _SDL_test_harness_h */
+#endif /* SDL_test_h_arness_h */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_test_images_h
-#define _SDL_test_images_h
+#ifndef SDL_test_images_h_
+#define SDL_test_images_h_
#include "SDL.h"
} SDLTest_SurfaceImage_t;
/* Test images */
-SDL_Surface *SDLTest_ImageBlit();
-SDL_Surface *SDLTest_ImageBlitColor();
-SDL_Surface *SDLTest_ImageBlitAlpha();
-SDL_Surface *SDLTest_ImageBlitBlendAdd();
-SDL_Surface *SDLTest_ImageBlitBlend();
-SDL_Surface *SDLTest_ImageBlitBlendMod();
-SDL_Surface *SDLTest_ImageBlitBlendNone();
-SDL_Surface *SDLTest_ImageBlitBlendAll();
-SDL_Surface *SDLTest_ImageFace();
-SDL_Surface *SDLTest_ImagePrimitives();
-SDL_Surface *SDLTest_ImagePrimitivesBlend();
+SDL_Surface *SDLTest_ImageBlit(void);
+SDL_Surface *SDLTest_ImageBlitColor(void);
+SDL_Surface *SDLTest_ImageBlitAlpha(void);
+SDL_Surface *SDLTest_ImageBlitBlendAdd(void);
+SDL_Surface *SDLTest_ImageBlitBlend(void);
+SDL_Surface *SDLTest_ImageBlitBlendMod(void);
+SDL_Surface *SDLTest_ImageBlitBlendNone(void);
+SDL_Surface *SDLTest_ImageBlitBlendAll(void);
+SDL_Surface *SDLTest_ImageFace(void);
+SDL_Surface *SDLTest_ImagePrimitives(void);
+SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
#endif
#include "close_code.h"
-#endif /* _SDL_test_images_h */
+#endif /* SDL_test_images_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*
*/
-#ifndef _SDL_test_log_h
-#define _SDL_test_log_h
+#ifndef SDL_test_log_h_
+#define SDL_test_log_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_test_log_h */
+#endif /* SDL_test_log_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
***********************************************************************
*/
-#ifndef _SDL_test_md5_h
-#define _SDL_test_md5_h
+#ifndef SDL_test_md5_h_
+#define SDL_test_md5_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_test_md5_h */
+#endif /* SDL_test_md5_h_ */
/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2019 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_test_memory.h
+ *
+ * Include file for SDL test framework.
+ *
+ * This code is a part of the SDL2_test library, not the main SDL library.
+ */
+
+#ifndef SDL_test_memory_h_
+#define SDL_test_memory_h_
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * \brief Start tracking SDL memory allocations
+ *
+ * \note This should be called before any other SDL functions for complete tracking coverage
+ */
+int SDLTest_TrackAllocations(void);
+
+/**
+ * \brief Print a log of any outstanding allocations
+ *
+ * \note This can be called after SDL_Quit()
+ */
+void SDLTest_LogAllocations(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_test_memory_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_test_random_h
-#define _SDL_test_random_h
+#ifndef SDL_test_random_h_
+#define SDL_test_random_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_test_random_h */
+#endif /* SDL_test_random_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_thread_h
-#define _SDL_thread_h
+#ifndef SDL_thread_h_
+#define SDL_thread_h_
/**
* \file SDL_thread.h
/**
* The SDL thread priority.
*
- * \note On many systems you require special privileges to set high priority.
+ * \note On many systems you require special privileges to set high or time critical priority.
*/
typedef enum {
SDL_THREAD_PRIORITY_LOW,
SDL_THREAD_PRIORITY_NORMAL,
- SDL_THREAD_PRIORITY_HIGH
+ SDL_THREAD_PRIORITY_HIGH,
+ SDL_THREAD_PRIORITY_TIME_CRITICAL
} SDL_ThreadPriority;
/**
*
* We compile SDL into a DLL. 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
+ * API. There is a problem with this, that only the RTL of the SDL2.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
+ * start a new thread. This way, if it's the SDL2.DLL which uses this API,
+ * then the RTL of SDL2.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:
* library!
*/
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#include <process.h> /* This has _beginthread() and _endthread() defined! */
-
-typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *
- func) (void
- *),
- void *arg, unsigned,
- unsigned *threadID);
+#include <process.h> /* _beginthreadex() and _endthreadex() */
+
+typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
+ (void *, unsigned, unsigned (__stdcall *func)(void *),
+ void * /*arg*/, unsigned, unsigned * /* threadID */);
typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
/**
pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
+ const char *name, const size_t stacksize, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+
+
/**
* Create a thread.
*/
#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
#undef SDL_CreateThread
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#undef SDL_CreateThreadWithStackSize
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
#else
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#endif
+
+#elif defined(__OS2__)
+/*
+ * just like the windows case above: We compile SDL2
+ * into a dll with Watcom's runtime statically linked.
+ */
+#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#ifndef __EMX__
+#include <process.h>
+#else
+#include <stdlib.h>
+#endif
+typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
+typedef void (*pfnSDL_CurrentEndThread)(void);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
+#undef SDL_CreateThread
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#undef SDL_CreateThreadWithStackSize
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#else
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
#endif
#else
+/**
+ * Create a thread with a default stack size.
+ *
+ * This is equivalent to calling:
+ * SDL_CreateThreadWithStackSize(fn, name, 0, data);
+ */
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
+
/**
* Create a thread.
*
* If a system imposes requirements, SDL will try to munge the string for
* it (truncate, etc), but the original string contents will be available
* from SDL_GetThreadName().
+ *
+ * The size (in bytes) of the new stack can be specified. Zero means "use
+ * the system default" which might be wildly different between platforms
+ * (x86 Linux generally defaults to eight megabytes, an embedded device
+ * might be a few kilobytes instead).
+ *
+ * In SDL 2.1, stacksize will be folded into the original SDL_CreateThread
+ * function.
*/
extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
+SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data);
#endif
* \sa SDL_TLSCreate()
* \sa SDL_TLSGet()
*/
-extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
/* Ends C function definitions when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_thread_h */
+#endif /* SDL_thread_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_timer_h
-#define _SDL_timer_h
+#ifndef SDL_timer_h_
+#define SDL_timer_h_
/**
* \file SDL_timer.h
#endif
#include "close_code.h"
-#endif /* _SDL_timer_h */
+#endif /* SDL_timer_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL touch event handling.
*/
-#ifndef _SDL_touch_h
-#define _SDL_touch_h
+#ifndef SDL_touch_h_
+#define SDL_touch_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
typedef Sint64 SDL_TouchID;
typedef Sint64 SDL_FingerID;
+typedef enum
+{
+ SDL_TOUCH_DEVICE_INVALID = -1,
+ SDL_TOUCH_DEVICE_DIRECT, /* touch screen with window-relative coordinates */
+ SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */
+ SDL_TOUCH_DEVICE_INDIRECT_RELATIVE /* trackpad with screen cursor-relative coordinates */
+} SDL_TouchDeviceType;
+
typedef struct SDL_Finger
{
SDL_FingerID id;
/* Used as the device ID for mouse events simulated with touch input */
#define SDL_TOUCH_MOUSEID ((Uint32)-1)
+/* Used as the SDL_TouchID for touch events simulated with mouse input */
+#define SDL_MOUSE_TOUCHID ((Sint64)-1)
+
/* Function prototypes */
*/
extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
+/**
+ * \brief Get the type of the given touch device.
+ */
+extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
+
/**
* \brief Get the number of active fingers for a given touch device.
*/
#endif
#include "close_code.h"
-#endif /* _SDL_touch_h */
+#endif /* SDL_touch_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* This header defines the current SDL version.
*/
-#ifndef _SDL_version_h
-#define _SDL_version_h
+#ifndef SDL_version_h_
+#define SDL_version_h_
#include "SDL_stdinc.h"
*/
#define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 0
-#define SDL_PATCHLEVEL 5
+#define SDL_PATCHLEVEL 10
/**
* \brief Macro to determine SDL version program was compiled against.
#endif
#include "close_code.h"
-#endif /* _SDL_version_h */
+#endif /* SDL_version_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file for SDL video functions.
*/
-#ifndef _SDL_video_h
-#define _SDL_video_h
+#ifndef SDL_video_h_
+#define SDL_video_h_
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
- SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */
+ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported.
+ On macOS NSHighResolutionCapable must be set true in the
+ application's Info.plist for this to have any effect. */
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
- SDL_WINDOW_POPUP_MENU = 0x00080000 /**< window should be treated as a popup menu */
+ SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
+ SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
} SDL_WindowFlags;
/**
SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
} SDL_WindowEventID;
+/**
+ * \brief Event subtype for display events
+ */
+typedef enum
+{
+ SDL_DISPLAYEVENT_NONE, /**< Never used */
+ SDL_DISPLAYEVENT_ORIENTATION /**< Display orientation has changed to data1 */
+} SDL_DisplayEventID;
+
+typedef enum
+{
+ SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */
+ SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */
+ SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */
+ SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */
+ SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */
+} SDL_DisplayOrientation;
+
/**
* \brief An opaque handle to an OpenGL context.
*/
SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR
+ SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
+ SDL_GL_CONTEXT_RESET_NOTIFICATION,
+ SDL_GL_CONTEXT_NO_ERROR
} SDL_GLattr;
typedef enum
{
SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
- SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
+ SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
} SDL_GLprofile;
typedef enum
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
} SDL_GLcontextReleaseFlag;
+typedef enum
+{
+ SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
+ SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
+} SDL_GLContextResetNotification;
/* Function prototypes */
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
-/**
- * \brief Get the dots/pixels-per-inch for a display
- *
- * \note Diagonal, horizontal and vertical DPI can all be optionally
- * returned if the parameter is non-NULL.
- *
- * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
- *
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
-
/**
* \brief Get the usable desktop area represented by a display, with the
* primary display located at 0,0
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
+/**
+ * \brief Get the dots/pixels-per-inch for a display
+ *
+ * \note Diagonal, horizontal and vertical DPI can all be optionally
+ * returned if the parameter is non-NULL.
+ *
+ * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
+
+/**
+ * \brief Get the orientation of a display
+ *
+ * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex);
+
/**
* \brief Returns the number of available display modes.
*
* ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
* ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
* ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
- * ::SDL_WINDOW_ALLOW_HIGHDPI.
+ * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
*
* \return The created window, or NULL if window creation failed.
*
* If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
* in pixels may differ from its size in screen coordinates on platforms with
* high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
- * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize()
- * or SDL_GetRendererOutputSize() to query the drawable size in pixels.
+ * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(),
+ * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the
+ * drawable size in pixels.
+ *
+ * If the window is created with any of the SDL_WINDOW_OPENGL or
+ * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
+ * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
+ * corresponding UnloadLibrary function is called by SDL_DestroyWindow().
+ *
+ * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
+ * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
+ *
+ * \note On non-Apple devices, SDL requires you to either not link to the
+ * Vulkan loader or link to a dynamic library version. This limitation
+ * may be removed in a future version of SDL.
*
* \sa SDL_DestroyWindow()
+ * \sa SDL_GL_LoadLibrary()
+ * \sa SDL_Vulkan_LoadLibrary()
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
int x, int y, int w,
* \param w The width of the window, in screen coordinates. Must be >0.
* \param h The height of the window, in screen coordinates. Must be >0.
*
- * \note You can't change the size of a fullscreen window, it automatically
- * matches the size of the display mode.
+ * \note Fullscreen windows automatically match the size of the display mode,
+ * and you should use SDL_SetWindowDisplayMode() to change their size.
*
* The window size in screen coordinates may differ from the size in pixels, if
* the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
* SDL_GetRendererOutputSize() to get the real client area size in pixels.
*
* \sa SDL_GetWindowSize()
+ * \sa SDL_SetWindowDisplayMode()
*/
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
int h);
* \param window The window which will be made transparent or opaque
* \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
* clamped internally between 0.0f and 1.0f.
- *
+ *
* \return 0 on success, or -1 if setting the opacity isn't supported.
*
* \sa SDL_GetWindowOpacity()
*
* \param modal_window The window that should be modal
* \param parent_window The parent window
- *
+ *
* \return 0 on success, or -1 otherwise.
*/
extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
* obscured by other windows.
*
* \param window The window that should get the input focus
- *
+ *
* \return 0 on success, or -1 otherwise.
* \sa SDL_RaiseWindow()
*/
/**
* \brief Set an OpenGL window attribute before window creation.
+ *
+ * \return 0 on success, or -1 if the attribute could not be set.
*/
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
/**
* \brief Get the actual value for an attribute from the current context.
+ *
+ * \return 0 on success, or -1 if the attribute could not be retrieved.
+ * The integer at \c value will be modified in either case.
*/
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
#endif
#include "close_code.h"
-#endif /* _SDL_video_h */
+#endif /* SDL_video_h_ */
/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 2017, Mark Callow
+
+ 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_vulkan.h
+ *
+ * Header file for functions to creating Vulkan surfaces on SDL windows.
+ */
+
+#ifndef SDL_vulkan_h_
+#define SDL_vulkan_h_
+
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Avoid including vulkan.h, don't define VkInstance if it's already included */
+#ifdef VULKAN_H_
+#define NO_SDL_VULKAN_TYPEDEFS
+#endif
+#ifndef NO_SDL_VULKAN_TYPEDEFS
+#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
+
+#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
+#else
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
+#endif
+
+VK_DEFINE_HANDLE(VkInstance)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
+
+#endif /* !NO_SDL_VULKAN_TYPEDEFS */
+
+typedef VkInstance SDL_vulkanInstance;
+typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
+
+/**
+ * \name Vulkan support functions
+ *
+ * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API
+ * is compatable with Tizen's implementation of Vulkan in SDL.
+ */
+/* @{ */
+
+/**
+ * \brief Dynamically load a Vulkan loader library.
+ *
+ * \param [in] path The platform dependent Vulkan loader library name, or
+ * \c NULL.
+ *
+ * \return \c 0 on success, or \c -1 if the library couldn't be loaded.
+ *
+ * If \a path is NULL SDL will use the value of the environment variable
+ * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan
+ * loader library.
+ *
+ * This should be called after initializing the video driver, but before
+ * creating any Vulkan windows. If no Vulkan loader library is loaded, the
+ * default library will be loaded upon creation of the first Vulkan window.
+ *
+ * \note It is fairly common for Vulkan applications to link with \a libvulkan
+ * instead of explicitly loading it at run time. This will work with
+ * SDL provided the application links to a dynamic library and both it
+ * and SDL use the same search path.
+ *
+ * \note If you specify a non-NULL \c path, an application should retrieve all
+ * of the Vulkan functions it uses from the dynamic library using
+ * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee
+ * \c path points to the same vulkan loader library the application
+ * linked to.
+ *
+ * \note On Apple devices, if \a path is NULL, SDL will attempt to find
+ * the vkGetInstanceProcAddr address within all the mach-o images of
+ * the current process. This is because it is fairly common for Vulkan
+ * applications to link with libvulkan (and historically MoltenVK was
+ * provided as a static library). If it is not found then, on macOS, SDL
+ * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib,
+ * followed by \c libvulkan.dylib, in that order.
+ * On iOS SDL will attempt to load \c libvulkan.dylib only. Applications
+ * using a dynamic framework or .dylib must ensure it is included in its
+ * application bundle.
+ *
+ * \note On non-Apple devices, application linking with a static libvulkan is
+ * not supported. Either do not link to the Vulkan loader or link to a
+ * dynamic library version.
+ *
+ * \note This function will fail if there are no working Vulkan drivers
+ * installed.
+ *
+ * \sa SDL_Vulkan_GetVkGetInstanceProcAddr()
+ * \sa SDL_Vulkan_UnloadLibrary()
+ */
+extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
+
+/**
+ * \brief Get the address of the \c vkGetInstanceProcAddr function.
+ *
+ * \note This should be called after either calling SDL_Vulkan_LoadLibrary
+ * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag.
+ */
+extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
+
+/**
+ * \brief Unload the Vulkan loader library previously loaded by
+ * \c SDL_Vulkan_LoadLibrary().
+ *
+ * \sa SDL_Vulkan_LoadLibrary()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
+
+/**
+ * \brief Get the names of the Vulkan instance extensions needed to create
+ * a surface with \c SDL_Vulkan_CreateSurface().
+ *
+ * \param [in] \c NULL or window Window for which the required Vulkan instance
+ * extensions should be retrieved
+ * \param [in,out] pCount pointer to an \c unsigned related to the number of
+ * required Vulkan instance extensions
+ * \param [out] pNames \c NULL or a pointer to an array to be filled with the
+ * required Vulkan instance extensions
+ *
+ * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ * If \a pNames is \c NULL, then the number of required Vulkan instance
+ * extensions is returned in pCount. Otherwise, \a pCount must point to a
+ * variable set to the number of elements in the \a pNames array, and on
+ * return the variable is overwritten with the number of names actually
+ * written to \a pNames. If \a pCount is less than the number of required
+ * extensions, at most \a pCount structures will be written. If \a pCount
+ * is smaller than the number of required extensions, \c SDL_FALSE will be
+ * returned instead of \c SDL_TRUE, to indicate that not all the required
+ * extensions were returned.
+ *
+ * \note If \c window is not NULL, it will be checked against its creation
+ * flags to ensure that the Vulkan flag is present. This parameter
+ * will be removed in a future major release.
+ *
+ * \note The returned list of extensions will contain \c VK_KHR_surface
+ * and zero or more platform specific extensions
+ *
+ * \note The extension names queried here must be enabled when calling
+ * VkCreateInstance, otherwise surface creation will fail.
+ *
+ * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag
+ * or be \c NULL
+ *
+ * \code
+ * unsigned int count;
+ * // get count of required extensions
+ * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL))
+ * handle_error();
+ *
+ * static const char *const additionalExtensions[] =
+ * {
+ * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension
+ * };
+ * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]);
+ * size_t extensionCount = count + additionalExtensionsCount;
+ * const char **names = malloc(sizeof(const char *) * extensionCount);
+ * if(!names)
+ * handle_error();
+ *
+ * // get names of required extensions
+ * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names))
+ * handle_error();
+ *
+ * // copy additional extensions after required extensions
+ * for(size_t i = 0; i < additionalExtensionsCount; i++)
+ * names[i + count] = additionalExtensions[i];
+ *
+ * VkInstanceCreateInfo instanceCreateInfo = {};
+ * instanceCreateInfo.enabledExtensionCount = extensionCount;
+ * instanceCreateInfo.ppEnabledExtensionNames = names;
+ * // fill in rest of instanceCreateInfo
+ *
+ * VkInstance instance;
+ * // create the Vulkan instance
+ * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance);
+ * free(names);
+ * \endcode
+ *
+ * \sa SDL_Vulkan_CreateSurface()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
+ SDL_Window *window,
+ unsigned int *pCount,
+ const char **pNames);
+
+/**
+ * \brief Create a Vulkan rendering surface for a window.
+ *
+ * \param [in] window SDL_Window to which to attach the rendering surface.
+ * \param [in] instance handle to the Vulkan instance to use.
+ * \param [out] surface pointer to a VkSurfaceKHR handle to receive the
+ * handle of the newly created surface.
+ *
+ * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ * \code
+ * VkInstance instance;
+ * SDL_Window *window;
+ *
+ * // create instance and window
+ *
+ * // create the Vulkan surface
+ * VkSurfaceKHR surface;
+ * if(!SDL_Vulkan_CreateSurface(window, instance, &surface))
+ * handle_error();
+ * \endcode
+ *
+ * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag.
+ *
+ * \note \a instance should have been created with the extensions returned
+ * by \c SDL_Vulkan_CreateSurface() enabled.
+ *
+ * \sa SDL_Vulkan_GetInstanceExtensions()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR* surface);
+
+/**
+ * \brief Get the size of a window's underlying drawable in pixels (for use
+ * with setting viewport, scissor & etc).
+ *
+ * \param window SDL_Window from which the drawable size should be queried
+ * \param w Pointer to variable for storing the width in pixels,
+ * may be NULL
+ * \param h Pointer to variable for storing the height in pixels,
+ * may be NULL
+ *
+ * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
+ * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
+ * platform with high-DPI support (Apple calls this "Retina"), and not disabled
+ * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
+ *
+ * \note On macOS high-DPI support must be enabled for an application by
+ * setting NSHighResolutionCapable to true in its Info.plist.
+ *
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_CreateWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window,
+ int *w, int *h);
+
+/* @} *//* Vulkan support functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_vulkan_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
# else
# define DECLSPEC __declspec(dllexport)
# endif
+# elif defined(__OS2__)
+# ifdef BUILD_SDL
+# define DECLSPEC __declspec(dllexport)
+# else
+# define DECLSPEC
+# endif
# else
# if defined(__GNUC__) && __GNUC__ >= 4
# define DECLSPEC __attribute__ ((visibility("default")))
#ifndef SDLCALL
#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
#define SDLCALL __cdecl
+#elif defined(__OS2__) || defined(__EMX__)
+#define SDLCALL _System
+# if defined (__GNUC__) && !defined(_System)
+# define _System /* for old EMX/GCC compat. */
+# endif
#else
#define SDLCALL
#endif
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wpragma-pack"
+#endif
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \
defined(__WATCOMC__) || defined(__LCC__) || \
- defined(__DECC)
+ defined(__DECC) || defined(__CC_ARM)
#define SDL_INLINE __inline
#ifndef __inline__
#define __inline__ __inline
#endif
#endif /* SDL_FORCE_INLINE not defined */
+#ifndef SDL_NORETURN
+#if defined(__GNUC__)
+#define SDL_NORETURN __attribute__((noreturn))
+#elif defined(_MSC_VER)
+#define SDL_NORETURN __declspec(noreturn)
+#else
+#define SDL_NORETURN
+#endif
+#endif /* SDL_NORETURN not defined */
+
/* Apparently this is needed by several Windows compilers */
#if !defined(__MACH__)
#ifndef NULL
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* after you finish any function and structure declarations in your headers
*/
+#ifndef _begin_code_h
+#error close_code.h included without matching begin_code.h
+#endif
#undef _begin_code_h
/* Reset structure packing at previous byte alignment */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
# sdl2 cmake project-config input for ./configure scripts
-set(prefix "/var/home/rpolzer/xonotic/misc/buildsrc/tmp/SDL2-2.0.5/../64")
+set(prefix "/opt/local/x86_64-w64-mingw32")
set(exec_prefix "${prefix}")
set(libdir "${exec_prefix}/lib")
-set(SDL2_PREFIX "/var/home/rpolzer/xonotic/misc/buildsrc/tmp/SDL2-2.0.5/../64")
-set(SDL2_EXEC_PREFIX "/var/home/rpolzer/xonotic/misc/buildsrc/tmp/SDL2-2.0.5/../64")
+set(SDL2_PREFIX "/opt/local/x86_64-w64-mingw32")
+set(SDL2_EXEC_PREFIX "/opt/local/x86_64-w64-mingw32")
set(SDL2_LIBDIR "${exec_prefix}/lib")
set(SDL2_INCLUDE_DIRS "${prefix}/include/SDL2")
-set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -lSDL2 -mwindows")
+set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -lSDL2 -mwindows")
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
inherited_linker_flags=''
# Libraries that this one depends upon.
-dependency_libs=' -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid'
+dependency_libs=' -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libSDL2.
-current=4
-age=4
-revision=1
+current=10
+age=10
+revision=0
# Is this an already installed library?
installed=yes
dlpreopen=''
# Directory that this library needs to be installed in:
-libdir='/var/home/rpolzer/xonotic/misc/buildsrc/tmp/SDL2-2.0.5/../64/lib'
+libdir='/Users/valve/release/SDL/SDL2-2.0.10/x86_64-w64-mingw32/lib'
# sdl pkg-config source file
-prefix=/var/home/rpolzer/xonotic/misc/buildsrc/tmp/SDL2-2.0.5/../64
+prefix=/opt/local/x86_64-w64-mingw32
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: sdl2
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
-Version: 2.0.5
+Version: 2.0.10
Requires:
Conflicts:
-Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows
-Libs.private: -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc
+Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows
+Libs.private: -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc
Cflags: -I${includedir}/SDL2 -Dmain=SDL_main
done
fi
- if test -d $sdl_framework; then
+ if test x"$sdl_framework" != x && test -d "$sdl_framework"; then
AC_MSG_RESULT($sdl_framework)
sdl_framework_dir=`dirname $sdl_framework`
SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include"
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*/
-#ifndef _SDL_H
-#define _SDL_H
+#ifndef SDL_h_
+#define SDL_h_
#include "SDL_main.h"
#include "SDL_stdinc.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_joystick.h"
#include "SDL_loadso.h"
#include "SDL_log.h"
#include "SDL_messagebox.h"
#include "SDL_power.h"
#include "SDL_render.h"
#include "SDL_rwops.h"
+#include "SDL_sensor.h"
+#include "SDL_shape.h"
#include "SDL_system.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
#define SDL_INIT_HAPTIC 0x00001000u
#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000u
+#define SDL_INIT_SENSOR 0x00008000u
#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
#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 \
+ SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
)
/* @} */
#endif
#include "close_code.h"
-#endif /* _SDL_H */
+#endif /* SDL_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_assert_h
-#define _SDL_assert_h
+#ifndef SDL_assert_h_
+#define SDL_assert_h_
#include "SDL_config.h"
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
-#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
+#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
-#elif defined(HAVE_SIGNAL_H)
+#elif defined(__386__) && defined(__WATCOMC__)
+ #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
+#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
#include <signal.h>
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
# define SDL_FUNCTION __func__
-#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
+#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__))
# define SDL_FUNCTION __FUNCTION__
#else
# define SDL_FUNCTION "???"
*
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
*
- * \return SDL_AssertState value of how to handle the assertion failure.
+ * Return SDL_AssertState 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.
* <code>
* const SDL_AssertData *item = SDL_GetAssertionReport();
* while (item) {
- * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
+ * 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");
#endif
#include "close_code.h"
-#endif /* _SDL_assert_h */
+#endif /* SDL_assert_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* All of the atomic operations that modify memory are full memory barriers.
*/
-#ifndef _SDL_atomic_h_
-#define _SDL_atomic_h_
+#ifndef SDL_atomic_h_
+#define SDL_atomic_h_
#include "SDL_stdinc.h"
#include "SDL_platform.h"
* 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)
+#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier()
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
+#elif defined(__WATCOMC__)
+extern _inline void SDL_CompilerBarrier (void);
+#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
#else
#define SDL_CompilerBarrier() \
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
* For more information on these semantics, take a look at the blog post:
* http://preshing.com/20120913/acquire-and-release-semantics
*/
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
+extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
+
#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(__aarch64__)
+#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
+#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "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__)
+#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */
+/* Information from:
+ https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19
+
+ The Linux kernel provides a helper function which provides the right code for a memory barrier,
+ hard-coded at address 0xffff0fa0
+*/
+typedef void (*SDL_KernelMemoryBarrierFunc)();
+#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
+#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
+#elif 0 /* defined(__QNXNTO__) */
+#include <sys/cpuinline.h>
+
+#define SDL_MemoryBarrierRelease() __cpu_membarrier()
+#define SDL_MemoryBarrierAcquire() __cpu_membarrier()
+#else
+#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__) || defined(__ARM_ARCH_8A__)
#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__)
+#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__) || defined(__ARM_ARCH_5TE__)
#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();
+#define SDL_MEMORY_BARRIER_USES_FUNCTION
+#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
+#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
#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")
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
+#endif /* __LINUX__ || __ANDROID__ */
#endif /* __GNUC__ && __arm__ */
#else
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
#include "close_code.h"
-#endif /* _SDL_atomic_h_ */
+#endif /* SDL_atomic_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Access to the raw audio mixing buffer for the SDL library.
*/
-#ifndef _SDL_audio_h
-#define _SDL_audio_h
+#ifndef SDL_audio_h_
+#define SDL_audio_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#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)
+#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008
+#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE)
/* @} */
/* @} *//* Audio flags */
/**
* The calculated values in this structure are calculated by SDL_OpenAudio().
+ *
+ * For multi-channel audio, the default SDL channel mapping is:
+ * 2: FL FR (stereo)
+ * 3: FL FR LFE (2.1 surround)
+ * 4: FL FR BL BR (quad)
+ * 5: FL FR FC BL BR (quad + center)
+ * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
+ * 7: FL FR FC LFE BC SL SR (6.1 surround)
+ * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
*/
typedef struct SDL_AudioSpec
{
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 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
Uint16 padding; /**< Necessary for some compile environments */
Uint32 size; /**< Audio buffer size in bytes (calculated) */
SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
SDL_AudioFormat format);
/**
- * A structure to hold a set of audio conversion filters and buffers.
+ * \brief Upper limit of filters in SDL_AudioCVT
+ *
+ * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
+ * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
+ * one of which is the terminating NULL pointer.
+ */
+#define SDL_AUDIOCVT_MAX_FILTERS 9
+
+/**
+ * \struct SDL_AudioCVT
+ * \brief A structure to hold a set of audio conversion filters and buffers.
+ *
+ * Note that various parts of the conversion pipeline can take advantage
+ * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
+ * you to pass it aligned data, but can possibly run much faster if you
+ * set both its (buf) field to a pointer that is aligned to 16 bytes, and its
+ * (len) field to something that's a multiple of 16, if possible.
*/
#ifdef __GNUC__
/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
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 */
+ SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
int filter_index; /**< Current audio conversion function */
} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
/* @} *//* 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:
+ * \brief Load the audio data of a WAVE file into memory
+ *
+ * Loading a WAVE file requires \c src, \c spec, \c audio_buf and \c audio_len
+ * to be valid pointers. The entire data portion of the file is then loaded
+ * into memory and decoded if necessary.
+ *
+ * If \c freesrc is non-zero, the data source gets automatically closed and
+ * freed before the function returns.
+ *
+ * Supported are RIFF WAVE files with the formats PCM (8, 16, 24, and 32 bits),
+ * IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and A-law and
+ * µ-law (8 bits). Other formats are currently unsupported and cause an error.
+ *
+ * If this function succeeds, the pointer returned by it is equal to \c spec
+ * and the pointer to the audio data allocated by the function is written to
+ * \c audio_buf and its length in bytes to \c audio_len. The \ref SDL_AudioSpec
+ * members \c freq, \c channels, and \c format are set to the values of the
+ * audio data in the buffer. The \c samples member is set to a sane default and
+ * all others are set to zero.
+ *
+ * It's necessary to use SDL_FreeWAV() to free the audio data returned in
+ * \c audio_buf when it is no longer used.
+ *
+ * Because of the underspecification of the Waveform format, there are many
+ * problematic files in the wild that cause issues with strict decoders. To
+ * provide compatibility with these files, this decoder is lenient in regards
+ * to the truncation of the file, the fact chunk, and the size of the RIFF
+ * chunk. The hints SDL_HINT_WAVE_RIFF_CHUNK_SIZE, SDL_HINT_WAVE_TRUNCATION,
+ * and SDL_HINT_WAVE_FACT_CHUNK can be used to tune the behavior of the
+ * loading process.
+ *
+ * Any file that is invalid (due to truncation, corruption, or wrong values in
+ * the headers), too big, or unsupported causes an error. Additionally, any
+ * critical I/O error from the data source will terminate the loading process
+ * with an error. The function returns NULL on error and in all cases (with the
+ * exception of \c src being NULL), an appropriate error message will be set.
+ *
+ * It is required that the data source supports seeking.
+ *
+ * Example:
* \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.
+ * \param src The data source with the WAVE data
+ * \param freesrc A integer value that makes the function close the data source if non-zero
+ * \param spec A pointer filled with the audio format of the audio data
+ * \param audio_buf A pointer filled with the audio data allocated by the function
+ * \param audio_len A pointer filled with the length of the audio data buffer in bytes
+ * \return NULL on error, or non-NULL on success.
*/
extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
int freesrc,
* 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.
+ * to the other. An unsupported format causes an error and -1 will be returned.
*
- * \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.
+ * \return 0 if no conversion is needed, 1 if the audio filter is set up,
+ * or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
SDL_AudioFormat src_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.
+ *
+ * \return 0 on success or -1 if \c cvt->buf is NULL.
*/
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
+/* SDL_AudioStream is a new audio conversion interface.
+ The benefits vs SDL_AudioCVT:
+ - it can handle resampling data in chunks without generating
+ artifacts, when it doesn't have the complete buffer available.
+ - it can handle incoming data in any variable size.
+ - You push data as you have it, and pull it when you need it
+ */
+/* this is opaque to the outside world. */
+struct _SDL_AudioStream;
+typedef struct _SDL_AudioStream SDL_AudioStream;
+
+/**
+ * Create a new audio stream
+ *
+ * \param src_format The format of the source audio
+ * \param src_channels The number of channels of the source audio
+ * \param src_rate The sampling rate of the source audio
+ * \param dst_format The format of the desired audio output
+ * \param dst_channels The number of channels of the desired audio output
+ * \param dst_rate The sampling rate of the desired audio output
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format,
+ const Uint8 src_channels,
+ const int src_rate,
+ const SDL_AudioFormat dst_format,
+ const Uint8 dst_channels,
+ const int dst_rate);
+
+/**
+ * Add data to be converted/resampled to the stream
+ *
+ * \param stream The stream the audio data is being added to
+ * \param buf A pointer to the audio data to add
+ * \param len The number of bytes to write to the stream
+ * \return 0 on success, or -1 on error.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len);
+
+/**
+ * Get converted/resampled data from the stream
+ *
+ * \param stream The stream the audio is being requested from
+ * \param buf A buffer to fill with audio data
+ * \param len The maximum number of bytes to fill
+ * \return The number of bytes read from the stream, or -1 on error
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len);
+
+/**
+ * Get the number of converted/resampled bytes available. The stream may be
+ * buffering data behind the scenes until it has enough to resample
+ * correctly, so this number might be lower than what you expect, or even
+ * be zero. Add more data or flush the stream if you need the data now.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream);
+
+/**
+ * Tell the stream that you're done sending data, and anything being buffered
+ * should be converted/resampled and made available immediately.
+ *
+ * It is legal to add more data to a stream after flushing, but there will
+ * be audio gaps in the output. Generally this is intended to signal the
+ * end of input, so the complete output becomes available.
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamClear
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream);
+
+/**
+ * Clear any pending data in the stream without converting it
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_FreeAudioStream
+ */
+extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
+
+/**
+ * Free an audio stream
+ *
+ * \sa SDL_NewAudioStream
+ * \sa SDL_AudioStreamPut
+ * \sa SDL_AudioStreamGet
+ * \sa SDL_AudioStreamAvailable
+ * \sa SDL_AudioStreamFlush
+ * \sa SDL_AudioStreamClear
+ */
+extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
+
#define SDL_MIX_MAXVOLUME 128
/**
* This takes two audio buffers of the playing audio format and mixes
* \param dev The device ID to which we will queue audio.
* \param data The data to queue to the device for later playback.
* \param len The number of bytes (not samples!) to which (data) points.
- * \return zero on success, -1 on error.
+ * \return 0 on success, or -1 on error.
*
* \sa SDL_GetQueuedAudioSize
* \sa SDL_ClearQueuedAudio
#endif
#include "close_code.h"
-#endif /* _SDL_audio_h */
+#endif /* SDL_audio_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Functions for fiddling with bits and bitmasks.
*/
-#ifndef _SDL_bits_h
-#define _SDL_bits_h
+#ifndef SDL_bits_h_
+#define SDL_bits_h_
#include "SDL_stdinc.h"
*
* \return Index of the most significant bit, or -1 if the value is 0.
*/
+#if defined(__WATCOMC__) && defined(__386__)
+extern _inline int _SDL_clz_watcom (Uint32);
+#pragma aux _SDL_clz_watcom = \
+ "bsr eax, eax" \
+ "xor eax, 31" \
+ parm [eax] nomemory \
+ value [eax] \
+ modify exact [eax] nomemory;
+#endif
+
SDL_FORCE_INLINE int
SDL_MostSignificantBitIndex32(Uint32 x)
{
-#if defined(__GNUC__) && __GNUC__ >= 4
+#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
/* Count Leading Zeroes builtin in GCC.
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
*/
return -1;
}
return 31 - __builtin_clz(x);
+#elif defined(__WATCOMC__) && defined(__386__)
+ if (x == 0) {
+ return -1;
+ }
+ return 31 - _SDL_clz_watcom(x);
#else
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
* <seander@cs.stanford.edu>, released in the public domain.
#endif
}
+SDL_FORCE_INLINE SDL_bool
+SDL_HasExactlyOneBitSet32(Uint32 x)
+{
+ if (x && !(x & (x - 1))) {
+ return SDL_TRUE;
+ }
+ return SDL_FALSE;
+}
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_bits_h */
+#endif /* SDL_bits_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file declaring the SDL_BlendMode enumeration
*/
-#ifndef _SDL_blendmode_h
-#define _SDL_blendmode_h
+#ifndef SDL_blendmode_h_
+#define SDL_blendmode_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
dstRGB = (srcRGB * srcA) + dstRGB
dstA = dstA */
- SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate
+ SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
dstRGB = srcRGB * dstRGB
dstA = dstA */
+ SDL_BLENDMODE_INVALID = 0x7FFFFFFF
+
+ /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
+
} SDL_BlendMode;
+/**
+ * \brief The blend operation used when combining source and destination pixel components
+ */
+typedef enum
+{
+ SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
+ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
+ SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
+ SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
+ SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */
+
+} SDL_BlendOperation;
+
+/**
+ * \brief The normalized factor used to multiply pixel components
+ */
+typedef enum
+{
+ SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
+ SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
+ SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
+ SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
+ SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
+ SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
+ SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
+ SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
+
+} SDL_BlendFactor;
+
+/**
+ * \brief Create a custom blend mode, which may or may not be supported by a given renderer
+ *
+ * \param srcColorFactor source color factor
+ * \param dstColorFactor destination color factor
+ * \param colorOperation color operation
+ * \param srcAlphaFactor source alpha factor
+ * \param dstAlphaFactor destination alpha factor
+ * \param alphaOperation alpha operation
+ *
+ * The result of the blend mode operation will be:
+ * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
+ * and
+ * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
+ */
+extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
+ SDL_BlendFactor dstColorFactor,
+ SDL_BlendOperation colorOperation,
+ SDL_BlendFactor srcAlphaFactor,
+ SDL_BlendFactor dstAlphaFactor,
+ SDL_BlendOperation alphaOperation);
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_blendmode_h */
+#endif /* SDL_blendmode_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL clipboard handling
*/
-#ifndef _SDL_clipboard_h
-#define _SDL_clipboard_h
+#ifndef SDL_clipboard_h_
+#define SDL_clipboard_h_
#include "SDL_stdinc.h"
#endif
#include "close_code.h"
-#endif /* _SDL_clipboard_h */
+#endif /* SDL_clipboard_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_config_h
-#define _SDL_config_h
+#ifndef SDL_config_h_
+#define SDL_config_h_
#include "SDL_platform.h"
*/
/* Add any platform that doesn't build using the configure system. */
-#ifdef USING_PREMAKE_CONFIG_H
-#include "SDL_config_premake.h"
-#elif defined(__WIN32__)
+#if defined(__WIN32__)
#include "SDL_config_windows.h"
#elif defined(__WINRT__)
#include "SDL_config_winrt.h"
#include "SDL_config_android.h"
#elif defined(__PSP__)
#include "SDL_config_psp.h"
+#elif defined(__OS2__)
+#include "SDL_config_os2.h"
#else
-/* This is a minimal configuration just to get SDL running on new platforms */
+/* This is a minimal configuration just to get SDL running on new platforms. */
#include "SDL_config_minimal.h"
#endif /* platform config */
#error Wrong SDL_config.h, check your include path?
#endif
-#endif /* _SDL_config_h */
+#endif /* SDL_config_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_config_macosx_h
-#define _SDL_config_macosx_h
+#ifndef SDL_config_macosx_h_
+#define SDL_config_macosx_h_
+#define SDL_config_h_
#include "SDL_platform.h"
#endif
/* Useful headers */
-#define HAVE_ALLOCA_H 1
-#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_ALLOCA_H 1
#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_LIBUNWIND_H 1
/* C library functions */
#define HAVE_MALLOC 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_STRNCASECMP 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
+#define HAVE_M_PI 1
+#define HAVE_ACOS 1
+#define HAVE_ACOSF 1
+#define HAVE_ASIN 1
+#define HAVE_ASINF 1
+#define HAVE_ATAN 1
+#define HAVE_ATANF 1
+#define HAVE_ATAN2 1
+#define HAVE_ATAN2F 1
#define HAVE_CEIL 1
+#define HAVE_CEILF 1
#define HAVE_COPYSIGN 1
+#define HAVE_COPYSIGNF 1
#define HAVE_COS 1
#define HAVE_COSF 1
+#define HAVE_EXP 1
+#define HAVE_EXPF 1
#define HAVE_FABS 1
+#define HAVE_FABSF 1
#define HAVE_FLOOR 1
+#define HAVE_FLOORF 1
+#define HAVE_FMOD 1
+#define HAVE_FMODF 1
#define HAVE_LOG 1
+#define HAVE_LOGF 1
+#define HAVE_LOG10 1
+#define HAVE_LOG10F 1
#define HAVE_POW 1
+#define HAVE_POWF 1
#define HAVE_SCALBN 1
+#define HAVE_SCALBNF 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_NANOSLEEP 1
#define HAVE_SYSCONF 1
#define HAVE_SYSCTLBYNAME 1
-#define HAVE_ATAN 1
-#define HAVE_ATAN2 1
-#define HAVE_ACOS 1
-#define HAVE_ASIN 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_COREAUDIO 1
/* Enable various input drivers */
#define SDL_JOYSTICK_IOKIT 1
+#define SDL_JOYSTICK_HIDAPI 1
#define SDL_HAPTIC_IOKIT 1
+/* Enable the dummy sensor driver */
+#define SDL_SENSOR_DUMMY 1
+
/* Enable various shared object loading systems */
#define SDL_LOADSO_DLOPEN 1
#define SDL_VIDEO_RENDER_OGL 1
#endif
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 1
+#endif
+
+#ifndef SDL_VIDEO_RENDER_METAL
+/* Metal only supported on 64-bit architectures with 10.11+ */
+#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_VIDEO_RENDER_METAL 1
+#else
+#define SDL_VIDEO_RENDER_METAL 0
+#endif
+#endif
+
/* Enable OpenGL support */
#ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1
#endif
+#ifndef SDL_VIDEO_OPENGL_ES2
+#define SDL_VIDEO_OPENGL_ES2 1
+#endif
+#ifndef SDL_VIDEO_OPENGL_EGL
+#define SDL_VIDEO_OPENGL_EGL 1
+#endif
#ifndef SDL_VIDEO_OPENGL_CGL
#define SDL_VIDEO_OPENGL_CGL 1
#endif
#define SDL_VIDEO_OPENGL_GLX 1
#endif
+/* Enable Vulkan support */
+/* Metal/Vulkan Portability only supported on 64-bit architectures with 10.11+ */
+#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
+#define SDL_VIDEO_VULKAN 1
+#else
+#define SDL_VIDEO_VULKAN 0
+#endif
+
/* Enable system power support */
#define SDL_POWER_MACOSX 1
#define SDL_ALTIVEC_BLITTERS 1
#endif
-#endif /* _SDL_config_macosx_h */
+#endif /* SDL_config_macosx_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* CPU feature detection for SDL.
*/
-#ifndef _SDL_cpuinfo_h
-#define _SDL_cpuinfo_h
+#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) && (defined(_M_IX86) || defined(_M_X64))
+#ifdef __clang__
+/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
+#undef __MMX__
+#undef __SSE__
+#undef __SSE2__
+#else
#include <intrin.h>
#ifndef _WIN64
+#ifndef __MMX__
#define __MMX__
+#endif
+#ifndef __3dNOW__
#define __3dNOW__
#endif
+#endif
+#ifndef __SSE__
#define __SSE__
+#endif
+#ifndef __SSE2__
#define __SSE2__
+#endif
+#endif /* __clang__ */
#elif defined(__MINGW64_VERSION_MAJOR)
#include <intrin.h>
#else
-#ifdef __ALTIVEC__
-#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
+/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */
+#if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H)
#include <altivec.h>
-#undef pixel
#endif
+#if !defined(SDL_DISABLE_ARM_NEON_H)
+# if defined(__ARM_NEON)
+# include <arm_neon.h>
+# elif defined(__WINDOWS__) || defined(__WINRT__)
+/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
+# if defined(_M_ARM)
+# include <armintr.h>
+# include <arm_neon.h>
+# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
+# endif
+# if defined (_M_ARM64)
+# include <armintr.h>
+# include <arm_neon.h>
+# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
+# endif
+# endif
#endif
-#ifdef __MMX__
-#include <mmintrin.h>
-#endif
-#ifdef __3dNOW__
+#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
#include <mm3dnow.h>
#endif
-#ifdef __SSE__
+#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
+#include <immintrin.h>
+#else
+#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
+#include <mmintrin.h>
+#endif
+#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
#include <xmmintrin.h>
#endif
-#ifdef __SSE2__
+#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
#include <emmintrin.h>
#endif
+#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
+#include <pmmintrin.h>
#endif
+#endif /* HAVE_IMMINTRIN_H */
+#endif /* compiler version */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
+/**
+ * This function returns true if the CPU has AVX-512F (foundation) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
+
+/**
+ * This function returns true if the CPU has NEON (ARM SIMD) features.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
+
/**
* This function returns the amount of RAM configured in the system, in MB.
*/
extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
+/**
+ * \brief Report the alignment this system needs for SIMD allocations.
+ *
+ * This will return the minimum number of bytes to which a pointer must be
+ * aligned to be compatible with SIMD instructions on the current machine.
+ * For example, if the machine supports SSE only, it will return 16, but if
+ * it supports AVX-512F, it'll return 64 (etc). This only reports values for
+ * instruction sets SDL knows about, so if your SDL build doesn't have
+ * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
+ * not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
+ * Plan accordingly.
+ */
+extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
+
+/**
+ * \brief Allocate memory in a SIMD-friendly way.
+ *
+ * This will allocate a block of memory that is suitable for use with SIMD
+ * instructions. Specifically, it will be properly aligned and padded for
+ * the system's supported vector instructions.
+ *
+ * The memory returned will be padded such that it is safe to read or write
+ * an incomplete vector at the end of the memory block. This can be useful
+ * so you don't have to drop back to a scalar fallback at the end of your
+ * SIMD processing loop to deal with the final elements without overflowing
+ * the allocated buffer.
+ *
+ * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free()
+ * or delete[], etc.
+ *
+ * Note that SDL will only deal with SIMD instruction sets it is aware of;
+ * for example, SDL 2.0.8 knows that SSE wants 16-byte vectors
+ * (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't
+ * know that AVX-512 wants 64. To be clear: if you can't decide to use an
+ * instruction set with an SDL_Has*() function, don't use that instruction
+ * set with memory allocated through here.
+ *
+ * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't
+ * out of memory.
+ *
+ * \param len The length, in bytes, of the block to allocated. The actual
+ * allocated block might be larger due to padding, etc.
+ * \return Pointer to newly-allocated block, NULL if out of memory.
+ *
+ * \sa SDL_SIMDAlignment
+ * \sa SDL_SIMDFree
+ */
+extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
+
+/**
+ * \brief Deallocate memory obtained from SDL_SIMDAlloc
+ *
+ * It is not valid to use this function on a pointer from anything but
+ * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
+ * SDL_malloc, memalign, new[], etc.
+ *
+ * However, SDL_SIMDFree(NULL) is a legal no-op.
+ *
+ * \sa SDL_SIMDAlloc
+ */
+extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr);
+/* vi: set ts=4 sw=4 expandtab: */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_cpuinfo_h */
+#endif /* SDL_cpuinfo_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Functions for reading and writing endian-specific values
*/
-#ifndef _SDL_endian_h
-#define _SDL_endian_h
+#ifndef SDL_endian_h_
+#define SDL_endian_h_
#include "SDL_stdinc.h"
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint16 SDL_Swap16(Uint16);
+#pragma aux SDL_Swap16 = \
+ "xchg al, ah" \
+ parm [ax] \
+ modify [ax];
#else
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
+#elif defined(__WATCOMC__) && defined(__386__)
+extern _inline Uint32 SDL_Swap32(Uint32);
+#ifndef __SW_3 /* 486+ */
+#pragma aux SDL_Swap32 = \
+ "bswap eax" \
+ parm [eax] \
+ modify [eax];
+#else /* 386-only */
+#pragma aux SDL_Swap32 = \
+ "xchg al, ah" \
+ "ror eax, 16" \
+ "xchg al, ah" \
+ parm [eax] \
+ modify [eax];
+#endif
#else
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
#endif
#include "close_code.h"
-#endif /* _SDL_endian_h */
+#endif /* SDL_endian_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Simple error message routines for SDL.
*/
-#ifndef _SDL_error_h
-#define _SDL_error_h
+#ifndef SDL_error_h_
+#define SDL_error_h_
#include "SDL_stdinc.h"
#endif
#include "close_code.h"
-#endif /* _SDL_error_h */
+#endif /* SDL_error_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL event handling.
*/
-#ifndef _SDL_events_h
-#define _SDL_events_h
+#ifndef SDL_events_h_
+#define SDL_events_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
Called on Android in onResume()
*/
+ /* Display events */
+ SDL_DISPLAYEVENT = 0x150, /**< Display state change */
+
/* Window events */
SDL_WINDOWEVENT = 0x200, /**< Window state change */
SDL_SYSWMEVENT, /**< System specific event */
SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
+ /* Sensor events */
+ SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */
+
/* Render events */
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
typedef struct SDL_CommonEvent
{
Uint32 type;
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_CommonEvent;
+/**
+ * \brief Display state change event data (event.display.*)
+ */
+typedef struct SDL_DisplayEvent
+{
+ Uint32 type; /**< ::SDL_DISPLAYEVENT */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Uint32 display; /**< The associated display index */
+ Uint8 event; /**< ::SDL_DisplayEventID */
+ Uint8 padding1;
+ Uint8 padding2;
+ Uint8 padding3;
+ Sint32 data1; /**< event dependent data */
+} SDL_DisplayEvent;
+
/**
* \brief Window state change event data (event.window.*)
*/
typedef struct SDL_WindowEvent
{
Uint32 type; /**< ::SDL_WINDOWEVENT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The associated window */
Uint8 event; /**< ::SDL_WindowEventID */
Uint8 padding1;
typedef struct SDL_KeyboardEvent
{
Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_TextEditingEvent
{
Uint32 type; /**< ::SDL_TEXTEDITING */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_TextInputEvent
{
Uint32 type; /**< ::SDL_TEXTINPUT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
} SDL_TextInputEvent;
typedef struct SDL_MouseMotionEvent
{
Uint32 type; /**< ::SDL_MOUSEMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_MouseButtonEvent
{
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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 */
typedef struct SDL_MouseWheelEvent
{
Uint32 type; /**< ::SDL_MOUSEWHEEL */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
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, positive to the right and negative to the left */
typedef struct SDL_JoyAxisEvent
{
Uint32 type; /**< ::SDL_JOYAXISMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */
Uint8 padding1;
typedef struct SDL_JoyBallEvent
{
Uint32 type; /**< ::SDL_JOYBALLMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 ball; /**< The joystick trackball index */
Uint8 padding1;
typedef struct SDL_JoyHatEvent
{
Uint32 type; /**< ::SDL_JOYHATMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */
Uint8 value; /**< The hat position value.
typedef struct SDL_JoyButtonEvent
{
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
typedef struct SDL_JoyDeviceEvent
{
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
} SDL_JoyDeviceEvent;
typedef struct SDL_ControllerAxisEvent
{
Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
Uint8 padding1;
typedef struct SDL_ControllerButtonEvent
{
Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The controller button (SDL_GameControllerButton) */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
typedef struct SDL_ControllerDeviceEvent
{
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
} SDL_ControllerDeviceEvent;
typedef struct SDL_AudioDeviceEvent
{
Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
Uint8 padding1;
typedef struct SDL_TouchFingerEvent
{
Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId;
float x; /**< Normalized in the range 0...1 */
typedef struct SDL_MultiGestureEvent
{
Uint32 type; /**< ::SDL_MULTIGESTURE */
- Uint32 timestamp;
- SDL_TouchID touchId; /**< The touch device index */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ SDL_TouchID touchId; /**< The touch device id */
float dTheta;
float dDist;
float x;
typedef struct SDL_DollarGestureEvent
{
Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */
SDL_GestureID gestureId;
Uint32 numFingers;
typedef struct SDL_DropEvent
{
Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
Uint32 windowID; /**< The window that was dropped on, if any */
} SDL_DropEvent;
+/**
+ * \brief Sensor event structure (event.sensor.*)
+ */
+typedef struct SDL_SensorEvent
+{
+ Uint32 type; /**< ::SDL_SENSORUPDATE */
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
+ Sint32 which; /**< The instance ID of the sensor */
+ float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
+} SDL_SensorEvent;
+
/**
* \brief The "quit requested" event
*/
typedef struct SDL_QuitEvent
{
Uint32 type; /**< ::SDL_QUIT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_QuitEvent;
/**
typedef struct SDL_OSEvent
{
Uint32 type; /**< ::SDL_QUIT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_OSEvent;
/**
typedef struct SDL_UserEvent
{
Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The associated window if any */
Sint32 code; /**< User defined event code */
void *data1; /**< User defined data pointer */
typedef struct SDL_SysWMEvent
{
Uint32 type; /**< ::SDL_SYSWMEVENT */
- Uint32 timestamp;
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
} SDL_SysWMEvent;
{
Uint32 type; /**< Event type, shared with all events */
SDL_CommonEvent common; /**< Common event data */
+ SDL_DisplayEvent display; /**< Window event data */
SDL_WindowEvent window; /**< Window event data */
SDL_KeyboardEvent key; /**< Keyboard event data */
SDL_TextEditingEvent edit; /**< Text editing event data */
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
SDL_AudioDeviceEvent adevice; /**< Audio device event data */
+ SDL_SensorEvent sensor; /**< Sensor event data */
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */
Uint8 padding[56];
} SDL_Event;
+/* Make sure we haven't broken binary compatibility */
+SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == 56);
+
/* Function prototypes */
/**
* 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.
+ * dropped from the event queue and will not 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
#endif
#include "close_code.h"
-#endif /* _SDL_events_h */
+#endif /* SDL_events_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* \brief Include file for filesystem SDL API functions
*/
-#ifndef _SDL_filesystem_h
-#define _SDL_filesystem_h
+#ifndef SDL_filesystem_h_
+#define SDL_filesystem_h_
#include "SDL_stdinc.h"
#endif
#include "close_code.h"
-#endif /* _SDL_filesystem_h */
+#endif /* SDL_filesystem_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL game controller event handling
*/
-#ifndef _SDL_gamecontroller_h
-#define _SDL_gamecontroller_h
+#ifndef SDL_gamecontroller_h_
+#define SDL_gamecontroller_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/
-/* The gamecontroller structure used to identify an SDL game controller */
+/**
+ * The gamecontroller structure used to identify an SDL game controller
+ */
struct _SDL_GameController;
typedef struct _SDL_GameController SDL_GameController;
* 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) ) {
+ * for (int i = 0; i < nJoysticks; i++) {
+ * if (SDL_IsGameController(i)) {
* nGameControllers++;
* }
* }
* 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",
+ * "03000000341a00003608000000000000,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",
*
*/
*
* \return number of mappings added, -1 on error
*/
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw );
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
/**
* Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
*
* \return 1 if mapping is added, 0 if updated, -1 on error
*/
-extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString );
+extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
+
+/**
+ * Get the number of mappings installed
+ *
+ * \return the number of mappings
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
+
+/**
+ * Get the mapping at a particular index.
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range.
+ */
+extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
/**
* 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 );
+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 );
+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.
*/
extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
+/**
+ * Get the mapping of a game controller.
+ * This can be called before any controllers are opened.
+ *
+ * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
+ */
+extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(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.
*/
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
+/**
+ * Get the player index of an opened game controller, or -1 if it's not available
+ *
+ * For XInput controllers this returns the XInput user index.
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
+
+/**
+ * Get the USB vendor ID of an opened controller, if available.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller);
+
+/**
+ * Get the USB product ID of an opened controller, if available.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller);
+
+/**
+ * Get the product version of an opened controller, if available.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller);
+
/**
* Returns SDL_TRUE if the controller has been opened and currently connected,
* or SDL_FALSE if it has not.
/**
* The list of axes available from a controller
+ *
+ * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
+ * and are centered within ~8000 of zero, though advanced UI will allow users to set
+ * or autodetect the dead zone, which varies between controllers.
+ *
+ * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
*/
typedef enum
{
extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
SDL_GameControllerButton button);
+/**
+ * Trigger a rumble effect
+ * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
+ *
+ * \param gamecontroller The controller to vibrate
+ * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF
+ * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
+ * \param duration_ms The duration of the rumble effect, in milliseconds
+ *
+ * \return 0, or -1 if rumble isn't supported on this joystick
+ */
+extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
+
/**
* Close a controller previously opened with SDL_GameControllerOpen().
*/
#endif
#include "close_code.h"
-#endif /* _SDL_gamecontroller_h */
+#endif /* SDL_gamecontroller_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL gesture event handling.
*/
-#ifndef _SDL_gesture_h
-#define _SDL_gesture_h
+#ifndef SDL_gesture_h_
+#define SDL_gesture_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
#include "close_code.h"
-#endif /* _SDL_gesture_h */
+#endif /* SDL_gesture_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/**
* \file SDL_haptic.h
*
- * \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
+ * \brief The SDL haptic subsystem allows you to control haptic (force feedback)
* devices.
*
* The basic usage is as follows:
- * - Initialize the Subsystem (::SDL_INIT_HAPTIC).
- * - Open a Haptic Device.
+ * - Initialize the subsystem (::SDL_INIT_HAPTIC).
+ * - Open a haptic device.
* - SDL_HapticOpen() to open from index.
* - SDL_HapticOpenFromJoystick() to open from an existing joystick.
* - Create an effect (::SDL_HapticEffect).
* \endcode
*/
-#ifndef _SDL_haptic_h
-#define _SDL_haptic_h
+#ifndef SDL_haptic_h_
+#define SDL_haptic_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
extern "C" {
#endif /* __cplusplus */
+/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF).
+ *
+ * At the moment the magnitude variables are mixed between signed/unsigned, and
+ * it is also not made clear that ALL of those variables expect a max of 0x7FFF.
+ *
+ * Some platforms may have higher precision than that (Linux FF, Windows XInput)
+ * so we should fix the inconsistency in favor of higher possible precision,
+ * adjusting for platforms that use different scales.
+ * -flibit
+ */
+
/**
* \typedef SDL_Haptic
*
/**
* \brief Device can be queried for effect status.
*
- * Device can be queried for effect status.
+ * Device supports querying effect status.
*
* \sa SDL_HapticGetEffectStatus
*/
/**
* \brief Device can be paused.
*
+ * Devices supports being paused.
+ *
* \sa SDL_HapticPause
* \sa SDL_HapticUnpause
*/
/**
* \brief A structure containing a template for a Constant effect.
*
- * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
+ * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
*
* A constant effect applies a constant force in the specified direction
* to the joystick.
* This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
*
* The Left/Right effect is used to explicitly control the large and small
- * motors, commonly found in modern game controllers. One motor is high
- * frequency, the other is low frequency.
+ * motors, commonly found in modern game controllers. The small (right) motor
+ * is high frequency, and the large (left) motor is low frequency.
*
* \sa SDL_HAPTIC_LEFTRIGHT
* \sa SDL_HapticEffect
Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */
/* Replay */
- Uint32 length; /**< Duration of the effect. */
+ Uint32 length; /**< Duration of the effect in milliseconds. */
/* Rumble */
Uint16 large_magnitude; /**< Control of the large controller motor. */
/**
* \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
*
+ * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
+ *
* A custom force feedback effect is much like a periodic effect, where the
* application can define its exact shape. You will have to allocate the
* data yourself. Data should consist of channels * samples Uint16 samples.
extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
/**
- * \brief Get the implementation dependent name of a Haptic device.
+ * \brief Get the implementation dependent name of a haptic device.
*
* 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_HapticName(int device_index);
/**
- * \brief Opens a Haptic device for usage.
+ * \brief Opens a haptic device for use.
*
- * The index passed as an argument refers to the N'th Haptic device on this
+ * The index passed as an argument refers to the N'th haptic device on this
* system.
*
* When opening a haptic device, its gain will be set to maximum and
* \brief Checks to see if a joystick has haptic features.
*
* \param joystick Joystick to test for haptic capabilities.
- * \return 1 if the joystick is haptic, 0 if it isn't
- * or -1 if an error ocurred.
+ * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't
+ * or -1 if an error occurred.
*
* \sa SDL_HapticOpenFromJoystick
*/
extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
/**
- * \brief Opens a Haptic device for usage from a Joystick device.
+ * \brief Opens a haptic device for use from a joystick device.
*
* You must still close the haptic device separately. It will not be closed
* with the joystick.
joystick);
/**
- * \brief Closes a Haptic device previously opened with SDL_HapticOpen().
+ * \brief Closes a haptic device previously opened with SDL_HapticOpen().
*
* \param haptic Haptic device to close.
*/
* Example:
* \code
* if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
- * printf("We have constant haptic effect!");
+ * printf("We have constant haptic effect!\n");
* }
* \endcode
*
*
* \param haptic Haptic device to create the effect on.
* \param effect Properties of the effect to create.
- * \return The id of the effect on success or -1 on error.
+ * \return The identifier of the effect on success or -1 on error.
*
* \sa SDL_HapticUpdateEffect
* \sa SDL_HapticRunEffect
/**
* \brief Updates the properties of an effect.
*
- * Can be used dynamically, although behaviour when dynamically changing
+ * Can be used dynamically, although behavior when dynamically changing
* direction may be strange. Specifically the effect may reupload itself
* and start playing from the start. You cannot change the type either when
* running SDL_HapticUpdateEffect().
*
* \param haptic Haptic device that has the effect.
- * \param effect Effect to update.
+ * \param effect Identifier of the effect to update.
* \param data New effect properties to use.
* \return 0 on success or -1 on error.
*
#endif
#include "close_code.h"
-#endif /* _SDL_haptic_h */
+#endif /* SDL_haptic_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* to how they would like the library to work.
*/
-#ifndef _SDL_hints_h
-#define _SDL_hints_h
+#ifndef SDL_hints_h_
+#define SDL_hints_h_
#include "SDL_stdinc.h"
* "opengl"
* "opengles2"
* "opengles"
+ * "metal"
* "software"
*
* The default varies by platform, but it's the first one in the list that
*/
#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG"
+/**
+ * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
+ *
+ * This variable can be set to the following values:
+ * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen
+ * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen
+ *
+ * By default letterbox is used
+ */
+#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE"
+
/**
* \brief A variable controlling the scaling quality
*
*/
#define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING"
+/**
+ * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - Disable _NET_WM_BYPASS_COMPOSITOR
+ * "1" - Enable _NET_WM_BYPASS_COMPOSITOR
+ *
+ * By default SDL will use _NET_WM_BYPASS_COMPOSITOR
+ *
+ */
+#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
+
/**
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
*
*/
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
+/**
+ * \brief A variable to specify custom icon resource id from RC file on Windows platform
+ */
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON"
+#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
+
/**
* \brief A variable controlling whether the windows message loop is processed by SDL
*
*/
#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
+/**
+ * \brief A variable setting the double click time, in milliseconds.
+ */
+#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME"
+
+/**
+ * \brief A variable setting the double click radius, in pixels.
+ */
+#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS"
+
+/**
+ * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode
+ */
+#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE"
+
+/**
+ * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
+ */
+#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
+
/**
* \brief A variable controlling whether relative mouse mode is implemented using mouse warping
*
*/
#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
+/**
+ * \brief A variable controlling whether touch events should generate synthetic mouse events
+ *
+ * This variable can be set to the following values:
+ * "0" - Touch events will not generate mouse events
+ * "1" - Touch events will generate mouse events
+ *
+ * By default SDL will generate mouse events for touch events
+ */
+#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS"
+
+/**
+ * \brief A variable controlling whether mouse events should generate synthetic touch events
+ *
+ * This variable can be set to the following values:
+ * "0" - Mouse events will not generate touch events (default for desktop platforms)
+ * "1" - Mouse events will generate touch events (default for mobile platforms, such as Android and iOS)
+ */
+
+#define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS"
+
/**
* \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true.
*
#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
/**
- * \brief A variable controlling which orientations are allowed on iOS.
+ * \brief A variable controlling which orientations are allowed on iOS/Android.
*
* In some circumstances it is necessary to be able to explicitly control
* which UI orientations are allowed.
*/
#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION"
+/**
+ * \brief A variable controlling whether the home indicator bar on iPhone X
+ * should be hidden.
+ *
+ * This variable can be set to the following values:
+ * "0" - The indicator bar is not hidden (default for windowed applications)
+ * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications)
+ * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications)
+ */
+#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR"
+
/**
* \brief A variable controlling whether the Android / iOS built-in
- * accelerometer should be listed as a joystick device, rather than listing
- * actual joysticks only.
+ * accelerometer should be listed as a joystick device.
*
* This variable can be set to the following values:
- * "0" - List only real joysticks and accept input from them
- * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default).
+ * "0" - The accelerometer is not listed as a joystick
+ * "1" - The accelerometer is available as a 3 axis joystick (the default).
*/
#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK"
+/**
+ * \brief A variable controlling whether the Android / tvOS remotes
+ * should be listed as joystick devices, instead of sending keyboard events.
+ *
+ * This variable can be set to the following values:
+ * "0" - Remotes send enter/escape/arrow key events
+ * "1" - Remotes are available as 2 axis, 2 button joysticks (the default).
+ */
+#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK"
/**
* \brief A variable that lets you disable the detection and use of Xinput gamepad devices
*/
#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
-
/**
* \brief A variable that causes SDL to use the old axis and button mapping for XInput devices.
*
*/
#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
-
/**
- * \brief A variable that lets you manually hint extra gamecontroller db entries
+ * \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
*
*/
#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
+/**
+ * \brief A variable that lets you provide a file with extra gamecontroller db entries.
+ *
+ * The file should contain lines 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_FILE "SDL_GAMECONTROLLERCONFIG_FILE"
+
+/**
+ * \brief A variable containing a list of devices to skip when scanning for game controllers.
+ *
+ * The format of the string is a comma separated list of USB VID/PID pairs
+ * in hexadecimal form, e.g.
+ *
+ * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ * The variable can also take the form of @file, in which case the named
+ * file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES"
+
+/**
+ * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable.
+ *
+ * The format of the string is a comma separated list of USB VID/PID pairs
+ * in hexadecimal form, e.g.
+ *
+ * 0xAAAA/0xBBBB,0xCCCC/0xDDDD
+ *
+ * The variable can also take the form of @file, in which case the named
+ * file will be loaded and interpreted as the value of the variable.
+ */
+#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
/**
* \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
*/
#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
+/**
+ * \brief A variable controlling whether the HIDAPI joystick drivers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI drivers are not used
+ * "1" - HIDAPI drivers are used (the default)
+ *
+ * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below.
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4"
+
+/**
+ * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver.
+ *
+ * This variable can be set to the following values:
+ * "0" - extended reports are not enabled (the default)
+ * "1" - extended reports
+ *
+ * Extended input reports allow rumble on Bluetooth PS4 controllers, but
+ * break DirectInput handling for applications that don't use SDL.
+ *
+ * Once extended reports are enabled, they can not be disabled without
+ * power cycling the controller.
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH"
+
+/**
+ * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used.
+ *
+ * This variable can be set to the following values:
+ * "0" - HIDAPI driver is not used
+ * "1" - HIDAPI driver is used
+ *
+ * The default is the value of SDL_HINT_JOYSTICK_HIDAPI
+ */
+#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX"
+
+/**
+ * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
+ *
+ * The variable can be set to the following values:
+ * "0" - Do not scan for Steam Controllers
+ * "1" - Scan for Steam Controllers (the default)
+ *
+ * The default value is "1". This hint must be set before initializing the joystick subsystem.
+ */
+#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS"
+
/**
* \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
*/
#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
-
/**
* \brief A variable that controls the timer resolution, in milliseconds.
*
#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
+/**
+ * \brief A variable describing the content orientation on QtWayland-based platforms.
+ *
+ * On QtWayland platforms, windows are rotated client-side to allow for custom
+ * transitions. In order to correctly position overlays (e.g. volume bar) and
+ * gestures (e.g. events view, close/minimize gestures), the system needs to
+ * know in which orientation the application is currently drawing its contents.
+ *
+ * This does not cause the window to be rotated or resized, the application
+ * needs to take care of drawing the content in the right orientation (the
+ * framebuffer is always in portrait mode).
+ *
+ * This variable can be one of the following values:
+ * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape"
+ */
+#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION"
+
+/**
+ * \brief Flags to set on QtWayland windows to integrate with the native window manager.
+ *
+ * On QtWayland platforms, this hint controls the flags to set on the windows.
+ * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures.
+ *
+ * This variable is a space-separated list of the following values (empty = no flags):
+ * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager"
+ */
+#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS"
/**
* \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size
* This is specially useful if you build SDL against a non glibc libc library (such as musl) which
* provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
* Support for this hint is currently available only in the pthread, Windows, and PSP backend.
+*
+* Instead of this hint, in 2.0.9 and later, you can use
+* SDL_CreateThreadWithStackSize(). This hint only works with the classic
+* SDL_CreateThread().
*/
#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE"
*/
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
+/**
+ * \brief A variable to control whether we trap the Android back button to handle it manually.
+ * This is necessary for the right mouse button to work on some Android devices, or
+ * to be able to trap the back button for use in your code reliably. If set to true,
+ * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of
+ * SDL_SCANCODE_AC_BACK.
+ *
+ * The variable can be set to the following values:
+ * "0" - Back button will be handled as usual for system. (default)
+ * "1" - Back button will be trapped, allowing you to handle the key press
+ * manually. (This will also let right mouse click work on systems
+ * where the right mouse button functions as back.)
+ *
+ * The value of this hint is used at runtime, so it can be changed at any time.
+ */
+#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON"
+
+/**
+ * \brief A variable to control whether the event loop will block itself when the app is paused.
+ *
+ * The variable can be set to the following values:
+ * "0" - Non blocking.
+ * "1" - Blocking. (default)
+ *
+ * The value should be set before SDL is initialized.
+ */
+#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE"
+
/**
- * \brief A variable to control whether mouse and touch events are to be treated together or separately
+ * \brief A variable to control whether the return key on the soft keyboard
+ * should hide the soft keyboard on Android and iOS.
*
* The variable can be set to the following values:
- * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse
- * events. This is the behaviour of SDL <= 2.0.3. (default)
- * "1" - Mouse events will be handled separately from pure touch events.
+ * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default)
+ * "1" - The return key will hide the keyboard.
*
* The value of this hint is used at runtime, so it can be changed at any time.
*/
-#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
+#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME"
/**
* \brief override the binding element for keyboard inputs for Emscripten builds
* "0" - SDL will generate a window-close event when it sees Alt+F4.
* "1" - SDL will only do normal key handling for Alt+F4.
*/
-#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
+#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
/**
* \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs.
#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
/**
- * \brief Tell SDL not to name threads on Windows.
+ * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
+ * The 0x406D1388 Exception is a trick used to inform Visual Studio of a
+ * thread's name, but it tends to cause problems with other debuggers,
+ * and the .NET runtime. Note that SDL 2.0.6 and later will still use
+ * the (safer) SetThreadDescription API, introduced in the Windows 10
+ * Creators Update, if available.
*
* The variable can be set to the following values:
* "0" - SDL will raise the 0x406D1388 Exception to name threads.
- * This is the default behavior of SDL <= 2.0.4. (default)
- * "1" - SDL will not raise this exception, and threads will be unnamed.
- * For .NET languages this is required when running under a debugger.
+ * This is the default behavior of SDL <= 2.0.4.
+ * "1" - SDL will not raise this exception, and threads will be unnamed. (default)
+ * This is necessary with .NET languages or debuggers that aren't Visual Studio.
*/
#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
*/
#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER"
+/**
+ * \brief Tell the video driver that we only want a double buffer.
+ *
+ * By default, most lowlevel 2D APIs will use a triple buffer scheme that
+ * wastes no CPU time on waiting for vsync after issuing a flip, but
+ * introduces a frame of latency. On the other hand, using a double buffer
+ * scheme instead is recommended for cases where low latency is an important
+ * factor because we save a whole frame of latency.
+ * We do so by waiting for vsync immediately after issuing a flip, usually just
+ * after eglSwapBuffers call in the backend's *_SwapWindow function.
+ *
+ * Since it's driver-specific, it's only supported where possible and
+ * implemented. Currently supported the following drivers:
+ * - KMSDRM (kmsdrm)
+ * - Raspberry Pi (raspberrypi)
+ */
+#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER"
+
+/**
+ * \brief A variable controlling what driver to use for OpenGL ES contexts.
+ *
+ * On some platforms, currently Windows and X11, OpenGL drivers may support
+ * creating contexts with an OpenGL ES profile. By default SDL uses these
+ * profiles, when available, otherwise it attempts to load an OpenGL ES
+ * library, e.g. that provided by the ANGLE project. This variable controls
+ * whether SDL follows this default behaviour or will always load an
+ * OpenGL ES library.
+ *
+ * Circumstances where this is useful include
+ * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE,
+ * or emulator, e.g. those from ARM, Imagination or Qualcomm.
+ * - Resolving OpenGL ES function addresses at link time by linking with
+ * the OpenGL ES library instead of querying them at run time with
+ * SDL_GL_GetProcAddress().
+ *
+ * Caution: for an application to work with the default behaviour across
+ * different OpenGL drivers it must query the OpenGL ES function
+ * addresses at run time using SDL_GL_GetProcAddress().
+ *
+ * This variable is ignored on most platforms because OpenGL ES is native
+ * or not supported.
+ *
+ * This variable can be set to the following values:
+ * "0" - Use ES profile of OpenGL, if available. (Default when not set.)
+ * "1" - Load OpenGL ES library using the default library names.
+ *
+ */
+#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER"
+
+/**
+ * \brief A variable controlling speed/quality tradeoff of audio resampling.
+ *
+ * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ )
+ * to handle audio resampling. There are different resampling modes available
+ * that produce different levels of quality, using more CPU.
+ *
+ * If this hint isn't specified to a valid setting, or libsamplerate isn't
+ * available, SDL will use the default, internal resampling algorithm.
+ *
+ * Note that this is currently only applicable to resampling audio that is
+ * being written to a device for playback or audio being read from a device
+ * for capture. SDL_AudioCVT always uses the default resampler (although this
+ * might change for SDL 2.1).
+ *
+ * This hint is currently only checked at audio subsystem initialization.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast)
+ * "1" or "fast" - Use fast, slightly higher quality resampling, if available
+ * "2" or "medium" - Use medium quality resampling, if available
+ * "3" or "best" - Use high quality resampling, if available
+ */
+#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE"
+
+/**
+ * \brief A variable controlling the audio category on iOS and Mac OS X
+ *
+ * This variable can be set to the following values:
+ *
+ * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default)
+ * "playback" - Use the AVAudioSessionCategoryPlayback category
+ *
+ * For more information, see Apple's documentation:
+ * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html
+ */
+#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY"
+
+/**
+ * \brief A variable controlling whether the 2D render API is compatible or efficient.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" - Don't use batching to make rendering more efficient.
+ * "1" - Use batching, but might cause problems if app makes its own direct OpenGL calls.
+ *
+ * Up to SDL 2.0.9, the render API would draw immediately when requested. Now
+ * it batches up draw requests and sends them all to the GPU only when forced
+ * to (during SDL_RenderPresent, when changing render targets, by updating a
+ * texture that the batch needs, etc). This is significantly more efficient,
+ * but it can cause problems for apps that expect to render on top of the
+ * render API's output. As such, SDL will disable batching if a specific
+ * render backend is requested (since this might indicate that the app is
+ * planning to use the underlying graphics API directly). This hint can
+ * be used to explicitly request batching in this instance. It is a contract
+ * that you will either never use the underlying graphics API directly, or
+ * if you do, you will call SDL_RenderFlush() before you do so any current
+ * batch goes to the GPU before your work begins. Not following this contract
+ * will result in undefined behavior.
+ */
+#define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING"
+
+
+/**
+ * \brief A variable controlling whether SDL logs all events pushed onto its internal queue.
+ *
+ * This variable can be set to the following values:
+ *
+ * "0" - Don't log any events (default)
+ * "1" - Log all events except mouse and finger motion, which are pretty spammy.
+ * "2" - Log all events.
+ *
+ * This is generally meant to be used to debug SDL itself, but can be useful
+ * for application developers that need better visibility into what is going
+ * on in the event queue. Logged events are sent through SDL_Log(), which
+ * means by default they appear on stdout on most platforms or maybe
+ * OutputDebugString() on Windows, and can be funneled by the app with
+ * SDL_LogSetOutputFunction(), etc.
+ *
+ * This hint can be toggled on and off at runtime, if you only need to log
+ * events for a small subset of program execution.
+ */
+#define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING"
+
+
+
+/**
+ * \brief Controls how the size of the RIFF chunk affects the loading of a WAVE file.
+ *
+ * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE
+ * file) is not always reliable. In case the size is wrong, it's possible to
+ * just ignore it and step through the chunks until a fixed limit is reached.
+ *
+ * Note that files that have trailing data unrelated to the WAVE file or
+ * corrupt files may slow down the loading process without a reliable boundary.
+ * By default, SDL stops after 10000 chunks to prevent wasting time. Use the
+ * environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value.
+ *
+ * This variable can be set to the following values:
+ *
+ * "force" - Always use the RIFF chunk size as a boundary for the chunk search
+ * "ignorezero" - Like "force", but a zero size searches up to 4 GiB (default)
+ * "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB
+ * "maximum" - Search for chunks until the end of file (not recommended)
+ */
+#define SDL_HINT_WAVE_RIFF_CHUNK_SIZE "SDL_WAVE_RIFF_CHUNK_SIZE"
+
+/**
+ * \brief Controls how a truncated WAVE file is handled.
+ *
+ * A WAVE file is considered truncated if any of the chunks are incomplete or
+ * the data chunk size is not a multiple of the block size. By default, SDL
+ * decodes until the first incomplete block, as most applications seem to do.
+ *
+ * This variable can be set to the following values:
+ *
+ * "verystrict" - Raise an error if the file is truncated
+ * "strict" - Like "verystrict", but the size of the RIFF chunk is ignored
+ * "dropframe" - Decode until the first incomplete sample frame
+ * "dropblock" - Decode until the first incomplete block (default)
+ */
+#define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION"
+
+/**
+ * \brief Controls how the fact chunk affects the loading of a WAVE file.
+ *
+ * The fact chunk stores information about the number of samples of a WAVE
+ * file. The Standards Update from Microsoft notes that this value can be used
+ * to 'determine the length of the data in seconds'. This is especially useful
+ * for compressed formats (for which this is a mandatory chunk) if they produce
+ * multiple sample frames per block and truncating the block is not allowed.
+ * The fact chunk can exactly specify how many sample frames there should be
+ * in this case.
+ *
+ * Unfortunately, most application seem to ignore the fact chunk and so SDL
+ * ignores it by default as well.
+ *
+ * This variable can be set to the following values:
+ *
+ * "truncate" - Use the number of samples to truncate the wave data if
+ * the fact chunk is present and valid
+ * "strict" - Like "truncate", but raise an error if the fact chunk
+ * is invalid, not present for non-PCM formats, or if the
+ * data chunk doesn't have that many samples
+ * "ignorezero" - Like "truncate", but ignore fact chunk if the number of
+ * samples is zero
+ * "ignore" - Ignore fact chunk entirely (default)
+ */
+#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK"
+
/**
* \brief An enumeration of hint priorities
*/
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value);
+/**
+ * \brief type definition of the hint callback function.
+ */
+typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
+
/**
* \brief Add a function to watch a particular hint
*
* \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);
#endif
#include "close_code.h"
-#endif /* _SDL_hints_h */
+#endif /* SDL_hints_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
*
*/
-#ifndef _SDL_joystick_h
-#define _SDL_joystick_h
+#ifndef SDL_joystick_h_
+#define SDL_joystick_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/
-/* The joystick structure used to identify an SDL joystick */
+/**
+ * The joystick structure used to identify an SDL joystick
+ */
struct _SDL_Joystick;
typedef struct _SDL_Joystick SDL_Joystick;
Uint8 data[16];
} SDL_JoystickGUID;
+/**
+ * This is a unique ID for a joystick for the time it is connected to the system,
+ * and is never reused for the lifetime of the application. If the joystick is
+ * disconnected and reconnected, it will get a new ID.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
typedef Sint32 SDL_JoystickID;
+typedef enum
+{
+ SDL_JOYSTICK_TYPE_UNKNOWN,
+ SDL_JOYSTICK_TYPE_GAMECONTROLLER,
+ SDL_JOYSTICK_TYPE_WHEEL,
+ SDL_JOYSTICK_TYPE_ARCADE_STICK,
+ SDL_JOYSTICK_TYPE_FLIGHT_STICK,
+ SDL_JOYSTICK_TYPE_DANCE_PAD,
+ SDL_JOYSTICK_TYPE_GUITAR,
+ SDL_JOYSTICK_TYPE_DRUM_KIT,
+ SDL_JOYSTICK_TYPE_ARCADE_PAD,
+ SDL_JOYSTICK_TYPE_THROTTLE
+} SDL_JoystickType;
+
typedef enum
{
SDL_JOYSTICK_POWER_UNKNOWN = -1,
- SDL_JOYSTICK_POWER_EMPTY,
- SDL_JOYSTICK_POWER_LOW,
- SDL_JOYSTICK_POWER_MEDIUM,
- SDL_JOYSTICK_POWER_FULL,
+ SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */
+ SDL_JOYSTICK_POWER_LOW, /* <= 20% */
+ SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */
+ SDL_JOYSTICK_POWER_FULL, /* <= 100% */
SDL_JOYSTICK_POWER_WIRED,
SDL_JOYSTICK_POWER_MAX
} SDL_JoystickPowerLevel;
/* Function prototypes */
+
+/**
+ * Locking for multi-threaded access to the joystick API
+ *
+ * If you are using the joystick API or handling events from multiple threads
+ * you should use these locking functions to protect access to the joysticks.
+ *
+ * In particular, you are guaranteed that the joystick list won't change, so
+ * the API functions that take a joystick index will be valid, and joystick
+ * and game controller events will not be delivered.
+ */
+extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
+extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
+
/**
* Count the number of joysticks attached to the system right now
*/
*/
extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
+/**
+ * Get the player index of a joystick, or -1 if it's not available
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
+
+/**
+ * Return the GUID for the joystick at this index
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+
+/**
+ * Get the USB vendor ID of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
+
+/**
+ * Get the USB product ID of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
+
+/**
+ * Get the product version of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
+
+/**
+ * Get the type of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index);
+
+/**
+ * Get the instance ID of a joystick.
+ * This can be called before any joysticks are opened.
+ * If the index is out of range, this function will return -1.
+ */
+extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index);
+
/**
* Open a joystick for use.
* The index passed as an argument refers to the N'th joystick on the system.
extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
/**
- * Return the GUID for the joystick at this index
+ * Get the player index of an opened joystick, or -1 if it's not available
+ *
+ * For XInput controllers this returns the XInput user index.
*/
-extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index);
+extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick);
/**
* Return the GUID for this opened joystick
*/
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick);
+/**
+ * Get the USB vendor ID of an opened joystick, if available.
+ * If the vendor ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick);
+
+/**
+ * Get the USB product ID of an opened joystick, if available.
+ * If the product ID isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
+
+/**
+ * Get the product version of an opened joystick, if available.
+ * If the product version isn't available this function returns 0.
+ */
+extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
+
+/**
+ * Get the type of an opened joystick.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(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 SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
/**
- * convert a string into a joystick formatted guid
+ * Convert a string into a joystick guid
*/
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
*/
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
+#define SDL_JOYSTICK_AXIS_MAX 32767
+#define SDL_JOYSTICK_AXIS_MIN -32768
/**
* Get the current state of an axis control on a joystick.
*
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
int axis);
+/**
+ * Get the initial 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.
+ *
+ * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick,
+ int axis, Sint16 *state);
+
/**
* \name Hat positions
*/
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
int button);
+/**
+ * Trigger a rumble effect
+ * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
+ *
+ * \param joystick The joystick to vibrate
+ * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF
+ * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
+ * \param duration_ms The duration of the rumble effect, in milliseconds
+ *
+ * \return 0, or -1 if rumble isn't supported on this joystick
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
+
/**
* Close a joystick previously opened with SDL_JoystickOpen().
*/
#endif
#include "close_code.h"
-#endif /* _SDL_joystick_h */
+#endif /* SDL_joystick_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL keyboard event handling
*/
-#ifndef _SDL_keyboard_h
-#define _SDL_keyboard_h
+#ifndef SDL_keyboard_h_
+#define SDL_keyboard_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
#include "close_code.h"
-#endif /* _SDL_keyboard_h */
+#endif /* SDL_keyboard_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Defines constants which identify keyboard keys and modifiers.
*/
-#ifndef _SDL_keycode_h
-#define _SDL_keycode_h
+#ifndef SDL_keycode_h_
+#define SDL_keycode_h_
#include "SDL_stdinc.h"
#include "SDL_scancode.h"
* 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.
+ *
+ * A special exception is the number keys at the top of the keyboard which
+ * always map to SDLK_0...SDLK_9, regardless of layout.
*/
typedef Sint32 SDL_Keycode;
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)
+ SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
+ SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
+ SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
+
+ SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
+ SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
};
/**
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
-#endif /* _SDL_keycode_h */
+#endif /* SDL_keycode_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* the results you expect. :)
*/
-#ifndef _SDL_loadso_h
-#define _SDL_loadso_h
+#ifndef SDL_loadso_h_
+#define SDL_loadso_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
#include "close_code.h"
-#endif /* _SDL_loadso_h */
+#endif /* SDL_loadso_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Others: standard error output (stderr)
*/
-#ifndef _SDL_log_h
-#define _SDL_log_h
+#ifndef SDL_log_h_
+#define SDL_log_h_
#include "SDL_stdinc.h"
/**
* \brief The prototype for the log output function
*/
-typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
+typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
/**
* \brief Get the current log output function.
#endif
#include "close_code.h"
-#endif /* _SDL_log_h */
+#endif /* SDL_log_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_main_h
-#define _SDL_main_h
+#ifndef SDL_main_h_
+#define SDL_main_h_
#include "SDL_stdinc.h"
/* On iOS SDL provides a main function that creates an application delegate
and starts the iOS application run loop.
+ If you link with SDL dynamically on iOS, the main function can't be in a
+ shared library, so you need to link with libSDLmain.a, which includes a
+ stub main function that calls into the shared library to start execution.
+
See src/video/uikit/SDL_uikitappdelegate.m for more details.
*/
#define SDL_MAIN_NEEDED
/* On Android SDL provides a Java class in SDLActivity.java that is the
main activity entry point.
- See README-android.md for more details on extending that class.
+ See docs/README-android.md for more details on extending that class.
*/
#define SDL_MAIN_NEEDED
+/* We need to export SDL_main so it can be launched from Java */
+#define SDLMAIN_DECLSPEC DECLSPEC
+
#elif defined(__NACL__)
/* On NACL we use ppapi_simple to set up the application helper code,
then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before
#endif
#endif /* SDL_MAIN_HANDLED */
-#ifdef __cplusplus
-#define C_LINKAGE "C"
-#else
-#define C_LINKAGE
-#endif /* __cplusplus */
+#ifndef SDLMAIN_DECLSPEC
+#define SDLMAIN_DECLSPEC
+#endif
/**
* \file SDL_main.h
#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
+/**
+ * The prototype for the application's main() function
+ */
+typedef int (*SDL_main_func)(int argc, char *argv[]);
+extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
+
+
/**
* This is called by the real SDL main function to let the rest of the
* library know that initialization was done properly.
/**
* 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 int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#endif /* __WIN32__ */
* \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
* information on the failure.
*/
-extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved);
+extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved);
#endif /* __WINRT__ */
+#if defined(__IPHONEOS__)
+
+/**
+ * \brief Initializes and launches an SDL application.
+ *
+ * \param argc The argc parameter from the application's main() function
+ * \param argv The argv parameter from the application's main() function
+ * \param mainFunction The SDL app's C-style main().
+ * \return the return value from mainFunction
+ */
+extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction);
+
+#endif /* __IPHONEOS__ */
+
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_main_h */
+#endif /* SDL_main_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_messagebox_h
-#define _SDL_messagebox_h
+#ifndef SDL_messagebox_h_
+#define SDL_messagebox_h_
#include "SDL_stdinc.h"
#include "SDL_video.h" /* For SDL_Window */
#endif
#include "close_code.h"
-#endif /* _SDL_messagebox_h */
+#endif /* SDL_messagebox_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL mouse event handling.
*/
-#ifndef _SDL_mouse_h
-#define _SDL_mouse_h
+#ifndef SDL_mouse_h_
+#define SDL_mouse_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
extern "C" {
#endif
-typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */
+typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
/**
* \brief Cursor types for SDL_CreateSystemCursor().
#endif
#include "close_code.h"
-#endif /* _SDL_mouse_h */
+#endif /* SDL_mouse_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_mutex_h
-#define _SDL_mutex_h
+#ifndef SDL_mutex_h_
+#define SDL_mutex_h_
/**
* \file SDL_mutex.h
#endif
#include "close_code.h"
-#endif /* _SDL_mutex_h */
+#endif /* SDL_mutex_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDLname_h_
-#define _SDLname_h_
+#ifndef SDLname_h_
+#define SDLname_h_
#if defined(__STDC__) || defined(__cplusplus)
#define NeedFunctionPrototypes 1
#define SDL_NAME(X) SDL_##X
-#endif /* _SDLname_h_ */
+#endif /* SDLname_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* version included in SDL_opengl.h.
*/
-#ifndef _SDL_opengl_h
-#define _SDL_opengl_h
+#ifndef SDL_opengl_h_
+#define SDL_opengl_h_
#include "SDL_config.h"
#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
# define GLAPI extern
# define GLAPIENTRY __stdcall
+#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */
+# define GLAPI extern
+# define GLAPIENTRY _System
+# define APIENTRY _System
+# if defined(__GNUC__) && !defined(_System)
+# define _System
+# endif
#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
# define GLAPI __attribute__((visibility("default")))
# define GLAPIENTRY
#endif /* !__IPHONEOS__ */
-#endif /* _SDL_opengl_h */
+#endif /* SDL_opengl_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header for the enumerated pixel format definitions.
*/
-#ifndef _SDL_pixels_h
-#define _SDL_pixels_h
+#ifndef SDL_pixels_h_
+#define SDL_pixels_h_
#include "SDL_stdinc.h"
#include "SDL_endian.h"
((format) && (SDL_PIXELFLAG(format) != 1))
/* Note: If you modify this list, update SDL_GetPixelFormatName() */
-enum
+typedef enum
{
SDL_PIXELFORMAT_UNKNOWN,
SDL_PIXELFORMAT_INDEX1LSB =
SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
- SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1')
-};
+ SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
+ SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
+ SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
+} SDL_PixelFormatEnum;
typedef struct SDL_Color
{
#endif
#include "close_code.h"
-#endif /* _SDL_pixels_h */
+#endif /* SDL_pixels_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Try to get a standard set of platform defines.
*/
-#ifndef _SDL_platform_h
-#define _SDL_platform_h
+#ifndef SDL_platform_h_
+#define SDL_platform_h_
#if defined(_AIX)
#undef __AIX__
#undef __OPENBSD__
#define __OPENBSD__ 1
#endif
-#if defined(__OS2__)
+#if defined(__OS2__) || defined(__EMX__)
#undef __OS2__
#define __OS2__ 1
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT or non-WinRT */
-/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
-#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */
+#if defined(_MSC_VER) && defined(__has_include)
+#if __has_include(<winapifamily.h>)
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
+#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
+#define HAVE_WINAPIFAMILY_H 1
+#else
+#define HAVE_WINAPIFAMILY_H 0
+#endif
+
+#if HAVE_WINAPIFAMILY_H
#include <winapifamily.h>
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#undef __WINDOWS__
-#define __WINDOWS__ 1
-/* See if we're compiling for WinRT: */
-#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
+#else
+#define WINAPI_FAMILY_WINRT 0
+#endif /* HAVE_WINAPIFAMILY_H */
+
+#if WINAPI_FAMILY_WINRT
#undef __WINRT__
#define __WINRT__ 1
-#endif
#else
#undef __WINDOWS__
-#define __WINDOWS__ 1
-#endif /* _MSC_VER < 1700 */
+#define __WINDOWS__ 1
+#endif
#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
#if defined(__WINDOWS__)
#endif
#include "close_code.h"
-#endif /* _SDL_platform_h */
+#endif /* SDL_platform_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_power_h
-#define _SDL_power_h
+#ifndef SDL_power_h_
+#define SDL_power_h_
/**
* \file SDL_power.h
#endif
#include "close_code.h"
-#endif /* _SDL_power_h */
+#endif /* SDL_power_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL quit event handling.
*/
-#ifndef _SDL_quit_h
-#define _SDL_quit_h
+#ifndef SDL_quit_h_
+#define SDL_quit_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#define SDL_QuitRequested() \
(SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
-#endif /* _SDL_quit_h */
+#endif /* SDL_quit_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file for SDL_rect definition and management functions.
*/
-#ifndef _SDL_rect_h
-#define _SDL_rect_h
+#ifndef SDL_rect_h_
+#define SDL_rect_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
/**
- * \brief The structure that defines a point
+ * \brief The structure that defines a point (integer)
*
* \sa SDL_EnclosePoints
* \sa SDL_PointInRect
} SDL_Point;
/**
- * \brief A rectangle, with the origin at the upper left.
+ * \brief The structure that defines a point (floating point)
+ *
+ * \sa SDL_EnclosePoints
+ * \sa SDL_PointInRect
+ */
+typedef struct SDL_FPoint
+{
+ float x;
+ float y;
+} SDL_FPoint;
+
+
+/**
+ * \brief A rectangle, with the origin at the upper left (integer).
*
* \sa SDL_RectEmpty
* \sa SDL_RectEquals
int w, h;
} SDL_Rect;
+
+/**
+ * \brief A rectangle, with the origin at the upper left (floating point).
+ */
+typedef struct SDL_FRect
+{
+ float x;
+ float y;
+ float w;
+ float h;
+} SDL_FRect;
+
+
/**
* \brief Returns true if point resides inside a rectangle.
*/
#endif
#include "close_code.h"
-#endif /* _SDL_rect_h */
+#endif /* SDL_rect_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
*/
-#ifndef _SDL_render_h
-#define _SDL_render_h
+#ifndef SDL_render_h_
+#define SDL_render_h_
#include "SDL_stdinc.h"
#include "SDL_rect.h"
* active, the format was unsupported, or the width or height were out
* of range.
*
+ * \note The contents of the texture are not defined at creation.
+ *
* \sa SDL_QueryTexture()
* \sa SDL_UpdateTexture()
* \sa SDL_DestroyTexture()
* \param texture The texture to update
* \param rect A pointer to the rectangle of pixels to update, or NULL to
* update the entire texture.
- * \param pixels The raw pixel data.
+ * \param pixels The raw pixel data in the format of the texture.
* \param pitch The number of bytes in a row of pixel data, including padding between lines.
*
+ * The pixel data must be in the format of the texture. The pixel format can be
+ * queried with SDL_QueryTexture.
+ *
* \return 0 on success, or -1 if the texture is not valid.
*
* \note This is a fairly slow function.
* texture.
* \param dstrect A pointer to the destination rectangle, or NULL for the
* entire rendering target.
- * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect
+ * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
* \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
* \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
*
const SDL_Point *center,
const SDL_RendererFlip flip);
+
+/**
+ * \brief Draw a point on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a point.
+ * \param x The x coordinate of the point.
+ * \param y The y coordinate of the point.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer,
+ float x, float y);
+
+/**
+ * \brief Draw multiple points on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple points.
+ * \param points The points to draw
+ * \param count The number of points to draw
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer,
+ const SDL_FPoint * points,
+ int count);
+
+/**
+ * \brief Draw a line on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a line.
+ * \param x1 The x coordinate of the start point.
+ * \param y1 The y coordinate of the start point.
+ * \param x2 The x coordinate of the end point.
+ * \param y2 The y coordinate of the end point.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer,
+ float x1, float y1, float x2, float y2);
+
+/**
+ * \brief Draw a series of connected lines on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple lines.
+ * \param points The points along the lines
+ * \param count The number of points, drawing count-1 lines
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer,
+ const SDL_FPoint * points,
+ int count);
+
+/**
+ * \brief Draw a rectangle on the current rendering target.
+ *
+ * \param renderer The renderer which should draw a rectangle.
+ * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer,
+ const SDL_FRect * rect);
+
+/**
+ * \brief Draw some number of rectangles on the current rendering target.
+ *
+ * \param renderer The renderer which should draw multiple rectangles.
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer,
+ const SDL_FRect * rects,
+ int count);
+
+/**
+ * \brief Fill a rectangle on the current rendering target with the drawing color.
+ *
+ * \param renderer The renderer which should fill a rectangle.
+ * \param rect A pointer to the destination rectangle, or NULL for the entire
+ * rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer,
+ const SDL_FRect * rect);
+
+/**
+ * \brief Fill some number of rectangles on the current rendering target with the drawing color.
+ *
+ * \param renderer The renderer which should fill multiple rectangles.
+ * \param rects A pointer to an array of destination rectangles.
+ * \param count The number of rectangles.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer,
+ const SDL_FRect * rects,
+ int count);
+
+/**
+ * \brief Copy a portion of the texture to the current rendering target.
+ *
+ * \param renderer The renderer which should copy parts of a texture.
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_FRect * dstrect);
+
+/**
+ * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
+ *
+ * \param renderer The renderer which should copy parts of a texture.
+ * \param texture The source texture.
+ * \param srcrect A pointer to the source rectangle, or NULL for the entire
+ * texture.
+ * \param dstrect A pointer to the destination rectangle, or NULL for the
+ * entire rendering target.
+ * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
+ * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
+ * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
+ *
+ * \return 0 on success, or -1 on error
+ */
+extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
+ SDL_Texture * texture,
+ const SDL_Rect * srcrect,
+ const SDL_FRect * dstrect,
+ const double angle,
+ const SDL_FPoint *center,
+ const SDL_RendererFlip flip);
+
/**
* \brief Read pixels from the current rendering target.
*
*/
extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
+/**
+ * \brief Force the rendering context to flush any pending commands to the
+ * underlying rendering API.
+ *
+ * You do not need to (and in fact, shouldn't) call this function unless
+ * you are planning to call into OpenGL/Direct3D/Metal/whatever directly
+ * in addition to using an SDL_Renderer.
+ *
+ * This is for a very-specific case: if you are using SDL's render API,
+ * you asked for a specific renderer backend (OpenGL, Direct3D, etc),
+ * you set SDL_HINT_RENDER_BATCHING to "1", and you plan to make
+ * OpenGL/D3D/whatever calls in addition to SDL render API calls. If all of
+ * this applies, you should call SDL_RenderFlush() between calls to SDL's
+ * render API and the low-level API you're using in cooperation.
+ *
+ * In all other cases, you can ignore this function. This is only here to
+ * get maximum performance out of a specific situation. In all other cases,
+ * SDL will do the right thing, perhaps at a performance loss.
+ *
+ * This function is first available in SDL 2.0.10, and is not needed in
+ * 2.0.9 and earlier, as earlier versions did not queue rendering commands
+ * at all, instead flushing them to the OS immediately.
+ */
+extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer * renderer);
+
/**
* \brief Bind the texture to the current OpenGL/ES/ES2 context for use with
*/
extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
+/**
+ * \brief Get the CAMetalLayer associated with the given Metal renderer
+ *
+ * \param renderer The renderer to query
+ *
+ * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer
+ *
+ * \sa SDL_RenderGetMetalCommandEncoder()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer);
+
+/**
+ * \brief Get the Metal command encoder for the current frame
+ *
+ * \param renderer The renderer to query
+ *
+ * \return id<MTLRenderCommandEncoder> on success, or NULL if the renderer isn't a Metal renderer
+ *
+ * \sa SDL_RenderGetMetalLayer()
+ */
+extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
#endif
#include "close_code.h"
-#endif /* _SDL_render_h */
+#endif /* SDL_render_h_ */
/* vi: set ts=4 sw=4 expandtab: */
-#define SDL_REVISION "hg-10556:007dfe83abf8"
-#define SDL_REVISION_NUMBER 10556
+#define SDL_REVISION "hg-12952:bc90ce38f1e2"
+#define SDL_REVISION_NUMBER 12952
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* data streams. It can easily be extended to files, memory, etc.
*/
-#ifndef _SDL_rwops_h
-#define _SDL_rwops_h
+#ifndef SDL_rwops_h_
+#define SDL_rwops_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
#endif
/* RWops Types */
-#define SDL_RWOPS_UNKNOWN 0U /* Unknown stream type */
-#define SDL_RWOPS_WINFILE 1U /* Win32 file */
-#define SDL_RWOPS_STDFILE 2U /* Stdio file */
-#define SDL_RWOPS_JNIFILE 3U /* Android asset */
-#define SDL_RWOPS_MEMORY 4U /* Memory stream */
-#define SDL_RWOPS_MEMORY_RO 5U /* Read-Only memory stream */
+#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */
+#define SDL_RWOPS_WINFILE 1U /**< Win32 file */
+#define SDL_RWOPS_STDFILE 2U /**< Stdio file */
+#define SDL_RWOPS_JNIFILE 3U /**< Android asset */
+#define SDL_RWOPS_MEMORY 4U /**< Memory stream */
+#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */
/**
* This is the read/write operation structure -- very basic.
#define RW_SEEK_END 2 /**< Seek relative to the end of data */
/**
- * \name Read/write macros
+ * Return the size of the file in this rwops, or -1 if unknown
+ */
+extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
+
+/**
+ * Seek to \c offset relative to \c whence, one of stdio's whence values:
+ * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
*
- * Macros to easily read and write from an SDL_RWops structure.
+ * \return the final offset in the data stream, or -1 on error.
*/
-/* @{ */
-#define SDL_RWsize(ctx) (ctx)->size(ctx)
-#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
-#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
-#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
-#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
-#define SDL_RWclose(ctx) (ctx)->close(ctx)
-/* @} *//* Read/write macros */
+extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context,
+ Sint64 offset, int whence);
+
+/**
+ * Return the current offset in the data stream, or -1 on error.
+ */
+extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context);
+
+/**
+ * Read up to \c maxnum objects each of size \c size from the data
+ * stream to the area pointed at by \c ptr.
+ *
+ * \return the number of objects read, or 0 at error or end of file.
+ */
+extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context,
+ void *ptr, size_t size, size_t maxnum);
+
+/**
+ * Write exactly \c num objects each of size \c size from the area
+ * pointed at by \c ptr to data stream.
+ *
+ * \return the number of objects written, or 0 at error or end of file.
+ */
+extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context,
+ const void *ptr, size_t size, size_t num);
+
+/**
+ * Close and free an allocated SDL_RWops structure.
+ *
+ * \return 0 if successful or -1 on write error when flushing data.
+ */
+extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context);
+/**
+ * Load all the data from an SDL data stream.
+ *
+ * The data is allocated with a zero byte at the end (null terminated)
+ *
+ * If \c datasize is not NULL, it is filled with the size of the data read.
+ *
+ * If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ * The data should be freed with SDL_free().
+ *
+ * \return the data, or NULL if there was an error.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize,
+ int freesrc);
+
+/**
+ * Load an entire file.
+ *
+ * The data is allocated with a zero byte at the end (null terminated)
+ *
+ * If \c datasize is not NULL, it is filled with the size of the data read.
+ *
+ * If \c freesrc is non-zero, the stream will be closed after being read.
+ *
+ * The data should be freed with SDL_free().
+ *
+ * \return the data, or NULL if there was an error.
+ */
+extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
/**
* \name Read endian functions
#endif
#include "close_code.h"
-#endif /* _SDL_rwops_h */
+#endif /* SDL_rwops_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Defines keyboard scancodes.
*/
-#ifndef _SDL_scancode_h
-#define _SDL_scancode_h
+#ifndef SDL_scancode_h_
+#define SDL_scancode_h_
#include "SDL_stdinc.h"
* SDL_Event structure.
*
* The values in this enumeration are based on the USB usage page standard:
- * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
+ * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
*/
typedef enum
{
/* @} *//* Walther keys */
+ /**
+ * \name Usage page 0x0C (additional media keys)
+ *
+ * These values are mapped from usage page 0x0C (USB consumer page).
+ */
+ /* @{ */
+
+ SDL_SCANCODE_AUDIOREWIND = 285,
+ SDL_SCANCODE_AUDIOFASTFORWARD = 286,
+
+ /* @} *//* Usage page 0x0C (additional media keys) */
+
/* Add any other keys here. */
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
for array bounds */
} SDL_Scancode;
-#endif /* _SDL_scancode_h */
+#endif /* SDL_scancode_h_ */
/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2019 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_sensor.h
+ *
+ * Include file for SDL sensor event handling
+ *
+ */
+
+#ifndef SDL_sensor_h_
+#define SDL_sensor_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
+/* *INDENT-OFF* */
+extern "C" {
+/* *INDENT-ON* */
+#endif
+
+/**
+ * \brief SDL_sensor.h
+ *
+ * In order to use these functions, SDL_Init() must have been called
+ * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system
+ * for sensors, and load appropriate drivers.
+ */
+
+struct _SDL_Sensor;
+typedef struct _SDL_Sensor SDL_Sensor;
+
+/**
+ * This is a unique ID for a sensor for the time it is connected to the system,
+ * and is never reused for the lifetime of the application.
+ *
+ * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
+ */
+typedef Sint32 SDL_SensorID;
+
+/* The different sensors defined by SDL
+ *
+ * Additional sensors may be available, using platform dependent semantics.
+ *
+ * Hare are the additional Android sensors:
+ * https://developer.android.com/reference/android/hardware/SensorEvent.html#values
+ */
+typedef enum
+{
+ SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */
+ SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */
+ SDL_SENSOR_ACCEL, /**< Accelerometer */
+ SDL_SENSOR_GYRO /**< Gyroscope */
+} SDL_SensorType;
+
+/**
+ * Accelerometer sensor
+ *
+ * The accelerometer returns the current acceleration in SI meters per
+ * second squared. This includes gravity, so a device at rest will have
+ * an acceleration of SDL_STANDARD_GRAVITY straight down.
+ *
+ * values[0]: Acceleration on the x axis
+ * values[1]: Acceleration on the y axis
+ * values[2]: Acceleration on the z axis
+ *
+ * For phones held in portrait mode, the axes are defined as follows:
+ * -X ... +X : left ... right
+ * -Y ... +Y : bottom ... top
+ * -Z ... +Z : farther ... closer
+ *
+ * The axis data is not changed when the phone is rotated.
+ *
+ * \sa SDL_GetDisplayOrientation()
+ */
+#define SDL_STANDARD_GRAVITY 9.80665f
+
+/**
+ * Gyroscope sensor
+ *
+ * The gyroscope returns the current rate of rotation in radians per second.
+ * The rotation is positive in the counter-clockwise direction. That is,
+ * an observer looking from a positive location on one of the axes would
+ * see positive rotation on that axis when it appeared to be rotating
+ * counter-clockwise.
+ *
+ * values[0]: Angular speed around the x axis
+ * values[1]: Angular speed around the y axis
+ * values[2]: Angular speed around the z axis
+ *
+ * For phones held in portrait mode, the axes are defined as follows:
+ * -X ... +X : left ... right
+ * -Y ... +Y : bottom ... top
+ * -Z ... +Z : farther ... closer
+ *
+ * The axis data is not changed when the phone is rotated.
+ *
+ * \sa SDL_GetDisplayOrientation()
+ */
+
+/* Function prototypes */
+
+/**
+ * \brief Count the number of sensors attached to the system right now
+ */
+extern DECLSPEC int SDLCALL SDL_NumSensors(void);
+
+/**
+ * \brief Get the implementation dependent name of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor name, or NULL if device_index is out of range.
+ */
+extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
+
+/**
+ * \brief Get the type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range.
+ */
+extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index);
+
+/**
+ * \brief Get the platform dependent type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor platform dependent type, or -1 if device_index is out of range.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index);
+
+/**
+ * \brief Get the instance ID of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor instance ID, or -1 if device_index is out of range.
+ */
+extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index);
+
+/**
+ * \brief Open a sensor for use.
+ *
+ * The index passed as an argument refers to the N'th sensor on the system.
+ *
+ * \return A sensor identifier, or NULL if an error occurred.
+ */
+extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
+
+/**
+ * Return the SDL_Sensor associated with an instance id.
+ */
+extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id);
+
+/**
+ * \brief Get the implementation dependent name of a sensor.
+ *
+ * \return The sensor name, or NULL if the sensor is NULL.
+ */
+extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
+
+/**
+ * \brief Get the type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL.
+ */
+extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
+
+/**
+ * \brief Get the platform dependent type of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor platform dependent type, or -1 if the sensor is NULL.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
+
+/**
+ * \brief Get the instance ID of a sensor.
+ *
+ * This can be called before any sensors are opened.
+ *
+ * \return The sensor instance ID, or -1 if the sensor is NULL.
+ */
+extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor);
+
+/**
+ * Get the current state of an opened sensor.
+ *
+ * The number of values and interpretation of the data is sensor dependent.
+ *
+ * \param sensor The sensor to query
+ * \param data A pointer filled with the current sensor state
+ * \param num_values The number of values to write to data
+ *
+ * \return 0 or -1 if an error occurred.
+ */
+extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values);
+
+/**
+ * Close a sensor previously opened with SDL_SensorOpen()
+ */
+extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor);
+
+/**
+ * Update the current state of the open sensors.
+ *
+ * This is called automatically by the event loop if sensor events are enabled.
+ *
+ * This needs to be called from the thread that initialized the sensor subsystem.
+ */
+extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
+
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+/* *INDENT-OFF* */
+}
+/* *INDENT-ON* */
+#endif
+#include "close_code.h"
+
+#endif /* SDL_sensor_h_ */
+
+/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_shape_h
-#define _SDL_shape_h
+#ifndef SDL_shape_h_
+#define SDL_shape_h_
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
* \param window The window to query for being shaped.
*
* \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
+ *
* \sa SDL_CreateShapedWindow
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window);
/** \brief A union containing parameters for shaped windows. */
typedef union {
- /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */
+ /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */
Uint8 binarizationCutoff;
SDL_Color colorKey;
} SDL_WindowShapeParams;
* \param shape A surface encoding the desired shape for the window.
* \param shape_mode The parameters to set for the shaped window.
*
- * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
- * if the SDL_Window* given does not reference a valid shaped window.
+ * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
+ * if the SDL_Window given does not reference a valid shaped window.
*
* \sa SDL_WindowShapeMode
* \sa SDL_GetShapedWindowMode.
*
* \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
* data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
- * the SDL_Window* given is a shapeable window currently lacking a shape.
+ * the SDL_Window given is a shapeable window currently lacking a shape.
*
* \sa SDL_WindowShapeMode
* \sa SDL_SetWindowShape
#endif
#include "close_code.h"
-#endif /* _SDL_shape_h */
+#endif /* SDL_shape_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* This is a general header that includes C language support.
*/
-#ifndef _SDL_stdinc_h
-#define _SDL_stdinc_h
+#ifndef SDL_stdinc_h_
+#define SDL_stdinc_h_
#include "SDL_config.h"
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#elif defined(HAVE_STDINT_H)
#ifdef HAVE_FLOAT_H
# include <float.h>
#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
/**
* The number of elements in an array.
*/
/* @{ */
+#ifdef __CC_ARM
+/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
+#define SDL_FALSE 0
+#define SDL_TRUE 1
+typedef int SDL_bool;
+#else
typedef enum
{
SDL_FALSE = 0,
SDL_TRUE = 1
} SDL_bool;
+#endif
/**
* \brief A signed 8-bit integer type.
*/
+#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
+#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
typedef int8_t Sint8;
/**
* \brief An unsigned 8-bit integer type.
*/
+#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
+#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
typedef uint8_t Uint8;
/**
* \brief A signed 16-bit integer type.
*/
+#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
+#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
typedef int16_t Sint16;
/**
* \brief An unsigned 16-bit integer type.
*/
+#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
+#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
typedef uint16_t Uint16;
/**
* \brief A signed 32-bit integer type.
*/
+#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
+#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
typedef int32_t Sint32;
/**
* \brief An unsigned 32-bit integer type.
*/
+#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
+#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
typedef uint32_t Uint32;
/**
* \brief A signed 64-bit integer type.
*/
+#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
+#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
typedef int64_t Sint64;
/**
* \brief An unsigned 64-bit integer type.
*/
+#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
+#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
typedef uint64_t Uint64;
/* @} *//* Basic data types */
#endif /* SDL_DISABLE_ANALYZE_MACROS */
#define SDL_COMPILE_TIME_ASSERT(name, x) \
- typedef int SDL_dummy_ ## name[(x) * 2 - 1]
+ typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
extern "C" {
#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)
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
extern DECLSPEC void SDLCALL SDL_free(void *mem);
+typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
+typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
+typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
+typedef void (SDLCALL *SDL_free_func)(void *mem);
+
+/**
+ * \brief Get the current set of SDL memory functions
+ */
+extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
+ SDL_calloc_func *calloc_func,
+ SDL_realloc_func *realloc_func,
+ SDL_free_func *free_func);
+
+/**
+ * \brief Replace SDL's memory allocation functions with a custom set
+ *
+ * \note If you are replacing SDL's memory functions, you should call
+ * SDL_GetNumAllocations() and be very careful if it returns non-zero.
+ * That means that your free function will be called with memory
+ * allocated by the previous memory allocation functions.
+ */
+extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
+ SDL_calloc_func calloc_func,
+ SDL_realloc_func realloc_func,
+ SDL_free_func free_func);
+
+/**
+ * \brief Get the number of outstanding (unfreed) allocations
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
+
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
return;
switch (dwords % 4)
{
- case 0: do { *_p++ = _val;
- case 3: *_p++ = _val;
- case 2: *_p++ = _val;
- case 1: *_p++ = _val;
+ case 0: do { *_p++ = _val; /* fallthrough */
+ case 3: *_p++ = _val; /* fallthrough */
+ case 2: *_p++ = _val; /* fallthrough */
+ case 1: *_p++ = _val; /* fallthrough */
} while ( --_n );
}
#endif
}
-
extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
+extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
+extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
#ifndef HAVE_M_PI
#ifndef M_PI
-#define M_PI 3.14159265358979323846264338327950288 /* pi */
+#define M_PI 3.14159265358979323846264338327950288 /**< pi */
#endif
#endif
extern DECLSPEC double SDLCALL SDL_acos(double x);
+extern DECLSPEC float SDLCALL SDL_acosf(float x);
extern DECLSPEC double SDLCALL SDL_asin(double x);
+extern DECLSPEC float SDLCALL SDL_asinf(float x);
extern DECLSPEC double SDLCALL SDL_atan(double x);
+extern DECLSPEC float SDLCALL SDL_atanf(float x);
extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
+extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
extern DECLSPEC double SDLCALL SDL_ceil(double x);
+extern DECLSPEC float SDLCALL SDL_ceilf(float x);
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
+extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
extern DECLSPEC double SDLCALL SDL_cos(double x);
extern DECLSPEC float SDLCALL SDL_cosf(float x);
+extern DECLSPEC double SDLCALL SDL_exp(double x);
+extern DECLSPEC float SDLCALL SDL_expf(float x);
extern DECLSPEC double SDLCALL SDL_fabs(double x);
+extern DECLSPEC float SDLCALL SDL_fabsf(float x);
extern DECLSPEC double SDLCALL SDL_floor(double x);
+extern DECLSPEC float SDLCALL SDL_floorf(float x);
+extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
+extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
extern DECLSPEC double SDLCALL SDL_log(double x);
+extern DECLSPEC float SDLCALL SDL_logf(float x);
+extern DECLSPEC double SDLCALL SDL_log10(double x);
+extern DECLSPEC float SDLCALL SDL_log10f(float x);
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
+extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
+extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
extern DECLSPEC double SDLCALL SDL_sin(double x);
extern DECLSPEC float SDLCALL SDL_sinf(float x);
extern DECLSPEC double SDLCALL SDL_sqrt(double x);
#endif
#include "close_code.h"
-#endif /* _SDL_stdinc_h */
+#endif /* SDL_stdinc_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file for ::SDL_Surface definition and management functions.
*/
-#ifndef _SDL_surface_h
-#define _SDL_surface_h
+#ifndef SDL_surface_h_
+#define SDL_surface_h_
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
+#define SDL_SIMD_ALIGNED 0x00000008 /**< Surface uses aligned memory */
/* @} *//* Surface flags */
/**
/**
* \brief The type of function used for surface blitting functions.
*/
-typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
- struct SDL_Surface * dst, SDL_Rect * dstrect);
+typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
+ struct SDL_Surface * dst, SDL_Rect * dstrect);
+
+/**
+ * \brief The formula used for converting between YUV and RGB
+ */
+typedef enum
+{
+ SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */
+ SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */
+ SDL_YUV_CONVERSION_BT709, /**< BT.709 */
+ SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */
+} SDL_YUV_CONVERSION_MODE;
/**
* Allocate and free an RGB surface.
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
(Uint32 flags, int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
+
+/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
(Uint32 flags, int width, int height, int depth, Uint32 format);
+
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
int width,
int height,
extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
int flag, Uint32 key);
+/**
+ * \brief Returns whether the surface has a color key
+ *
+ * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface);
+
/**
* \brief Gets the color key (transparent pixel) in a blittable surface.
*
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
SDL_Rect * rect);
+/*
+ * Creates a new surface identical to the existing surface
+ */
+extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
+
/**
* 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
(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect);
+/**
+ * \brief Set the YUV conversion mode
+ */
+extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
+
+/**
+ * \brief Get the YUV conversion mode
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
+
+/**
+ * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
+ */
+extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
#endif
#include "close_code.h"
-#endif /* _SDL_surface_h */
+#endif /* SDL_surface_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for platform specific SDL API functions
*/
-#ifndef _SDL_system_h
-#define _SDL_system_h
+#ifndef SDL_system_h_
+#define SDL_system_h_
#include "SDL_stdinc.h"
#include "SDL_keyboard.h"
#endif /* __WIN32__ */
+/* Platform specific functions for Linux */
+#ifdef __LINUX__
+
+/**
+ \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available.
+
+ \return 0 on success, or -1 on error.
+ */
+extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
+
+#endif /* __LINUX__ */
+
/* Platform specific functions for iOS */
#if defined(__IPHONEOS__) && __IPHONEOS__
This returns JNIEnv*, but the prototype is void* so we don't need jni.h
*/
-extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
+extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
/**
\brief Get the SDL Activity object for the application
It is the caller's responsibility to properly release it
(using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
*/
-extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
+extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
+
+/**
+ \brief Return true if the application is running on Android TV
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
+
+/**
+ \brief Return true if the application is running on a Chromebook
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
+
+/**
+ \brief Return true is the application is running on a Samsung DeX docking station
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
+
+/**
+ \brief Trigger the Android system back button behavior.
+ */
+extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
/**
See the official Android developer guide for more information:
This path is unique to your application and cannot be written to
by other applications.
*/
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
/**
\brief Get the current state of external storage, a bitmask of these values:
If external storage is currently unavailable, this will return 0.
*/
-extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
+extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
/**
\brief Get the path used for external storage for this application.
This path is unique to your application, but is public and can be
written to by other applications.
*/
-extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
+extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
#endif /* __ANDROID__ */
} SDL_WinRT_Path;
+/**
+ * \brief WinRT Device Family
+ */
+typedef enum
+{
+ /** \brief Unknown family */
+ SDL_WINRT_DEVICEFAMILY_UNKNOWN,
+
+ /** \brief Desktop family*/
+ SDL_WINRT_DEVICEFAMILY_DESKTOP,
+
+ /** \brief Mobile family (for example smartphone) */
+ SDL_WINRT_DEVICEFAMILY_MOBILE,
+
+ /** \brief XBox family */
+ SDL_WINRT_DEVICEFAMILY_XBOX,
+} SDL_WinRT_DeviceFamily;
+
+
/**
* \brief Retrieves a WinRT defined path on the local file system
*
*/
extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
+/**
+ * \brief Detects the device family of WinRT plattform on runtime
+ *
+ * \return Device family
+ */
+extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
+
#endif /* __WINRT__ */
+/**
+ \brief Return true if the current device is a tablet.
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
+
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
-#endif /* _SDL_system_h */
+#endif /* SDL_system_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL custom system window manager hooks.
*/
-#ifndef _SDL_syswm_h
-#define _SDL_syswm_h
+#ifndef SDL_syswm_h_
+#define SDL_syswm_h_
#include "SDL_stdinc.h"
#include "SDL_error.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_syswm.h
+ * \brief 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;
-#else
+
+#if !defined(SDL_PROTOTYPES_ONLY)
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
#ifndef WIN32_LEAN_AND_MEAN
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
#include "SDL_egl.h"
#endif
+#endif /* SDL_PROTOTYPES_ONLY */
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(SDL_PROTOTYPES_ONLY)
/**
* These are the various supported windowing subsystems
*/
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND,
- SDL_SYSWM_MIR,
+ SDL_SYSWM_MIR, /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
SDL_SYSWM_WINRT,
SDL_SYSWM_ANDROID,
- SDL_SYSWM_VIVANTE
+ SDL_SYSWM_VIVANTE,
+ SDL_SYSWM_OS2
} SDL_SYSWM_TYPE;
/**
{
HWND window; /**< The window handle */
HDC hdc; /**< The window device context */
+ HINSTANCE hinstance; /**< The instance handle */
} win;
#endif
#if defined(SDL_VIDEO_DRIVER_WINRT)
struct
{
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
- NSWindow __unsafe_unretained *window; /* The Cocoa window */
+ NSWindow __unsafe_unretained *window; /**< The Cocoa window */
#else
- NSWindow *window; /* The Cocoa window */
+ NSWindow *window; /**< The Cocoa window */
#endif
} cocoa;
#endif
struct
{
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
- UIWindow __unsafe_unretained *window; /* The UIKit window */
+ UIWindow __unsafe_unretained *window; /**< The UIKit window */
#else
- UIWindow *window; /* The UIKit window */
+ UIWindow *window; /**< The UIKit window */
#endif
- GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
- GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
- GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
+ GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
+ GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
+ GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
} uikit;
#endif
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
} wl;
#endif
-#if defined(SDL_VIDEO_DRIVER_MIR)
+#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
struct
{
- struct MirConnection *connection; /**< Mir display server connection */
- struct MirSurface *surface; /**< Mir surface */
+ void *connection; /**< Mir display server connection */
+ void *surface; /**< Mir surface */
} mir;
#endif
} vivante;
#endif
- /* Can't have an empty union */
- int dummy;
+ /* Make sure this union is always 64 bytes (8 64-bit pointers). */
+ /* Be careful not to overflow this if you add a new target! */
+ Uint8 dummy[64];
} info;
};
#endif
#include "close_code.h"
-#endif /* _SDL_syswm_h */
+#endif /* SDL_syswm_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_thread_h
-#define _SDL_thread_h
+#ifndef SDL_thread_h_
+#define SDL_thread_h_
/**
* \file SDL_thread.h
/**
* The SDL thread priority.
*
- * \note On many systems you require special privileges to set high priority.
+ * \note On many systems you require special privileges to set high or time critical priority.
*/
typedef enum {
SDL_THREAD_PRIORITY_LOW,
SDL_THREAD_PRIORITY_NORMAL,
- SDL_THREAD_PRIORITY_HIGH
+ SDL_THREAD_PRIORITY_HIGH,
+ SDL_THREAD_PRIORITY_TIME_CRITICAL
} SDL_ThreadPriority;
/**
*
* We compile SDL into a DLL. 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
+ * API. There is a problem with this, that only the RTL of the SDL2.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
+ * start a new thread. This way, if it's the SDL2.DLL which uses this API,
+ * then the RTL of SDL2.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:
* library!
*/
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#include <process.h> /* This has _beginthread() and _endthread() defined! */
-
-typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *
- func) (void
- *),
- void *arg, unsigned,
- unsigned *threadID);
+#include <process.h> /* _beginthreadex() and _endthreadex() */
+
+typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread)
+ (void *, unsigned, unsigned (__stdcall *func)(void *),
+ void * /*arg*/, unsigned, unsigned * /* threadID */);
typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
/**
pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
+ const char *name, const size_t stacksize, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+
+
/**
* Create a thread.
*/
#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
#undef SDL_CreateThread
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#undef SDL_CreateThreadWithStackSize
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
#else
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
+#endif
+
+#elif defined(__OS2__)
+/*
+ * just like the windows case above: We compile SDL2
+ * into a dll with Watcom's runtime statically linked.
+ */
+#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#ifndef __EMX__
+#include <process.h>
+#else
+#include <stdlib.h>
+#endif
+typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
+typedef void (*pfnSDL_CurrentEndThread)(void);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data,
+ pfnSDL_CurrentBeginThread pfnBeginThread,
+ pfnSDL_CurrentEndThread pfnEndThread);
+#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
+#undef SDL_CreateThread
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#undef SDL_CreateThreadWithStackSize
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#else
+#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
+#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread)
#endif
#else
+/**
+ * Create a thread with a default stack size.
+ *
+ * This is equivalent to calling:
+ * SDL_CreateThreadWithStackSize(fn, name, 0, data);
+ */
+extern DECLSPEC SDL_Thread *SDLCALL
+SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
+
/**
* Create a thread.
*
* If a system imposes requirements, SDL will try to munge the string for
* it (truncate, etc), but the original string contents will be available
* from SDL_GetThreadName().
+ *
+ * The size (in bytes) of the new stack can be specified. Zero means "use
+ * the system default" which might be wildly different between platforms
+ * (x86 Linux generally defaults to eight megabytes, an embedded device
+ * might be a few kilobytes instead).
+ *
+ * In SDL 2.1, stacksize will be folded into the original SDL_CreateThread
+ * function.
*/
extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
+SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data);
#endif
* \sa SDL_TLSCreate()
* \sa SDL_TLSGet()
*/
-extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
/* Ends C function definitions when using C++ */
#endif
#include "close_code.h"
-#endif /* _SDL_thread_h */
+#endif /* SDL_thread_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
3. This notice may not be removed or altered from any source distribution.
*/
-#ifndef _SDL_timer_h
-#define _SDL_timer_h
+#ifndef SDL_timer_h_
+#define SDL_timer_h_
/**
* \file SDL_timer.h
#endif
#include "close_code.h"
-#endif /* _SDL_timer_h */
+#endif /* SDL_timer_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Include file for SDL touch event handling.
*/
-#ifndef _SDL_touch_h
-#define _SDL_touch_h
+#ifndef SDL_touch_h_
+#define SDL_touch_h_
#include "SDL_stdinc.h"
#include "SDL_error.h"
typedef Sint64 SDL_TouchID;
typedef Sint64 SDL_FingerID;
+typedef enum
+{
+ SDL_TOUCH_DEVICE_INVALID = -1,
+ SDL_TOUCH_DEVICE_DIRECT, /* touch screen with window-relative coordinates */
+ SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */
+ SDL_TOUCH_DEVICE_INDIRECT_RELATIVE /* trackpad with screen cursor-relative coordinates */
+} SDL_TouchDeviceType;
+
typedef struct SDL_Finger
{
SDL_FingerID id;
/* Used as the device ID for mouse events simulated with touch input */
#define SDL_TOUCH_MOUSEID ((Uint32)-1)
+/* Used as the SDL_TouchID for touch events simulated with mouse input */
+#define SDL_MOUSE_TOUCHID ((Sint64)-1)
+
/* Function prototypes */
*/
extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
+/**
+ * \brief Get the type of the given touch device.
+ */
+extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
+
/**
* \brief Get the number of active fingers for a given touch device.
*/
#endif
#include "close_code.h"
-#endif /* _SDL_touch_h */
+#endif /* SDL_touch_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* This header defines the current SDL version.
*/
-#ifndef _SDL_version_h
-#define _SDL_version_h
+#ifndef SDL_version_h_
+#define SDL_version_h_
#include "SDL_stdinc.h"
*/
#define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 0
-#define SDL_PATCHLEVEL 5
+#define SDL_PATCHLEVEL 10
/**
* \brief Macro to determine SDL version program was compiled against.
#endif
#include "close_code.h"
-#endif /* _SDL_version_h */
+#endif /* SDL_version_h_ */
/* vi: set ts=4 sw=4 expandtab: */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* Header file for SDL video functions.
*/
-#ifndef _SDL_video_h
-#define _SDL_video_h
+#ifndef SDL_video_h_
+#define SDL_video_h_
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
- SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */
+ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported.
+ On macOS NSHighResolutionCapable must be set true in the
+ application's Info.plist for this to have any effect. */
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
- SDL_WINDOW_POPUP_MENU = 0x00080000 /**< window should be treated as a popup menu */
+ SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
+ SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
} SDL_WindowFlags;
/**
SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */
} SDL_WindowEventID;
+/**
+ * \brief Event subtype for display events
+ */
+typedef enum
+{
+ SDL_DISPLAYEVENT_NONE, /**< Never used */
+ SDL_DISPLAYEVENT_ORIENTATION /**< Display orientation has changed to data1 */
+} SDL_DisplayEventID;
+
+typedef enum
+{
+ SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */
+ SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */
+ SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */
+ SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */
+ SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */
+} SDL_DisplayOrientation;
+
/**
* \brief An opaque handle to an OpenGL context.
*/
SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR
+ SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
+ SDL_GL_CONTEXT_RESET_NOTIFICATION,
+ SDL_GL_CONTEXT_NO_ERROR
} SDL_GLattr;
typedef enum
{
SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
- SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
+ SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
} SDL_GLprofile;
typedef enum
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
} SDL_GLcontextReleaseFlag;
+typedef enum
+{
+ SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
+ SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
+} SDL_GLContextResetNotification;
/* Function prototypes */
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
-/**
- * \brief Get the dots/pixels-per-inch for a display
- *
- * \note Diagonal, horizontal and vertical DPI can all be optionally
- * returned if the parameter is non-NULL.
- *
- * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
- *
- * \sa SDL_GetNumVideoDisplays()
- */
-extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
-
/**
* \brief Get the usable desktop area represented by a display, with the
* primary display located at 0,0
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
+/**
+ * \brief Get the dots/pixels-per-inch for a display
+ *
+ * \note Diagonal, horizontal and vertical DPI can all be optionally
+ * returned if the parameter is non-NULL.
+ *
+ * \return 0 on success, or -1 if no DPI information is available or the index is out of range.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
+
+/**
+ * \brief Get the orientation of a display
+ *
+ * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available.
+ *
+ * \sa SDL_GetNumVideoDisplays()
+ */
+extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex);
+
/**
* \brief Returns the number of available display modes.
*
* ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
* ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
* ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED,
- * ::SDL_WINDOW_ALLOW_HIGHDPI.
+ * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN.
*
* \return The created window, or NULL if window creation failed.
*
* If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
* in pixels may differ from its size in screen coordinates on platforms with
* high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
- * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize()
- * or SDL_GetRendererOutputSize() to query the drawable size in pixels.
+ * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(),
+ * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the
+ * drawable size in pixels.
+ *
+ * If the window is created with any of the SDL_WINDOW_OPENGL or
+ * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function
+ * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the
+ * corresponding UnloadLibrary function is called by SDL_DestroyWindow().
+ *
+ * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver,
+ * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail.
+ *
+ * \note On non-Apple devices, SDL requires you to either not link to the
+ * Vulkan loader or link to a dynamic library version. This limitation
+ * may be removed in a future version of SDL.
*
* \sa SDL_DestroyWindow()
+ * \sa SDL_GL_LoadLibrary()
+ * \sa SDL_Vulkan_LoadLibrary()
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
int x, int y, int w,
* \param w The width of the window, in screen coordinates. Must be >0.
* \param h The height of the window, in screen coordinates. Must be >0.
*
- * \note You can't change the size of a fullscreen window, it automatically
- * matches the size of the display mode.
+ * \note Fullscreen windows automatically match the size of the display mode,
+ * and you should use SDL_SetWindowDisplayMode() to change their size.
*
* The window size in screen coordinates may differ from the size in pixels, if
* the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
* SDL_GetRendererOutputSize() to get the real client area size in pixels.
*
* \sa SDL_GetWindowSize()
+ * \sa SDL_SetWindowDisplayMode()
*/
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
int h);
* \param window The window which will be made transparent or opaque
* \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be
* clamped internally between 0.0f and 1.0f.
- *
+ *
* \return 0 on success, or -1 if setting the opacity isn't supported.
*
* \sa SDL_GetWindowOpacity()
*
* \param modal_window The window that should be modal
* \param parent_window The parent window
- *
+ *
* \return 0 on success, or -1 otherwise.
*/
extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
* obscured by other windows.
*
* \param window The window that should get the input focus
- *
+ *
* \return 0 on success, or -1 otherwise.
* \sa SDL_RaiseWindow()
*/
/**
* \brief Set an OpenGL window attribute before window creation.
+ *
+ * \return 0 on success, or -1 if the attribute could not be set.
*/
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
/**
* \brief Get the actual value for an attribute from the current context.
+ *
+ * \return 0 on success, or -1 if the attribute could not be retrieved.
+ * The integer at \c value will be modified in either case.
*/
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
#endif
#include "close_code.h"
-#endif /* _SDL_video_h */
+#endif /* SDL_video_h_ */
/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 2017, Mark Callow
+
+ 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_vulkan.h
+ *
+ * Header file for functions to creating Vulkan surfaces on SDL windows.
+ */
+
+#ifndef SDL_vulkan_h_
+#define SDL_vulkan_h_
+
+#include "SDL_video.h"
+
+#include "begin_code.h"
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Avoid including vulkan.h, don't define VkInstance if it's already included */
+#ifdef VULKAN_H_
+#define NO_SDL_VULKAN_TYPEDEFS
+#endif
+#ifndef NO_SDL_VULKAN_TYPEDEFS
+#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
+
+#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
+#else
+#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
+#endif
+
+VK_DEFINE_HANDLE(VkInstance)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
+
+#endif /* !NO_SDL_VULKAN_TYPEDEFS */
+
+typedef VkInstance SDL_vulkanInstance;
+typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
+
+/**
+ * \name Vulkan support functions
+ *
+ * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API
+ * is compatable with Tizen's implementation of Vulkan in SDL.
+ */
+/* @{ */
+
+/**
+ * \brief Dynamically load a Vulkan loader library.
+ *
+ * \param [in] path The platform dependent Vulkan loader library name, or
+ * \c NULL.
+ *
+ * \return \c 0 on success, or \c -1 if the library couldn't be loaded.
+ *
+ * If \a path is NULL SDL will use the value of the environment variable
+ * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan
+ * loader library.
+ *
+ * This should be called after initializing the video driver, but before
+ * creating any Vulkan windows. If no Vulkan loader library is loaded, the
+ * default library will be loaded upon creation of the first Vulkan window.
+ *
+ * \note It is fairly common for Vulkan applications to link with \a libvulkan
+ * instead of explicitly loading it at run time. This will work with
+ * SDL provided the application links to a dynamic library and both it
+ * and SDL use the same search path.
+ *
+ * \note If you specify a non-NULL \c path, an application should retrieve all
+ * of the Vulkan functions it uses from the dynamic library using
+ * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee
+ * \c path points to the same vulkan loader library the application
+ * linked to.
+ *
+ * \note On Apple devices, if \a path is NULL, SDL will attempt to find
+ * the vkGetInstanceProcAddr address within all the mach-o images of
+ * the current process. This is because it is fairly common for Vulkan
+ * applications to link with libvulkan (and historically MoltenVK was
+ * provided as a static library). If it is not found then, on macOS, SDL
+ * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib,
+ * followed by \c libvulkan.dylib, in that order.
+ * On iOS SDL will attempt to load \c libvulkan.dylib only. Applications
+ * using a dynamic framework or .dylib must ensure it is included in its
+ * application bundle.
+ *
+ * \note On non-Apple devices, application linking with a static libvulkan is
+ * not supported. Either do not link to the Vulkan loader or link to a
+ * dynamic library version.
+ *
+ * \note This function will fail if there are no working Vulkan drivers
+ * installed.
+ *
+ * \sa SDL_Vulkan_GetVkGetInstanceProcAddr()
+ * \sa SDL_Vulkan_UnloadLibrary()
+ */
+extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
+
+/**
+ * \brief Get the address of the \c vkGetInstanceProcAddr function.
+ *
+ * \note This should be called after either calling SDL_Vulkan_LoadLibrary
+ * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag.
+ */
+extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
+
+/**
+ * \brief Unload the Vulkan loader library previously loaded by
+ * \c SDL_Vulkan_LoadLibrary().
+ *
+ * \sa SDL_Vulkan_LoadLibrary()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
+
+/**
+ * \brief Get the names of the Vulkan instance extensions needed to create
+ * a surface with \c SDL_Vulkan_CreateSurface().
+ *
+ * \param [in] \c NULL or window Window for which the required Vulkan instance
+ * extensions should be retrieved
+ * \param [in,out] pCount pointer to an \c unsigned related to the number of
+ * required Vulkan instance extensions
+ * \param [out] pNames \c NULL or a pointer to an array to be filled with the
+ * required Vulkan instance extensions
+ *
+ * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ * If \a pNames is \c NULL, then the number of required Vulkan instance
+ * extensions is returned in pCount. Otherwise, \a pCount must point to a
+ * variable set to the number of elements in the \a pNames array, and on
+ * return the variable is overwritten with the number of names actually
+ * written to \a pNames. If \a pCount is less than the number of required
+ * extensions, at most \a pCount structures will be written. If \a pCount
+ * is smaller than the number of required extensions, \c SDL_FALSE will be
+ * returned instead of \c SDL_TRUE, to indicate that not all the required
+ * extensions were returned.
+ *
+ * \note If \c window is not NULL, it will be checked against its creation
+ * flags to ensure that the Vulkan flag is present. This parameter
+ * will be removed in a future major release.
+ *
+ * \note The returned list of extensions will contain \c VK_KHR_surface
+ * and zero or more platform specific extensions
+ *
+ * \note The extension names queried here must be enabled when calling
+ * VkCreateInstance, otherwise surface creation will fail.
+ *
+ * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag
+ * or be \c NULL
+ *
+ * \code
+ * unsigned int count;
+ * // get count of required extensions
+ * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL))
+ * handle_error();
+ *
+ * static const char *const additionalExtensions[] =
+ * {
+ * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension
+ * };
+ * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]);
+ * size_t extensionCount = count + additionalExtensionsCount;
+ * const char **names = malloc(sizeof(const char *) * extensionCount);
+ * if(!names)
+ * handle_error();
+ *
+ * // get names of required extensions
+ * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names))
+ * handle_error();
+ *
+ * // copy additional extensions after required extensions
+ * for(size_t i = 0; i < additionalExtensionsCount; i++)
+ * names[i + count] = additionalExtensions[i];
+ *
+ * VkInstanceCreateInfo instanceCreateInfo = {};
+ * instanceCreateInfo.enabledExtensionCount = extensionCount;
+ * instanceCreateInfo.ppEnabledExtensionNames = names;
+ * // fill in rest of instanceCreateInfo
+ *
+ * VkInstance instance;
+ * // create the Vulkan instance
+ * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance);
+ * free(names);
+ * \endcode
+ *
+ * \sa SDL_Vulkan_CreateSurface()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(
+ SDL_Window *window,
+ unsigned int *pCount,
+ const char **pNames);
+
+/**
+ * \brief Create a Vulkan rendering surface for a window.
+ *
+ * \param [in] window SDL_Window to which to attach the rendering surface.
+ * \param [in] instance handle to the Vulkan instance to use.
+ * \param [out] surface pointer to a VkSurfaceKHR handle to receive the
+ * handle of the newly created surface.
+ *
+ * \return \c SDL_TRUE on success, \c SDL_FALSE on error.
+ *
+ * \code
+ * VkInstance instance;
+ * SDL_Window *window;
+ *
+ * // create instance and window
+ *
+ * // create the Vulkan surface
+ * VkSurfaceKHR surface;
+ * if(!SDL_Vulkan_CreateSurface(window, instance, &surface))
+ * handle_error();
+ * \endcode
+ *
+ * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag.
+ *
+ * \note \a instance should have been created with the extensions returned
+ * by \c SDL_Vulkan_CreateSurface() enabled.
+ *
+ * \sa SDL_Vulkan_GetInstanceExtensions()
+ */
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(
+ SDL_Window *window,
+ VkInstance instance,
+ VkSurfaceKHR* surface);
+
+/**
+ * \brief Get the size of a window's underlying drawable in pixels (for use
+ * with setting viewport, scissor & etc).
+ *
+ * \param window SDL_Window from which the drawable size should be queried
+ * \param w Pointer to variable for storing the width in pixels,
+ * may be NULL
+ * \param h Pointer to variable for storing the height in pixels,
+ * may be NULL
+ *
+ * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
+ * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
+ * platform with high-DPI support (Apple calls this "Retina"), and not disabled
+ * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
+ *
+ * \note On macOS high-DPI support must be enabled for an application by
+ * setting NSHighResolutionCapable to true in its Info.plist.
+ *
+ * \sa SDL_GetWindowSize()
+ * \sa SDL_CreateWindow()
+ */
+extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window,
+ int *w, int *h);
+
+/* @} *//* Vulkan support functions */
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* SDL_vulkan_h_ */
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
# else
# define DECLSPEC __declspec(dllexport)
# endif
+# elif defined(__OS2__)
+# ifdef BUILD_SDL
+# define DECLSPEC __declspec(dllexport)
+# else
+# define DECLSPEC
+# endif
# else
# if defined(__GNUC__) && __GNUC__ >= 4
# define DECLSPEC __attribute__ ((visibility("default")))
#ifndef SDLCALL
#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
#define SDLCALL __cdecl
+#elif defined(__OS2__) || defined(__EMX__)
+#define SDLCALL _System
+# if defined (__GNUC__) && !defined(_System)
+# define _System /* for old EMX/GCC compat. */
+# endif
#else
#define SDLCALL
#endif
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wpragma-pack"
+#endif
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \
defined(__WATCOMC__) || defined(__LCC__) || \
- defined(__DECC)
+ defined(__DECC) || defined(__CC_ARM)
#define SDL_INLINE __inline
#ifndef __inline__
#define __inline__ __inline
#endif
#endif /* SDL_FORCE_INLINE not defined */
+#ifndef SDL_NORETURN
+#if defined(__GNUC__)
+#define SDL_NORETURN __attribute__((noreturn))
+#elif defined(_MSC_VER)
+#define SDL_NORETURN __declspec(noreturn)
+#else
+#define SDL_NORETURN
+#endif
+#endif /* SDL_NORETURN not defined */
+
/* Apparently this is needed by several Windows compilers */
#if !defined(__MACH__)
#ifndef NULL
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2019 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
* after you finish any function and structure declarations in your headers
*/
+#ifndef _begin_code_h
+#error close_code.h included without matching begin_code.h
+#endif
#undef _begin_code_h
/* Reset structure packing at previous byte alignment */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
- <string>15G1004</string>
+ <string>18D109</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
- <string>2.0.5</string>
+ <string>2.0.10</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleSupportedPlatforms</key>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
- <string>2.0.5</string>
+ <string>2.0.10</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
- <string>8A218a</string>
+ <string>10E1001</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
- <string>16A300</string>
+ <string>18E219</string>
<key>DTSDKName</key>
- <string>macosx10.12</string>
+ <string>macosx10.14</string>
<key>DTXcode</key>
- <string>0800</string>
+ <string>1020</string>
<key>DTXcodeBuild</key>
- <string>8A218a</string>
+ <string>10E1001</string>
</dict>
</plist>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>files</key>
- <dict>
- <key>Resources/Info.plist</key>
- <data>
- bZkANAXaqONeP7JKT7J8irtx1LQ=
- </data>
- </dict>
- <key>files2</key>
- <dict>
- <key>Headers/SDL.h</key>
- <dict>
- <key>hash</key>
- <data>
- CdryRAbw52YsQuFdpj/qR06oaHo=
- </data>
- <key>hash2</key>
- <data>
- a4srnKbxf82ZmaXCq7fGtSIaNHcc15nwBQT5UZEacdg=
- </data>
- </dict>
- <key>Headers/SDL_assert.h</key>
- <dict>
- <key>hash</key>
- <data>
- WAfvaSHAUBsbTpD1OW6bLIO3TDo=
- </data>
- <key>hash2</key>
- <data>
- 7h4T6jtDOHnLZ1roFa6aEyJAILLSrrhlWzgk6IzUtB4=
- </data>
- </dict>
- <key>Headers/SDL_atomic.h</key>
- <dict>
- <key>hash</key>
- <data>
- 6ZfydfmWn0sHmKXyYj1gCJC9EdQ=
- </data>
- <key>hash2</key>
- <data>
- qs0Y9jgGLKQ9yVStiLUB5aLJT2IMg5SySSiQ3MBEqN8=
- </data>
- </dict>
- <key>Headers/SDL_audio.h</key>
- <dict>
- <key>hash</key>
- <data>
- /MxxNRQLHaaeSVhIb0SlstG4ELE=
- </data>
- <key>hash2</key>
- <data>
- x1R/NAiKCKC/GtvQF3Cm4vo7YZvQFnJIRFOiNKb6J/Y=
- </data>
- </dict>
- <key>Headers/SDL_bits.h</key>
- <dict>
- <key>hash</key>
- <data>
- bBKWsjJQnPdjedRePFr25fPkhrM=
- </data>
- <key>hash2</key>
- <data>
- h6WjANhNEmQVIRbtG/HLujqwFn5p5/8OJ10HlnC3Oi4=
- </data>
- </dict>
- <key>Headers/SDL_blendmode.h</key>
- <dict>
- <key>hash</key>
- <data>
- Qbv4ZV4rYaGKgwLfmRqpUXcfrzo=
- </data>
- <key>hash2</key>
- <data>
- Rs3ArXRSkg2zVRTE2a2W+UDeBrpbvQvyOgUOjAUPDsA=
- </data>
- </dict>
- <key>Headers/SDL_clipboard.h</key>
- <dict>
- <key>hash</key>
- <data>
- E2B/Gj1/db5PjecKc2tjGLGnnEU=
- </data>
- <key>hash2</key>
- <data>
- OUuHXrgGzo46jdpE1rSsVJh9BghlHsiT/hq31sJBTWQ=
- </data>
- </dict>
- <key>Headers/SDL_config.h</key>
- <dict>
- <key>hash</key>
- <data>
- SICWRZVShJxQcjoldrByc8tKyiE=
- </data>
- <key>hash2</key>
- <data>
- zotmPP+Z3SWxdGhfKX7zwbhorxrqqGXTbeOX8YKu6MY=
- </data>
- </dict>
- <key>Headers/SDL_config_macosx.h</key>
- <dict>
- <key>hash</key>
- <data>
- AXT1YfhBssV2mdMI7radyWtrnV4=
- </data>
- <key>hash2</key>
- <data>
- +WkbuLwPgR9LP1fk6oE1nTlBcyy+rx2qpVDlOL1HVgk=
- </data>
- </dict>
- <key>Headers/SDL_copying.h</key>
- <dict>
- <key>hash</key>
- <data>
- ksKqAB2l2GpnBa96oo8FhwfrjZs=
- </data>
- <key>hash2</key>
- <data>
- 7nAZoUQ7ksvZg+awDU/oSMhHBe7+6WfRVxFAyQMqf2Q=
- </data>
- </dict>
- <key>Headers/SDL_cpuinfo.h</key>
- <dict>
- <key>hash</key>
- <data>
- L1bug7VmDQNJDS/a2qhveSB41wg=
- </data>
- <key>hash2</key>
- <data>
- uPNtKToklnAbu/isfW41BRIKdMUPkGQIjonH3+EoSqU=
- </data>
- </dict>
- <key>Headers/SDL_endian.h</key>
- <dict>
- <key>hash</key>
- <data>
- yIPSROTHpa65o98kvhVPa5vJd20=
- </data>
- <key>hash2</key>
- <data>
- KrtyIfWm85EAqqRC1WvxEhDMd/mDlhpSM4cgsqtcBV4=
- </data>
- </dict>
- <key>Headers/SDL_error.h</key>
- <dict>
- <key>hash</key>
- <data>
- EKMXAYytkozTsnGEetwJSWxDdXs=
- </data>
- <key>hash2</key>
- <data>
- SPul/9qHvppNntwC882a/WBVajzYBT1+tYPQ6DSGxFY=
- </data>
- </dict>
- <key>Headers/SDL_events.h</key>
- <dict>
- <key>hash</key>
- <data>
- CPSA6t0dYtnPX0aOYMp2yBKYCII=
- </data>
- <key>hash2</key>
- <data>
- iYBVsC4VTUXBruL7Z8GMlmSGqlXRS2265FofuNaPOYE=
- </data>
- </dict>
- <key>Headers/SDL_filesystem.h</key>
- <dict>
- <key>hash</key>
- <data>
- z0ipNXSs0G+cMSE5xJ/1OLb0iww=
- </data>
- <key>hash2</key>
- <data>
- 170/Jgr1x08XVFMFP063CU5vq7J364U4FmkwKSoeouc=
- </data>
- </dict>
- <key>Headers/SDL_gamecontroller.h</key>
- <dict>
- <key>hash</key>
- <data>
- iDeu/H14U1KryUM2D/Co453LtOU=
- </data>
- <key>hash2</key>
- <data>
- wM7f8ttYHiwr0RPC6Lt86Hl46ZIcopI7u/TDDsiUKqE=
- </data>
- </dict>
- <key>Headers/SDL_gesture.h</key>
- <dict>
- <key>hash</key>
- <data>
- gL8Pe0KmmUmvy06MPiwcXLy1RPc=
- </data>
- <key>hash2</key>
- <data>
- uSiw21vM1GILKVz+FNJkrfXkTxSQ1xXDoYyYbLgxfpg=
- </data>
- </dict>
- <key>Headers/SDL_haptic.h</key>
- <dict>
- <key>hash</key>
- <data>
- Mq/rLF1FAkGpnwiQ1d54/wGZbcc=
- </data>
- <key>hash2</key>
- <data>
- OuNe6t85VCJZ2Qm6pVJkqFJCoQVvPHOXp2triOR+cS8=
- </data>
- </dict>
- <key>Headers/SDL_hints.h</key>
- <dict>
- <key>hash</key>
- <data>
- ilKKw9O5YhM690t3JMdfnZWFK7A=
- </data>
- <key>hash2</key>
- <data>
- 9xxfD/BNMH9ZeZ6Vt+Awhdw31+6Ge4IJKLR7hJvQo4k=
- </data>
- </dict>
- <key>Headers/SDL_joystick.h</key>
- <dict>
- <key>hash</key>
- <data>
- ClOTSR3VDFhV1hCfp17slV2L0nE=
- </data>
- <key>hash2</key>
- <data>
- UJGdVwyqOlVhITntWwC6mj8nWYdL6uRT09oiRo1GME4=
- </data>
- </dict>
- <key>Headers/SDL_keyboard.h</key>
- <dict>
- <key>hash</key>
- <data>
- 2yGANM2j3KDAl2neetk1d8OlxKU=
- </data>
- <key>hash2</key>
- <data>
- iTmNAG0t6x3v3EUQxgSU9UPgbNVBS3CluskwtTANO3U=
- </data>
- </dict>
- <key>Headers/SDL_keycode.h</key>
- <dict>
- <key>hash</key>
- <data>
- 6bL7lbeGExj/h8aqaSdhpq23rJY=
- </data>
- <key>hash2</key>
- <data>
- Uh8oV1XZoVd2eDYWb+dR3Qa1TzIS1uAAHU7l7/rdJVc=
- </data>
- </dict>
- <key>Headers/SDL_loadso.h</key>
- <dict>
- <key>hash</key>
- <data>
- NpMytx6UwU3pTsWYm9KbfrSeyBM=
- </data>
- <key>hash2</key>
- <data>
- 5a3r50goTxzN3z+14C/VyW5w54z9e5DNTrN99aTuBP4=
- </data>
- </dict>
- <key>Headers/SDL_log.h</key>
- <dict>
- <key>hash</key>
- <data>
- rghDDMt7l/53fcvzIf2ueASgru0=
- </data>
- <key>hash2</key>
- <data>
- kBXM+MFIZIBsGOetv1LFzOhYWqOlgM7T6rRamLrXXsY=
- </data>
- </dict>
- <key>Headers/SDL_main.h</key>
- <dict>
- <key>hash</key>
- <data>
- sCHgY3RQ9/Waq6RXfI3e5ko2tFI=
- </data>
- <key>hash2</key>
- <data>
- qQmapC5rQ+k4JPi6Klex07haM1HM+k7ddRKVRY7pVII=
- </data>
- </dict>
- <key>Headers/SDL_messagebox.h</key>
- <dict>
- <key>hash</key>
- <data>
- AofMdqXibVh1eLBrQBaSJtT2TBA=
- </data>
- <key>hash2</key>
- <data>
- OA0hxIIn3zrMJmBpURqqHGpUdbdYXQm+8zWjN9HBK+Q=
- </data>
- </dict>
- <key>Headers/SDL_mouse.h</key>
- <dict>
- <key>hash</key>
- <data>
- 2DiwOaEv3eVUPQOp6eijF8klb7s=
- </data>
- <key>hash2</key>
- <data>
- lMp9UoCDXLUwWq7XXfhteZIKmurkNC7DSz90mqg8cm4=
- </data>
- </dict>
- <key>Headers/SDL_mutex.h</key>
- <dict>
- <key>hash</key>
- <data>
- V9Eo8zGubHioHOR/zDh7vxX7Ot0=
- </data>
- <key>hash2</key>
- <data>
- 0+Jp5UYC5Q0gq0UA78HXeDS11cU7plXD2gdF9uEOj3Y=
- </data>
- </dict>
- <key>Headers/SDL_name.h</key>
- <dict>
- <key>hash</key>
- <data>
- mEOy6xwQy0aKcghbHD2Gk8AiE2Y=
- </data>
- <key>hash2</key>
- <data>
- SmgwrJXssEcacZFXRiDMX9xEKqMyDQroMzMk49993/A=
- </data>
- </dict>
- <key>Headers/SDL_opengl.h</key>
- <dict>
- <key>hash</key>
- <data>
- uLy76O02VpeHP49lGqfyOJZVN98=
- </data>
- <key>hash2</key>
- <data>
- wLqChYCR7CJXuJJszyfgZ4bmWgBV/xts/XXDTDacqbg=
- </data>
- </dict>
- <key>Headers/SDL_opengl_glext.h</key>
- <dict>
- <key>hash</key>
- <data>
- nqPX1ObCVYyVzW3VbD3C/1vaTRE=
- </data>
- <key>hash2</key>
- <data>
- IULBL/m+rBc3UQPqu68w6FDM/Mda58oybFnlyn3OkjE=
- </data>
- </dict>
- <key>Headers/SDL_opengles.h</key>
- <dict>
- <key>hash</key>
- <data>
- gHnWXXRnsPIVHQherf5NBPICBEQ=
- </data>
- <key>hash2</key>
- <data>
- tmnzU6otAGtXyGNO3Rgm47RNBMUC9uvGJRnRigm+Ds0=
- </data>
- </dict>
- <key>Headers/SDL_opengles2.h</key>
- <dict>
- <key>hash</key>
- <data>
- 1pbpsJhtHMiZ6LOkM1CFU88l7v4=
- </data>
- <key>hash2</key>
- <data>
- 59G3rOK0wqwYm1+uCwRZkyZcif9vFWHBYKJVIko9qx8=
- </data>
- </dict>
- <key>Headers/SDL_opengles2_gl2.h</key>
- <dict>
- <key>hash</key>
- <data>
- g4y04zPFy1H/qujSNGRd0vB7ClQ=
- </data>
- <key>hash2</key>
- <data>
- 9GAwK0cg8YPrZHWVqMGpyVwKFz3Ay9VHiyz70jzWltA=
- </data>
- </dict>
- <key>Headers/SDL_opengles2_gl2ext.h</key>
- <dict>
- <key>hash</key>
- <data>
- bTlnL+42kbi+n/gH//X2p0pqeuM=
- </data>
- <key>hash2</key>
- <data>
- 5404JOHXH4pGO60gR/uLhz9zW6fKy9jvdMw5i1WTcpo=
- </data>
- </dict>
- <key>Headers/SDL_opengles2_gl2platform.h</key>
- <dict>
- <key>hash</key>
- <data>
- ByFMXJFtjcRglS/e0+DujyjC3dM=
- </data>
- <key>hash2</key>
- <data>
- wlKRTsmTMrnniYqSvQklJfb9VF07J0MDpqzYOcfiDDY=
- </data>
- </dict>
- <key>Headers/SDL_opengles2_khrplatform.h</key>
- <dict>
- <key>hash</key>
- <data>
- NLpJq9uBqjOpWhXISOQHPnTp/XQ=
- </data>
- <key>hash2</key>
- <data>
- djHeDyzmR0e/2JNIbqpBqgi56MXlxlAbgcBFxuvwSyo=
- </data>
- </dict>
- <key>Headers/SDL_pixels.h</key>
- <dict>
- <key>hash</key>
- <data>
- Xvgibsz62Xj6AnQTD3nXR1RdP7w=
- </data>
- <key>hash2</key>
- <data>
- 6UZnQSfbBzEihA8AYXGuWafY4Q2rGbOIIICEM6NYb30=
- </data>
- </dict>
- <key>Headers/SDL_platform.h</key>
- <dict>
- <key>hash</key>
- <data>
- wq9EnHSCm8XK4eJux1ZR519KOy0=
- </data>
- <key>hash2</key>
- <data>
- byh3kf3MVWzZVyLbsv+q4PyAVHFlQZsUb4cwrhtyKHM=
- </data>
- </dict>
- <key>Headers/SDL_power.h</key>
- <dict>
- <key>hash</key>
- <data>
- Hht8UlX2Q+ZZYP4+TOUjRtFj+Ww=
- </data>
- <key>hash2</key>
- <data>
- UvkPQHn6hdbaJLPQ5kzRe/e0gLOv1n3E+JulK0DjxKA=
- </data>
- </dict>
- <key>Headers/SDL_quit.h</key>
- <dict>
- <key>hash</key>
- <data>
- 4gv2IjG2mCPLKUXLEgxBp+zQLuM=
- </data>
- <key>hash2</key>
- <data>
- arq8WYQJrksLt0eOsjijzO5xyBEllBSguXTQo71QmiI=
- </data>
- </dict>
- <key>Headers/SDL_rect.h</key>
- <dict>
- <key>hash</key>
- <data>
- ArluDPEgeo4k7O85ALBoryFpGyk=
- </data>
- <key>hash2</key>
- <data>
- gbazbfs1AzykEDJ4sFrAu0dmtzUbEwOQFafBS7eH7So=
- </data>
- </dict>
- <key>Headers/SDL_render.h</key>
- <dict>
- <key>hash</key>
- <data>
- D0japjJ6ym/uoSUpQnbUHnNDu5s=
- </data>
- <key>hash2</key>
- <data>
- c/5XEiLTcWSdqD9fa3GuTGVH83qKriuarIX/6pdjuCs=
- </data>
- </dict>
- <key>Headers/SDL_revision.h</key>
- <dict>
- <key>hash</key>
- <data>
- 8ncx+diMb2Vfefe3XxBT7tDjqQQ=
- </data>
- <key>hash2</key>
- <data>
- jfHrBzZLeEMPUigODAU3KGZP3UvwmZyO0gkuK1Jxi60=
- </data>
- </dict>
- <key>Headers/SDL_rwops.h</key>
- <dict>
- <key>hash</key>
- <data>
- DaBBCXUHnuJqAswfBxrMjTGznLU=
- </data>
- <key>hash2</key>
- <data>
- 9Q1FoSoktxxFXBEkfND5aVYY2W2TOg5CaVnT7pUYFeE=
- </data>
- </dict>
- <key>Headers/SDL_scancode.h</key>
- <dict>
- <key>hash</key>
- <data>
- cFbtc//t5wQjDoEFox2sb72ixzM=
- </data>
- <key>hash2</key>
- <data>
- imcWyCJ20Xb2gxJjs3a2ArJas11FDAlB7sPHOwuoTLY=
- </data>
- </dict>
- <key>Headers/SDL_shape.h</key>
- <dict>
- <key>hash</key>
- <data>
- uI7SsJKg+9VUi3Ol3HSjbrfJiuw=
- </data>
- <key>hash2</key>
- <data>
- 2t551rTZEMPl0aLCmAjkDLSDEFigY96X6cqZvRWqbB4=
- </data>
- </dict>
- <key>Headers/SDL_stdinc.h</key>
- <dict>
- <key>hash</key>
- <data>
- UKINkMUBmh6G37JGdhy4vm5nXqY=
- </data>
- <key>hash2</key>
- <data>
- Y3Ese7AsGxbczlpolRbaswp3Wc63deF3QggyuzGUaWg=
- </data>
- </dict>
- <key>Headers/SDL_surface.h</key>
- <dict>
- <key>hash</key>
- <data>
- Two0va+fVFaiXhlhgOY9/llpEZw=
- </data>
- <key>hash2</key>
- <data>
- D9hAM0KyWDPRXIsik3F+i601/aEFra/CbdgrhgwgseI=
- </data>
- </dict>
- <key>Headers/SDL_system.h</key>
- <dict>
- <key>hash</key>
- <data>
- mTKo4PBIinn03uXfN1DJ/He9e9k=
- </data>
- <key>hash2</key>
- <data>
- b8MsbjBkpqYSflbHcYcGNfTvwCs6LkOTlfCroagtLPY=
- </data>
- </dict>
- <key>Headers/SDL_syswm.h</key>
- <dict>
- <key>hash</key>
- <data>
- enV9cJuGdUnZO1QlHW5sTuu7a6I=
- </data>
- <key>hash2</key>
- <data>
- 4xIVBafoNBEGMdBQoarbShg8lTmJzZtWFnOhemFCGq0=
- </data>
- </dict>
- <key>Headers/SDL_thread.h</key>
- <dict>
- <key>hash</key>
- <data>
- 7j7DqnFpoS63qhuVR2Q0gSa/4ds=
- </data>
- <key>hash2</key>
- <data>
- G8Nrk6RRTWxDtQYJEn5Qo6wl+MZaTh/c6NzEgwwFd6E=
- </data>
- </dict>
- <key>Headers/SDL_timer.h</key>
- <dict>
- <key>hash</key>
- <data>
- wTTvR/s4oORZCAHQrwGvEitdftg=
- </data>
- <key>hash2</key>
- <data>
- XXlmOyzGaHB9cV+ExAECBNr75+tSUVXhKN+oXovGrqs=
- </data>
- </dict>
- <key>Headers/SDL_touch.h</key>
- <dict>
- <key>hash</key>
- <data>
- iTKBLV0gnsn1y4RjFyKjss42FAw=
- </data>
- <key>hash2</key>
- <data>
- kt96CgBUHCsYb5bk8zIonTCA23GhM9HKsWpbOE5WuAk=
- </data>
- </dict>
- <key>Headers/SDL_types.h</key>
- <dict>
- <key>hash</key>
- <data>
- sxzg0bkqO1atJAHHIFE6TMMWt+w=
- </data>
- <key>hash2</key>
- <data>
- U+e5nUQUJ0kM7y4x93oe6JZVcWjsssOlHwitGh+Oxuc=
- </data>
- </dict>
- <key>Headers/SDL_version.h</key>
- <dict>
- <key>hash</key>
- <data>
- Shb8tayezQvZheoYHG/w0dZ74RQ=
- </data>
- <key>hash2</key>
- <data>
- vp7z5LS6efRrPJHGCl33jorZuwWW/qusGbV/YS0V69k=
- </data>
- </dict>
- <key>Headers/SDL_video.h</key>
- <dict>
- <key>hash</key>
- <data>
- 0VCISfUtCna3Dgz1lDJ/yzsXYRw=
- </data>
- <key>hash2</key>
- <data>
- hRR0gP6rfsCPS63Xb3iOXbtAq9J+w2K0n1EOcoF/sfQ=
- </data>
- </dict>
- <key>Headers/begin_code.h</key>
- <dict>
- <key>hash</key>
- <data>
- WnMoGL8utnke7xWxpDeTFp+/QIA=
- </data>
- <key>hash2</key>
- <data>
- GCO8amg+TMHAV+gV/E1TKPR6Pm2i3UCWpCABk5f/zZs=
- </data>
- </dict>
- <key>Headers/close_code.h</key>
- <dict>
- <key>hash</key>
- <data>
- nnSi+1tlfaAkwmjGng6tRmzXcnw=
- </data>
- <key>hash2</key>
- <data>
- F1nVEPM19lh1dCbsk1yMBecmBYd0DrQb13nImbvdgBU=
- </data>
- </dict>
- <key>Resources/Info.plist</key>
- <dict>
- <key>hash</key>
- <data>
- bZkANAXaqONeP7JKT7J8irtx1LQ=
- </data>
- <key>hash2</key>
- <data>
- KYKFeBKZJYQhDbO6O+et8ynCeQmtiB98QGh3JGyW3kY=
- </data>
- </dict>
- </dict>
- <key>rules</key>
- <dict>
- <key>^Resources/</key>
- <true/>
- <key>^Resources/.*\.lproj/</key>
- <dict>
- <key>optional</key>
- <true/>
- <key>weight</key>
- <real>1000</real>
- </dict>
- <key>^Resources/.*\.lproj/locversion.plist$</key>
- <dict>
- <key>omit</key>
- <true/>
- <key>weight</key>
- <real>1100</real>
- </dict>
- <key>^version.plist$</key>
- <true/>
- </dict>
- <key>rules2</key>
- <dict>
- <key>.*\.dSYM($|/)</key>
- <dict>
- <key>weight</key>
- <real>11</real>
- </dict>
- <key>^(.*/)?\.DS_Store$</key>
- <dict>
- <key>omit</key>
- <true/>
- <key>weight</key>
- <real>2000</real>
- </dict>
- <key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
- <dict>
- <key>nested</key>
- <true/>
- <key>weight</key>
- <real>10</real>
- </dict>
- <key>^.*</key>
- <true/>
- <key>^Info\.plist$</key>
- <dict>
- <key>omit</key>
- <true/>
- <key>weight</key>
- <real>20</real>
- </dict>
- <key>^PkgInfo$</key>
- <dict>
- <key>omit</key>
- <true/>
- <key>weight</key>
- <real>20</real>
- </dict>
- <key>^Resources/</key>
- <dict>
- <key>weight</key>
- <real>20</real>
- </dict>
- <key>^Resources/.*\.lproj/</key>
- <dict>
- <key>optional</key>
- <true/>
- <key>weight</key>
- <real>1000</real>
- </dict>
- <key>^Resources/.*\.lproj/locversion.plist$</key>
- <dict>
- <key>omit</key>
- <true/>
- <key>weight</key>
- <real>1100</real>
- </dict>
- <key>^[^/]+$</key>
- <dict>
- <key>nested</key>
- <true/>
- <key>weight</key>
- <real>10</real>
- </dict>
- <key>^embedded\.provisionprofile$</key>
- <dict>
- <key>weight</key>
- <real>20</real>
- </dict>
- <key>^version\.plist$</key>
- <dict>
- <key>weight</key>
- <real>20</real>
- </dict>
- </dict>
-</dict>
-</plist>
}
enter
-curl -O http://libsdl.org/release/SDL2-2.0.5.dmg
+curl -O http://libsdl.org/release/SDL2-2.0.10.dmg
7z x *.dmg
7z x *.hfs
rm -rf "$buildfiles/osx/Xonotic.app/Contents/Frameworks/SDL2.framework/Versions/A"
leave
enter
-curl -O http://libsdl.org/release/SDL2-2.0.5.tar.gz
+curl -O http://libsdl.org/release/SDL2-2.0.10.tar.gz
tar xvf *.tar.gz
cd SDL2*/
LD_LIBRARY_PATH="$HOME/opt/cross_toolchain_32/x86_64-slackware-linux/i686-w64-mingw32/lib:$HOME/opt/cross_toolchain_32/libexec/gcc/i686-w64-mingw32/4.8.3" \