|
|
@ -83,14 +83,13 @@ void VGUI_InitCursors( void ) |
|
|
|
s_pDefaultCursor[dc_sizeall] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL); |
|
|
|
s_pDefaultCursor[dc_sizeall] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL); |
|
|
|
s_pDefaultCursor[dc_no] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO); |
|
|
|
s_pDefaultCursor[dc_no] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO); |
|
|
|
s_pDefaultCursor[dc_hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND); |
|
|
|
s_pDefaultCursor[dc_hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND); |
|
|
|
//host.mouse_visible = true;
|
|
|
|
|
|
|
|
SDL_SetCursor( s_pDefaultCursor[dc_arrow] ); |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GAME_EXPORT VGUI_CursorSelect(enum VGUI_DefaultCursor cursor ) |
|
|
|
void GAME_EXPORT VGUI_CursorSelect( enum VGUI_DefaultCursor cursor ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
qboolean visible; |
|
|
|
qboolean visible; |
|
|
|
|
|
|
|
|
|
|
|
if( cls.key_dest != key_game || cl.paused ) |
|
|
|
if( cls.key_dest != key_game || cl.paused ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
@ -101,35 +100,30 @@ void GAME_EXPORT VGUI_CursorSelect(enum VGUI_DefaultCursor cursor ) |
|
|
|
visible = false; |
|
|
|
visible = false; |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
visible = true; |
|
|
|
visible = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
host.mouse_visible = visible; |
|
|
|
|
|
|
|
|
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) |
|
|
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) |
|
|
|
/// TODO: platform cursors
|
|
|
|
/// TODO: platform cursors
|
|
|
|
|
|
|
|
|
|
|
|
if( CVAR_TO_BOOL( touch_emulate ) ) |
|
|
|
if( CVAR_TO_BOOL( touch_emulate ) ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if( host.mouse_visible ) |
|
|
|
if( host.mouse_visible ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SDL_SetRelativeMouseMode( SDL_FALSE ); |
|
|
|
|
|
|
|
SDL_SetCursor( s_pDefaultCursor[cursor] ); |
|
|
|
SDL_SetCursor( s_pDefaultCursor[cursor] ); |
|
|
|
SDL_ShowCursor( true ); |
|
|
|
SDL_ShowCursor( true ); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
SDL_ShowCursor( false ); |
|
|
|
SDL_ShowCursor( false ); |
|
|
|
if( host.mouse_visible ) |
|
|
|
|
|
|
|
SDL_GetRelativeMouseState( NULL, NULL ); |
|
|
|
|
|
|
|
Key_EnableTextInput( false, true ); |
|
|
|
Key_EnableTextInput( false, true ); |
|
|
|
} |
|
|
|
} |
|
|
|
//SDL_SetRelativeMouseMode(false);
|
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
if( s_currentCursor == cursor ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s_currentCursor = cursor; |
|
|
|
s_currentCursor = cursor; |
|
|
|
host.mouse_visible = visible; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
byte GAME_EXPORT VGUI_GetColor( int i, int j) |
|
|
|
byte GAME_EXPORT VGUI_GetColor( int i, int j) |
|
|
@ -138,18 +132,6 @@ byte GAME_EXPORT VGUI_GetColor( int i, int j) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Define and initialize vgui API
|
|
|
|
// Define and initialize vgui API
|
|
|
|
|
|
|
|
|
|
|
|
void GAME_EXPORT VGUI_SetVisible( qboolean state ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
host.mouse_visible=state; |
|
|
|
|
|
|
|
#ifdef XASH_SDL |
|
|
|
|
|
|
|
SDL_ShowCursor( state ); |
|
|
|
|
|
|
|
if( !state ) |
|
|
|
|
|
|
|
SDL_GetRelativeMouseState( NULL, NULL ); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
Key_EnableTextInput( false, true ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int GAME_EXPORT VGUI_UtfProcessChar( int in ) |
|
|
|
int GAME_EXPORT VGUI_UtfProcessChar( int in ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( CVAR_TO_BOOL( vgui_utf8 ) ) |
|
|
|
if( CVAR_TO_BOOL( vgui_utf8 ) ) |
|
|
@ -175,12 +157,10 @@ vguiapi_t vgui = |
|
|
|
NULL, // VGUI_GetTextureSizes,
|
|
|
|
NULL, // VGUI_GetTextureSizes,
|
|
|
|
NULL, // VGUI_GenerateTexture,
|
|
|
|
NULL, // VGUI_GenerateTexture,
|
|
|
|
VGUI_EngineMalloc, |
|
|
|
VGUI_EngineMalloc, |
|
|
|
/* VGUI_ShowCursor,
|
|
|
|
|
|
|
|
VGUI_HideCursor,*/ |
|
|
|
|
|
|
|
VGUI_CursorSelect, |
|
|
|
VGUI_CursorSelect, |
|
|
|
VGUI_GetColor, |
|
|
|
VGUI_GetColor, |
|
|
|
VGUI_IsInGame, |
|
|
|
VGUI_IsInGame, |
|
|
|
VGUI_SetVisible, |
|
|
|
NULL, |
|
|
|
VGUI_GetMousePos, |
|
|
|
VGUI_GetMousePos, |
|
|
|
VGUI_UtfProcessChar, |
|
|
|
VGUI_UtfProcessChar, |
|
|
|
NULL, |
|
|
|
NULL, |
|
|
|