mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: port occasional SDL2 calls to SDL3, no platform yet
This commit is contained in:
@@ -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.h> // SDL_GetWindowPosition
|
||||
#if XASH_SDL == 2
|
||||
#include <SDL2/SDL.h> // SDL_GetWindowPosition
|
||||
#elif XASH_SDL == 3
|
||||
#include <SDL3/SDL.h> // 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
|
||||
|
||||
|
||||
@@ -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 <SDL2/SDL.h>
|
||||
#elif XASH_SDL == 3
|
||||
#include <SDL3/SDL.h>
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include "input.h"
|
||||
#include "client.h"
|
||||
#include "vgui_draw.h"
|
||||
#include "cursor_type.h"
|
||||
|
||||
#if XASH_SDL
|
||||
#include <SDL.h>
|
||||
#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__ );
|
||||
|
||||
@@ -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.h> // SDL_GetBasePath
|
||||
#if XASH_SDL == 2
|
||||
#include <SDL2/SDL.h> // SDL_GetBasePath
|
||||
#elif XASH_SDL == 3
|
||||
#include <SDL3/SDL.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
@@ -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
|
||||
|
||||
@@ -23,8 +23,10 @@ GNU General Public License for more details.
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
#ifdef XASH_SDL
|
||||
#include <SDL.h>
|
||||
#if XASH_SDL == 2
|
||||
#include <SDL2/SDL.h>
|
||||
#elif XASH_SDL == 3
|
||||
#include <SDL3/SDL.h>
|
||||
#endif
|
||||
|
||||
#if XASH_POSIX
|
||||
|
||||
Reference in New Issue
Block a user