mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
engine: platform: sdl: merge required SDL2 platform changes for new Android port from @Velaron's tree
This commit is contained in:
parent
d2237fa144
commit
1fdf6180e6
@ -25,7 +25,7 @@ GNU General Public License for more details.
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "vid_common.h"
|
#include "vid_common.h"
|
||||||
|
|
||||||
#if ! SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#if !SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
#define SDL_SCANCODE_A SDLK_a
|
#define SDL_SCANCODE_A SDLK_a
|
||||||
#define SDL_SCANCODE_Z SDLK_z
|
#define SDL_SCANCODE_Z SDLK_z
|
||||||
#define SDL_SCANCODE_1 SDLK_1
|
#define SDL_SCANCODE_1 SDLK_1
|
||||||
@ -150,6 +150,13 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
|||||||
#endif
|
#endif
|
||||||
qboolean numLock = SDL_GetModState() & KMOD_NUM;
|
qboolean numLock = SDL_GetModState() & KMOD_NUM;
|
||||||
|
|
||||||
|
#if XASH_ANDROID
|
||||||
|
if( keynum == SDL_SCANCODE_VOLUMEUP || keynum == SDL_SCANCODE_VOLUMEDOWN )
|
||||||
|
{
|
||||||
|
host.force_draw_version_time = host.realtime + FORCE_DRAW_VERSION_TIME;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if( SDL_IsTextInputActive() && down && cls.key_dest != key_game )
|
if( SDL_IsTextInputActive() && down && cls.key_dest != key_game )
|
||||||
{
|
{
|
||||||
if( SDL_GetModState() & KMOD_CTRL )
|
if( SDL_GetModState() & KMOD_CTRL )
|
||||||
@ -202,6 +209,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
|||||||
case SDL_SCANCODE_MINUS: keynum = '-'; break;
|
case SDL_SCANCODE_MINUS: keynum = '-'; break;
|
||||||
case SDL_SCANCODE_TAB: keynum = K_TAB; break;
|
case SDL_SCANCODE_TAB: keynum = K_TAB; break;
|
||||||
case SDL_SCANCODE_RETURN: keynum = K_ENTER; break;
|
case SDL_SCANCODE_RETURN: keynum = K_ENTER; break;
|
||||||
|
case SDL_SCANCODE_AC_BACK:
|
||||||
case SDL_SCANCODE_ESCAPE: keynum = K_ESCAPE; break;
|
case SDL_SCANCODE_ESCAPE: keynum = K_ESCAPE; break;
|
||||||
case SDL_SCANCODE_SPACE: keynum = K_SPACE; break;
|
case SDL_SCANCODE_SPACE: keynum = K_SPACE; break;
|
||||||
case SDL_SCANCODE_BACKSPACE: keynum = K_BACKSPACE; break;
|
case SDL_SCANCODE_BACKSPACE: keynum = K_BACKSPACE; break;
|
||||||
@ -261,6 +269,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
|||||||
case SDL_SCANCODE_VOLUMEDOWN:
|
case SDL_SCANCODE_VOLUMEDOWN:
|
||||||
case SDL_SCANCODE_BRIGHTNESSDOWN:
|
case SDL_SCANCODE_BRIGHTNESSDOWN:
|
||||||
case SDL_SCANCODE_BRIGHTNESSUP:
|
case SDL_SCANCODE_BRIGHTNESSUP:
|
||||||
|
case SDL_SCANCODE_SELECT:
|
||||||
return;
|
return;
|
||||||
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
case SDL_SCANCODE_UNKNOWN:
|
case SDL_SCANCODE_UNKNOWN:
|
||||||
@ -682,7 +691,11 @@ void Platform_RunEvents( void )
|
|||||||
|
|
||||||
void* Platform_GetNativeObject( const char *name )
|
void* Platform_GetNativeObject( const char *name )
|
||||||
{
|
{
|
||||||
return NULL; // SDL don't have it
|
#if XASH_ANDROID
|
||||||
|
return Android_GetNativeObject( name );
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -71,6 +71,8 @@ void Platform_Init( void )
|
|||||||
PSVita_Init();
|
PSVita_Init();
|
||||||
#elif XASH_NSWITCH
|
#elif XASH_NSWITCH
|
||||||
NSwitch_Init();
|
NSwitch_Init();
|
||||||
|
#elif XASH_ANDROID
|
||||||
|
Android_Init();
|
||||||
#endif
|
#endif
|
||||||
#endif // XASH_POSIX
|
#endif // XASH_POSIX
|
||||||
|
|
||||||
|
@ -628,7 +628,8 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
|
|||||||
if( glw_state.software )
|
if( glw_state.software )
|
||||||
wndFlags &= ~SDL_WINDOW_OPENGL;
|
wndFlags &= ~SDL_WINDOW_OPENGL;
|
||||||
|
|
||||||
if( !fullscreen )
|
#if !XASH_MOBILE_PLATFORM
|
||||||
|
if ( !fullscreen )
|
||||||
{
|
{
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
|
|
||||||
@ -663,6 +664,10 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
|
|||||||
wndFlags |= SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_GRABBED;
|
wndFlags |= SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_GRABBED;
|
||||||
xpos = ypos = 0;
|
xpos = ypos = 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wndFlags |= SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_INPUT_GRABBED;
|
||||||
|
xpos = ypos = SDL_WINDOWPOS_UNDEFINED;
|
||||||
|
#endif
|
||||||
|
|
||||||
while( glw_state.safe >= SAFE_NO && glw_state.safe < SAFE_LAST )
|
while( glw_state.safe >= SAFE_NO && glw_state.safe < SAFE_LAST )
|
||||||
{
|
{
|
||||||
@ -690,6 +695,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !XASH_MOBILE_PLATFORM
|
||||||
if( fullscreen )
|
if( fullscreen )
|
||||||
{
|
{
|
||||||
if( !VID_SetScreenResolution( width, height ) )
|
if( !VID_SetScreenResolution( width, height ) )
|
||||||
@ -701,6 +707,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
|
|||||||
{
|
{
|
||||||
VID_RestoreScreenResolution();
|
VID_RestoreScreenResolution();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if XASH_WIN32 // ICO support only for Win32
|
#if XASH_WIN32 // ICO support only for Win32
|
||||||
if(( localIcoPath = FS_GetDiskPath( GI->iconpath, true )))
|
if(( localIcoPath = FS_GetDiskPath( GI->iconpath, true )))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user