forked from JACoders/OpenJK
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDL now no longer uses the C runtime, so apparently a single .lib works across different MSVC Versions and toolsets.
- Loading branch information
Showing
84 changed files
with
18,740 additions
and
13,815 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2014 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2016 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -25,41 +25,6 @@ | |
* Main include header for the SDL library | ||
*/ | ||
|
||
/** | ||
* \mainpage Simple DirectMedia Layer (SDL) | ||
* | ||
* http://www.libsdl.org/ | ||
* | ||
* \section intro_sec Introduction | ||
* | ||
* Simple DirectMedia Layer is a cross-platform development library designed | ||
* to provide low level access to audio, keyboard, mouse, joystick, and | ||
* graphics hardware via OpenGL and Direct3D. It is used by video playback | ||
* software, emulators, and popular games including Valve's award winning | ||
* catalog and many Humble Bundle games. | ||
* | ||
* SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. | ||
* Support for other platforms may be found in the source code. | ||
* | ||
* SDL is written in C, works natively with C++, and there are bindings | ||
* available for several other languages, including C# and Python. | ||
* | ||
* This library is distributed under the zlib license, which can be found | ||
* in the file "COPYING.txt". | ||
* | ||
* The best way to learn how to use SDL is to check out the header files in | ||
* the "include" subdirectory and the programs in the "test" subdirectory. | ||
* The header files and test programs are well commented and always up to date. | ||
* More documentation and FAQs are available online at: | ||
* http://wiki.libsdl.org/ | ||
* | ||
* If you need help with the library, or just want to discuss SDL related | ||
* issues, you can join the developers mailing list: | ||
* http://www.libsdl.org/mailing-list.php | ||
* | ||
* Enjoy! | ||
* Sam Lantinga ([email protected]) | ||
*/ | ||
|
||
#ifndef _SDL_H | ||
#define _SDL_H | ||
|
@@ -114,7 +79,7 @@ extern "C" { | |
#define SDL_INIT_HAPTIC 0x00001000 | ||
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ | ||
#define SDL_INIT_EVENTS 0x00004000 | ||
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */ | ||
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< 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 \ | ||
|
@@ -123,13 +88,17 @@ extern "C" { | |
|
||
/** | ||
* This function initializes the subsystems specified by \c flags | ||
* Unless the ::SDL_INIT_NOPARACHUTE flag is set, it will install cleanup | ||
* signal handlers for some commonly ignored fatal signals (like SIGSEGV). | ||
*/ | ||
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); | ||
|
||
/** | ||
* This function initializes specific SDL subsystems | ||
* | ||
* Subsystem initialization is ref-counted, you must call | ||
* SDL_QuitSubSystem for each SDL_InitSubSystem to correctly | ||
* shutdown a subsystem manually (or call SDL_Quit to force shutdown). | ||
* If a subsystem is already loaded then this call will | ||
* increase the ref-count and return. | ||
*/ | ||
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2014 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2016 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -51,7 +51,7 @@ assert can have unique static variables associated with it. | |
/* Don't include intrin.h here because it contains C++ code */ | ||
extern void __cdecl __debugbreak(void); | ||
#define SDL_TriggerBreakpoint() __debugbreak() | ||
#elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) | ||
#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) | ||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) | ||
#elif defined(HAVE_SIGNAL_H) | ||
#include <signal.h> | ||
|
@@ -86,8 +86,10 @@ This also solves the problem of... | |
disable assertions. | ||
*/ | ||
|
||
/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking | ||
this condition isn't constant. And looks like an owl's face! */ | ||
#ifdef _MSC_VER /* stupid /W4 warnings. */ | ||
#define SDL_NULL_WHILE_LOOP_CONDITION (-1 == __LINE__) | ||
#define SDL_NULL_WHILE_LOOP_CONDITION (0,0) | ||
#else | ||
#define SDL_NULL_WHILE_LOOP_CONDITION (0) | ||
#endif | ||
|
@@ -102,23 +104,23 @@ typedef enum | |
SDL_ASSERTION_ABORT, /**< Terminate the program. */ | ||
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */ | ||
SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */ | ||
} SDL_assert_state; | ||
} SDL_AssertState; | ||
|
||
typedef struct SDL_assert_data | ||
typedef struct SDL_AssertData | ||
{ | ||
int always_ignore; | ||
unsigned int trigger_count; | ||
const char *condition; | ||
const char *filename; | ||
int linenum; | ||
const char *function; | ||
const struct SDL_assert_data *next; | ||
} SDL_assert_data; | ||
const struct SDL_AssertData *next; | ||
} SDL_AssertData; | ||
|
||
#if (SDL_ASSERT_LEVEL > 0) | ||
|
||
/* Never call this directly. Use the SDL_assert* macros. */ | ||
extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *, | ||
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, | ||
const char *, | ||
const char *, int) | ||
#if defined(__clang__) | ||
|
@@ -141,16 +143,13 @@ extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *, | |
#define SDL_enabled_assert(condition) \ | ||
do { \ | ||
while ( !(condition) ) { \ | ||
static struct SDL_assert_data assert_data = { \ | ||
static struct SDL_AssertData sdl_assert_data = { \ | ||
0, 0, #condition, 0, 0, 0, 0 \ | ||
}; \ | ||
const SDL_assert_state state = SDL_ReportAssertion(&assert_data, \ | ||
SDL_FUNCTION, \ | ||
SDL_FILE, \ | ||
SDL_LINE); \ | ||
if (state == SDL_ASSERTION_RETRY) { \ | ||
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \ | ||
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \ | ||
continue; /* go again. */ \ | ||
} else if (state == SDL_ASSERTION_BREAK) { \ | ||
} else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \ | ||
SDL_TriggerBreakpoint(); \ | ||
} \ | ||
break; /* not retrying. */ \ | ||
|
@@ -184,8 +183,8 @@ extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *, | |
#define SDL_assert_always(condition) SDL_enabled_assert(condition) | ||
|
||
|
||
typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)( | ||
const SDL_assert_data* data, void* userdata); | ||
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( | ||
const SDL_AssertData* data, void* userdata); | ||
|
||
/** | ||
* \brief Set an application-defined assertion handler. | ||
|
@@ -202,7 +201,7 @@ typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)( | |
* | ||
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()! | ||
* | ||
* \return SDL_assert_state value of how to handle the assertion failure. | ||
* \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. | ||
|
@@ -249,7 +248,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse | |
* The proper way to examine this data looks something like this: | ||
* | ||
* <code> | ||
* const SDL_assert_data *item = SDL_GetAssertionReport(); | ||
* const SDL_AssertData *item = SDL_GetAssertionReport(); | ||
* while (item) { | ||
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", | ||
* item->condition, item->function, item->filename, | ||
|
@@ -262,7 +261,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse | |
* \return List of all assertions. | ||
* \sa SDL_ResetAssertionReport | ||
*/ | ||
extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void); | ||
extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void); | ||
|
||
/** | ||
* \brief Reset the list of all assertion failures. | ||
|
@@ -273,6 +272,12 @@ extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void); | |
*/ | ||
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); | ||
|
||
|
||
/* these had wrong naming conventions until 2.0.4. Please update your app! */ | ||
#define SDL_assert_state SDL_AssertState | ||
#define SDL_assert_data SDL_AssertData | ||
|
||
|
||
/* Ends C function definitions when using C++ */ | ||
#ifdef __cplusplus | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2014 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2016 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -122,7 +122,8 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); | |
void _ReadWriteBarrier(void); | ||
#pragma intrinsic(_ReadWriteBarrier) | ||
#define SDL_CompilerBarrier() _ReadWriteBarrier() | ||
#elif defined(__GNUC__) | ||
#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") | ||
#else | ||
#define SDL_CompilerBarrier() \ | ||
|
@@ -169,10 +170,17 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(); | |
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory") | ||
#endif /* __GNUC__ && __arm__ */ | ||
#else | ||
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) | ||
/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */ | ||
#include <mbarrier.h> | ||
#define SDL_MemoryBarrierRelease() __machine_rel_barrier() | ||
#define SDL_MemoryBarrierAcquire() __machine_acq_barrier() | ||
#else | ||
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */ | ||
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier() | ||
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier() | ||
#endif | ||
#endif | ||
|
||
/** | ||
* \brief A type representing an atomic integer value. It is a struct | ||
|
Oops, something went wrong.