mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-30 16:54:29 +00:00
engine: dirty sdl1.2 port
This commit is contained in:
parent
8dafbaeda2
commit
9e99a2bc37
@ -27,17 +27,22 @@ SETUP BACKENDS DEFINITIONS
|
||||
*/
|
||||
#ifndef XASH_DEDICATED
|
||||
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
#ifndef XASH_TIMER
|
||||
#define XASH_TIMER TIMER_SDL
|
||||
#endif
|
||||
#else
|
||||
#ifndef XASH_TIMER
|
||||
#define XASH_TIMER TIMER_LINUX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef XASH_SDL
|
||||
// by default, use SDL subsystems
|
||||
#ifndef XASH_VIDEO
|
||||
#define XASH_VIDEO VIDEO_SDL
|
||||
#endif // XASH_VIDEO
|
||||
|
||||
#ifndef XASH_TIMER
|
||||
#define XASH_TIMER TIMER_SDL
|
||||
#endif
|
||||
|
||||
#ifndef XASH_INPUT
|
||||
#define XASH_INPUT INPUT_SDL
|
||||
#endif
|
||||
|
@ -1988,7 +1988,7 @@ static int pfnGetWindowCenterX( void )
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
SDL_GetWindowPosition( host.hWnd, &x, NULL );
|
||||
#endif
|
||||
|
||||
@ -2013,7 +2013,7 @@ static int pfnGetWindowCenterY( void )
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
SDL_GetWindowPosition( host.hWnd, NULL, &y );
|
||||
#endif
|
||||
|
||||
|
@ -1938,7 +1938,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
SDL_ShowWindow( host.hWnd );
|
||||
#endif
|
||||
args = MSG_ReadString( msg );
|
||||
|
@ -194,7 +194,7 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
||||
else if( newstate == key_game )
|
||||
{
|
||||
// reset mouse pos, so cancel effect in game
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
if( CVAR_TO_BOOL(touch_enable) )
|
||||
{
|
||||
SDL_SetRelativeMouseMode( SDL_FALSE );
|
||||
@ -214,7 +214,7 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
||||
|
||||
if( ( newstate == key_menu || newstate == key_console || newstate == key_message ) && ( !CL_IsBackgroundMap() || CL_IsBackgroundDemo( )))
|
||||
{
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
SDL_SetWindowGrab(host.hWnd, SDL_FALSE);
|
||||
if( clgame.dllFuncs.pfnLookEvent )
|
||||
SDL_SetRelativeMouseMode( SDL_FALSE );
|
||||
@ -316,7 +316,7 @@ void IN_DeactivateMouse( void )
|
||||
}
|
||||
|
||||
in_mouseactive = false;
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||
#endif
|
||||
}
|
||||
@ -416,7 +416,7 @@ void IN_MouseEvent( void )
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(XASH_SDL) && !defined(_WIN32)
|
||||
#if XASH_SDL == 2 && !defined(_WIN32)
|
||||
SDL_SetRelativeMouseMode( SDL_FALSE );
|
||||
SDL_ShowCursor( SDL_TRUE );
|
||||
#endif
|
||||
|
@ -72,7 +72,7 @@ void GAME_EXPORT VGUI_GetMousePos( int *_x, int *_y )
|
||||
void VGUI_InitCursors( void )
|
||||
{
|
||||
// load up all default cursors
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
s_pDefaultCursor[dc_none] = NULL;
|
||||
s_pDefaultCursor[dc_arrow] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
||||
s_pDefaultCursor[dc_ibeam] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM);
|
||||
@ -108,7 +108,7 @@ void GAME_EXPORT VGUI_CursorSelect(enum VGUI_DefaultCursor cursor )
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
/// TODO: platform cursors
|
||||
|
||||
if( CVAR_TO_BOOL( touch_emulate ) )
|
||||
|
@ -323,7 +323,7 @@ void Host_MemStats_f( void )
|
||||
|
||||
void Host_Minimize_f( void )
|
||||
{
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
if( host.hWnd ) SDL_MinimizeWindow( host.hWnd );
|
||||
#endif
|
||||
}
|
||||
@ -733,7 +733,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
#if TARGET_OS_IOS
|
||||
const char *IOS_GetDocsDir();
|
||||
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof(host.rootdir) );
|
||||
#elif defined(XASH_SDL)
|
||||
#elif XASH_SDL == 2
|
||||
char *szBasePath;
|
||||
|
||||
if( !( szBasePath = SDL_GetBasePath() ) )
|
||||
@ -817,15 +817,21 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
// should work even if it failed
|
||||
SDL_Init( SDL_INIT_TIMER );
|
||||
|
||||
#ifndef SDL_INIT_EVENTS
|
||||
#define SDL_INIT_EVENTS 0
|
||||
#endif
|
||||
|
||||
if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_EVENTS ) )
|
||||
{
|
||||
Sys_Warn( "SDL_Init failed: %s", SDL_GetError() );
|
||||
host.type = HOST_DEDICATED;
|
||||
}
|
||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
||||
|
||||
#if XASH_SDL == 2
|
||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
||||
SDL_StopTextInput();
|
||||
#endif
|
||||
#endif // XASH_SDL == 2
|
||||
#endif // XASH_SDL
|
||||
|
||||
if ( !host.rootdir[0] || SetCurrentDirectory( host.rootdir ) != 0)
|
||||
Con_Reportf( "%s is working directory now\n", host.rootdir );
|
||||
|
@ -426,7 +426,7 @@ void Sys_Error( const char *error, ... )
|
||||
|
||||
if( !Host_IsDedicated() )
|
||||
{
|
||||
#ifdef XASH_SDL
|
||||
#if XASH_SDL == 2
|
||||
if( host.hWnd ) SDL_HideWindow( host.hWnd );
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user