mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-02-01 14:10:42 +00:00
Introduce and use sys_sdl.h to unify <SDL3/SDL.h> and <SDL.h> includes
This commit is contained in:
parent
1a1962088d
commit
b3be9f7b31
9 changed files with 36 additions and 41 deletions
|
@ -26,12 +26,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifdef D3_SDL3
|
||||
#include <SDL3/SDL.h>
|
||||
#include "sys/sys_sdl.h"
|
||||
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
// DG: compat with SDL2
|
||||
#define SDL_setenv SDL_setenv_unsafe
|
||||
#else // SDL1.2 or SDL2
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#include "sys/platform.h"
|
||||
|
|
|
@ -2,11 +2,7 @@
|
|||
|
||||
#include <algorithm> // std::sort - TODO: replace with something custom..
|
||||
|
||||
#ifdef D3_SDL3
|
||||
#include <SDL3/SDL.h>
|
||||
#else // SDL1.2 or SDL2
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
#include "sys/sys_sdl.h"
|
||||
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
|
|
|
@ -26,13 +26,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifdef D3_SDL3
|
||||
// HACK: I don't want SDL.h to drag in SDL_oldnames.h to avoid all the warnings about redefined definitions
|
||||
#define SDL_oldnames_h_
|
||||
#include <SDL3/SDL.h>
|
||||
#else // SDL1.2 or SDL2
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
#include "sys/sys_sdl.h"
|
||||
|
||||
#include "sys/platform.h"
|
||||
#include "idlib/containers/List.h"
|
||||
|
|
|
@ -26,14 +26,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifdef D3_SDL3
|
||||
#include <SDL3/SDL.h>
|
||||
#include "sys/sys_sdl.h"
|
||||
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
// backwards-compat with SDL2
|
||||
#define SDL_WINDOW_ALLOW_HIGHDPI SDL_WINDOW_HIGH_PIXEL_DENSITY
|
||||
#define SDL_GL_DeleteContext SDL_GL_DestroyContext
|
||||
typedef SDL_WindowFlags My_SDL_WindowFlags;
|
||||
#else // SDL1.2 or SDL2
|
||||
#include <SDL.h>
|
||||
// for compat with SDL3 - unfortunately SDL2 also has a SDL_WindowFlags type, but it's an enum
|
||||
typedef Uint32 My_SDL_WindowFlags;
|
||||
#endif
|
||||
|
|
|
@ -50,11 +50,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "sys/posix/posix_public.h"
|
||||
|
||||
// SDL.h for clipboard:
|
||||
#ifdef D3_SDL3
|
||||
#include <SDL3/SDL.h>
|
||||
#else // SDL1.2 or SDL2
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
#include "sys/sys_sdl.h"
|
||||
|
||||
|
||||
#define COMMAND_HISTORY 64
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
#ifdef D3_SDL3
|
||||
#include <SDL3/SDL.h>
|
||||
#include "sys_sdl.h"
|
||||
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
// compat with SDL2
|
||||
#define SDL_TEXTINPUT SDL_EVENT_TEXT_INPUT
|
||||
#define SDL_CONTROLLERAXISMOTION SDL_EVENT_GAMEPAD_AXIS_MOTION
|
||||
|
@ -11,8 +12,6 @@
|
|||
#define SDL_MOUSEMOTION SDL_EVENT_MOUSE_MOTION
|
||||
#define SDL_MOUSEWHEEL SDL_EVENT_MOUSE_WHEEL
|
||||
#define SDL_KEYDOWN SDL_EVENT_KEY_DOWN
|
||||
#else // SDL2
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
|
14
neo/sys/sys_sdl.h
Normal file
14
neo/sys/sys_sdl.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
// just a wrapper for #include <SDL.h> to support SDL1.2, SDL2 and SDL3
|
||||
|
||||
#ifndef NEO_SYS_SYS_SDL_H_
|
||||
#define NEO_SYS_SYS_SDL_H_
|
||||
|
||||
#ifdef D3_SDL3
|
||||
// HACK: I don't want SDL.h to drag in SDL_oldnames.h to avoid all the warnings about redefined definitions
|
||||
#define SDL_oldnames_h_
|
||||
#include <SDL3/SDL.h>
|
||||
#else // SDL1.2 or SDL2
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#endif /* NEO_SYS_SYS_SDL_H_ */
|
|
@ -26,10 +26,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifdef D3_SDL3
|
||||
#define SDL_oldnames_h_ // HACK: I don't want SDL.h to drag in SDL_oldnames.h to avoid all the warnings about redefined definitions
|
||||
#include <SDL3/SDL.h>
|
||||
#else // SDL1.2 or SDL2
|
||||
#include "sys/sys_sdl.h"
|
||||
|
||||
#if 0 // TODO: was there a reason not to include full SDL.h?
|
||||
#include <SDL_version.h>
|
||||
#include <SDL_mutex.h>
|
||||
#include <SDL_thread.h>
|
||||
|
|
|
@ -28,15 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#ifndef DEBUGGERSERVER_H_
|
||||
#define DEBUGGERSERVER_H_
|
||||
|
||||
#ifdef D3_SDL3
|
||||
#define SDL_oldnames_h_ // HACK: I don't want SDL.h to drag in SDL_oldnames.h to avoid all the warnings about redefined definitions
|
||||
#include <SDL3/SDL.h>
|
||||
// backwards-compat with SDL <= 2
|
||||
#define SDL_mutex SDL_Mutex
|
||||
#define SDL_cond SDL_Condition
|
||||
#else // SDL1.2 or SDL2
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
#include "sys/sys_sdl.h"
|
||||
|
||||
#include "sys/platform.h"
|
||||
#include "idlib/Str.h"
|
||||
|
@ -44,6 +36,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "DebuggerBreakpoint.h"
|
||||
#include "framework/Game.h"
|
||||
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
// backwards-compat with SDL <= 2
|
||||
#define SDL_mutex SDL_Mutex
|
||||
#define SDL_cond SDL_Condition
|
||||
#endif
|
||||
|
||||
class function_t;
|
||||
typedef struct prstack_s prstack_t;
|
||||
|
||||
|
|
Loading…
Reference in a new issue