diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 04872c62..c8d7caaf 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -13,8 +13,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ -#if XASH_SDL -#include // SDL_GetWindowPosition +#if XASH_SDL == 2 +#include // SDL_GetWindowPosition +#elif XASH_SDL == 3 +#include // SDL_GetWindowPosition #endif // XASH_SDL #include "common.h" @@ -2083,6 +2085,7 @@ GetWindowCenterX static int GAME_EXPORT pfnGetWindowCenterX( void ) { int x = 0; + #if XASH_WIN32 if( m_ignore.value ) { @@ -2092,7 +2095,7 @@ static int GAME_EXPORT pfnGetWindowCenterX( void ) } #endif -#if XASH_SDL == 2 +#if XASH_SDL >= 2 SDL_GetWindowPosition( host.hWnd, &x, NULL ); #endif @@ -2108,6 +2111,7 @@ GetWindowCenterY static int GAME_EXPORT pfnGetWindowCenterY( void ) { int y = 0; + #if XASH_WIN32 if( m_ignore.value ) { @@ -2117,7 +2121,7 @@ static int GAME_EXPORT pfnGetWindowCenterY( void ) } #endif -#if XASH_SDL == 2 +#if XASH_SDL >= 2 SDL_GetWindowPosition( host.hWnd, NULL, &y ); #endif diff --git a/engine/client/input.c b/engine/client/input.c index 5c1489d5..28e7c7f8 100644 --- a/engine/client/input.c +++ b/engine/client/input.c @@ -13,16 +13,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ +#if XASH_SDL == 2 +#include +#elif XASH_SDL == 3 +#include +#endif + #include "common.h" #include "input.h" #include "client.h" #include "vgui_draw.h" #include "cursor_type.h" - -#if XASH_SDL -#include -#endif - #include "platform/platform.h" void* in_mousecursor; @@ -212,20 +213,29 @@ void IN_SetRelativeMouseMode( qboolean set ) if( set && !s_bRawInput ) { -#if XASH_SDL == 2 +#if XASH_SDL >= 2 SDL_GetRelativeMouseState( NULL, NULL ); +#if XASH_SDL == 2 SDL_SetRelativeMouseMode( SDL_TRUE ); -#endif +#else // XASH_SDL != 2 + SDL_SetWindowRelativeMouseMode( host.hWnd, true ); +#endif // XASH_SDL != 2 +#endif // XASH_SDL >= 2 s_bRawInput = true; if( verbose ) Con_Printf( "%s: true\n", __func__ ); } else if( !set && s_bRawInput ) { -#if XASH_SDL == 2 +#if XASH_SDL >= 2 SDL_GetRelativeMouseState( NULL, NULL ); +#if XASH_SDL == 2 SDL_SetRelativeMouseMode( SDL_FALSE ); -#endif +#else // XASH_SDL != 2 + SDL_SetWindowRelativeMouseMode( host.hWnd, false ); +#endif // XASH_SDL != 2 +#endif // XASH_SDL >= 2 + s_bRawInput = false; if( verbose ) Con_Printf( "%s: false\n", __func__ ); diff --git a/engine/common/filesystem_engine.c b/engine/common/filesystem_engine.c index 83d55484..93f1c727 100644 --- a/engine/common/filesystem_engine.c +++ b/engine/common/filesystem_engine.c @@ -16,8 +16,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ -#if XASH_SDL -#include // SDL_GetBasePath +#if XASH_SDL == 2 +#include // SDL_GetBasePath +#elif XASH_SDL == 3 +#include #endif #include @@ -209,7 +211,7 @@ static qboolean FS_DetermineRootDirectory( char *out, size_t size ) return true; Sys_Error( "couldn't find %s data directory", XASH_ENGINE_NAME ); return false; -#elif ( XASH_SDL == 2 ) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2 +#elif ( XASH_SDL >= 2 ) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2 path = SDL_GetBasePath(); #if XASH_APPLE diff --git a/engine/common/system.c b/engine/common/system.c index 229aa8cc..efdb7768 100644 --- a/engine/common/system.c +++ b/engine/common/system.c @@ -23,8 +23,10 @@ GNU General Public License for more details. #include #endif -#ifdef XASH_SDL -#include +#if XASH_SDL == 2 +#include +#elif XASH_SDL == 3 +#include #endif #if XASH_POSIX