mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-20 03:50:08 +00:00
engine: client: vgui: rework loading VGUI and probing client for internal vgui support API
This commit is contained in:
parent
b1ee27a3f3
commit
d27dd68072
@ -3937,10 +3937,6 @@ qboolean CL_LoadProgs( const char *name )
|
|||||||
clgame.mempool = Mem_AllocPool( "Client Edicts Zone" );
|
clgame.mempool = Mem_AllocPool( "Client Edicts Zone" );
|
||||||
clgame.entities = NULL;
|
clgame.entities = NULL;
|
||||||
|
|
||||||
// NOTE: important stuff!
|
|
||||||
// vgui must startup BEFORE loading client.dll to avoid get error ERROR_NOACESS
|
|
||||||
// during LoadLibrary
|
|
||||||
VGui_Startup( name, gameui.globals->scrWidth, gameui.globals->scrHeight );
|
|
||||||
|
|
||||||
// a1ba: we need to check if client.dll has direct dependency on SDL2
|
// a1ba: we need to check if client.dll has direct dependency on SDL2
|
||||||
// and if so, disable relative mouse mode
|
// and if so, disable relative mouse mode
|
||||||
@ -3959,8 +3955,29 @@ qboolean CL_LoadProgs( const char *name )
|
|||||||
clgame.client_dll_uses_sdl = true;
|
clgame.client_dll_uses_sdl = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// NOTE: important stuff!
|
||||||
|
// vgui must startup BEFORE loading client.dll to avoid get error ERROR_NOACESS
|
||||||
|
// during LoadLibrary
|
||||||
|
if( !GI->internal_vgui_support && VGui_LoadProgs( NULL ))
|
||||||
|
{
|
||||||
|
VGui_Startup( refState.width, refState.height );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we failed to load vgui_support, but let's probe client.dll for support anyway
|
||||||
|
GI->internal_vgui_support = true;
|
||||||
|
}
|
||||||
|
|
||||||
clgame.hInstance = COM_LoadLibrary( name, false, false );
|
clgame.hInstance = COM_LoadLibrary( name, false, false );
|
||||||
if( !clgame.hInstance ) return false;
|
|
||||||
|
if( !clgame.hInstance )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// delayed vgui initialization for internal support
|
||||||
|
if( GI->internal_vgui_support && VGui_LoadProgs( NULL ))
|
||||||
|
{
|
||||||
|
VGui_Startup( refState.width, refState.height );
|
||||||
|
}
|
||||||
|
|
||||||
// clear exports
|
// clear exports
|
||||||
for( func = cdll_exports; func && func->name; func++ )
|
for( func = cdll_exports; func && func->name; func++ )
|
||||||
|
@ -3063,9 +3063,6 @@ void Host_ClientFrame( void )
|
|||||||
// catch changes video settings
|
// catch changes video settings
|
||||||
VID_CheckChanges();
|
VID_CheckChanges();
|
||||||
|
|
||||||
// process VGUI
|
|
||||||
VGui_RunFrame ();
|
|
||||||
|
|
||||||
// update the screen
|
// update the screen
|
||||||
SCR_UpdateScreen ();
|
SCR_UpdateScreen ();
|
||||||
|
|
||||||
|
@ -780,7 +780,6 @@ SCR_VidInit
|
|||||||
*/
|
*/
|
||||||
void SCR_VidInit( void )
|
void SCR_VidInit( void )
|
||||||
{
|
{
|
||||||
string libpath;
|
|
||||||
if( !ref.initialized ) // don't call VidInit too soon
|
if( !ref.initialized ) // don't call VidInit too soon
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -795,8 +794,11 @@ void SCR_VidInit( void )
|
|||||||
gameui.globals->scrHeight = refState.height;
|
gameui.globals->scrHeight = refState.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
COM_GetCommonLibraryPath( LIBRARY_CLIENT, libpath, sizeof( libpath ));
|
// notify vgui about screen size change
|
||||||
VGui_Startup( libpath, refState.width, refState.height );
|
if( clgame.hInstance )
|
||||||
|
{
|
||||||
|
VGui_Startup( refState.width, refState.height );
|
||||||
|
}
|
||||||
|
|
||||||
CL_ClearSpriteTextures(); // now all hud sprites are invalid
|
CL_ClearSpriteTextures(); // now all hud sprites are invalid
|
||||||
|
|
||||||
|
@ -23,93 +23,101 @@ GNU General Public License for more details.
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
static enum VGUI_KeyCode s_pVirtualKeyTrans[256];
|
CVAR_DEFINE_AUTO( vgui_utf8, "0", FCVAR_ARCHIVE, "enable utf-8 support for vgui text" );
|
||||||
static VGUI_DefaultCursor s_currentCursor = -1;
|
|
||||||
static HINSTANCE s_pVGuiSupport; // vgui_support library
|
|
||||||
static convar_t *vgui_utf8 = NULL;
|
|
||||||
|
|
||||||
void GAME_EXPORT *VGUI_EngineMalloc(size_t size)
|
static void GAME_EXPORT *VGUI_EngineMalloc( size_t size );
|
||||||
|
static void GAME_EXPORT VGUI_GetMousePos( int *, int * );
|
||||||
|
static void GAME_EXPORT VGUI_CursorSelect( VGUI_DefaultCursor );
|
||||||
|
static byte GAME_EXPORT VGUI_GetColor( int, int );
|
||||||
|
static int GAME_EXPORT VGUI_UtfProcessChar( int in );
|
||||||
|
static qboolean GAME_EXPORT VGUI_IsInGame( void );
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
qboolean initialized;
|
||||||
|
vguiapi_t dllFuncs;
|
||||||
|
VGUI_DefaultCursor cursor;
|
||||||
|
|
||||||
|
HINSTANCE hInstance;
|
||||||
|
|
||||||
|
enum VGUI_KeyCode virtualKeyTrans[256];
|
||||||
|
} vgui =
|
||||||
|
{
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
false, // Not initialized yet
|
||||||
|
NULL, // VGUI_DrawInit,
|
||||||
|
NULL, // VGUI_DrawShutdown,
|
||||||
|
NULL, // VGUI_SetupDrawingText,
|
||||||
|
NULL, // VGUI_SetupDrawingRect,
|
||||||
|
NULL, // VGUI_SetupDrawingImage,
|
||||||
|
NULL, // VGUI_BindTexture,
|
||||||
|
NULL, // VGUI_EnableTexture,
|
||||||
|
NULL, // VGUI_CreateTexture,
|
||||||
|
NULL, // VGUI_UploadTexture,
|
||||||
|
NULL, // VGUI_UploadTextureBlock,
|
||||||
|
NULL, // VGUI_DrawQuad,
|
||||||
|
NULL, // VGUI_GetTextureSizes,
|
||||||
|
NULL, // VGUI_GenerateTexture,
|
||||||
|
VGUI_EngineMalloc,
|
||||||
|
VGUI_CursorSelect,
|
||||||
|
VGUI_GetColor,
|
||||||
|
VGUI_IsInGame,
|
||||||
|
NULL,
|
||||||
|
VGUI_GetMousePos,
|
||||||
|
VGUI_UtfProcessChar,
|
||||||
|
Platform_GetClipboardText,
|
||||||
|
Platform_SetClipboardText,
|
||||||
|
Platform_GetKeyModifiers,
|
||||||
|
},
|
||||||
|
-1
|
||||||
|
};
|
||||||
|
|
||||||
|
static void GAME_EXPORT *VGUI_EngineMalloc( size_t size )
|
||||||
{
|
{
|
||||||
return Z_Malloc( size );
|
return Z_Malloc( size );
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean GAME_EXPORT VGUI_IsInGame( void )
|
static qboolean GAME_EXPORT VGUI_IsInGame( void )
|
||||||
{
|
{
|
||||||
return cls.state == ca_active && cls.key_dest == key_game;
|
return cls.state == ca_active && cls.key_dest == key_game;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GAME_EXPORT VGUI_GetMousePos( int *_x, int *_y )
|
static void GAME_EXPORT VGUI_GetMousePos( int *_x, int *_y )
|
||||||
{
|
{
|
||||||
float xscale = (float)refState.width / (float)clgame.scrInfo.iWidth;
|
float xscale = (float)refState.width / (float)clgame.scrInfo.iWidth;
|
||||||
float yscale = (float)refState.height / (float)clgame.scrInfo.iHeight;
|
float yscale = (float)refState.height / (float)clgame.scrInfo.iHeight;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
Platform_GetMousePos( &x, &y );
|
Platform_GetMousePos( &x, &y );
|
||||||
*_x = x / xscale, *_y = y / yscale;
|
*_x = x / xscale;
|
||||||
|
*_y = y / yscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GAME_EXPORT VGUI_CursorSelect( VGUI_DefaultCursor cursor )
|
static void GAME_EXPORT VGUI_CursorSelect( VGUI_DefaultCursor cursor )
|
||||||
{
|
{
|
||||||
if( s_currentCursor != cursor )
|
if( vgui.cursor != cursor )
|
||||||
Platform_SetCursorType( cursor );
|
Platform_SetCursorType( cursor );
|
||||||
}
|
}
|
||||||
|
|
||||||
byte GAME_EXPORT VGUI_GetColor( int i, int j)
|
static byte GAME_EXPORT VGUI_GetColor( int i, int j )
|
||||||
{
|
{
|
||||||
return g_color_table[i][j];
|
return g_color_table[i][j];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define and initialize vgui API
|
static int GAME_EXPORT VGUI_UtfProcessChar( int in )
|
||||||
int GAME_EXPORT VGUI_UtfProcessChar( int in )
|
|
||||||
{
|
{
|
||||||
if( CVAR_TO_BOOL( vgui_utf8 ))
|
if( vgui_utf8.value )
|
||||||
return Con_UtfProcessCharForce( in );
|
return Con_UtfProcessCharForce( in );
|
||||||
else
|
return in;
|
||||||
return in;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vguiapi_t vgui =
|
|
||||||
{
|
|
||||||
false, // Not initialized yet
|
|
||||||
NULL, // VGUI_DrawInit,
|
|
||||||
NULL, // VGUI_DrawShutdown,
|
|
||||||
NULL, // VGUI_SetupDrawingText,
|
|
||||||
NULL, // VGUI_SetupDrawingRect,
|
|
||||||
NULL, // VGUI_SetupDrawingImage,
|
|
||||||
NULL, // VGUI_BindTexture,
|
|
||||||
NULL, // VGUI_EnableTexture,
|
|
||||||
NULL, // VGUI_CreateTexture,
|
|
||||||
NULL, // VGUI_UploadTexture,
|
|
||||||
NULL, // VGUI_UploadTextureBlock,
|
|
||||||
NULL, // VGUI_DrawQuad,
|
|
||||||
NULL, // VGUI_GetTextureSizes,
|
|
||||||
NULL, // VGUI_GenerateTexture,
|
|
||||||
VGUI_EngineMalloc,
|
|
||||||
VGUI_CursorSelect,
|
|
||||||
VGUI_GetColor,
|
|
||||||
VGUI_IsInGame,
|
|
||||||
NULL,
|
|
||||||
VGUI_GetMousePos,
|
|
||||||
VGUI_UtfProcessChar,
|
|
||||||
Platform_GetClipboardText,
|
|
||||||
Platform_SetClipboardText,
|
|
||||||
Platform_GetKeyModifiers,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
qboolean VGui_IsActive( void )
|
qboolean VGui_IsActive( void )
|
||||||
{
|
{
|
||||||
return vgui.initialized;
|
return vgui.initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VGui_FillAPIFromRef( vguiapi_t *to, const ref_interface_t *from )
|
static void VGui_FillAPIFromRef( vguiapi_t *to, const ref_interface_t *from )
|
||||||
{
|
{
|
||||||
to->DrawInit = from->VGUI_DrawInit;
|
to->DrawInit = from->VGUI_DrawInit;
|
||||||
to->DrawShutdown = from->VGUI_DrawShutdown;
|
to->DrawShutdown = from->VGUI_DrawShutdown;
|
||||||
@ -126,136 +134,86 @@ void VGui_FillAPIFromRef( vguiapi_t *to, const ref_interface_t *from )
|
|||||||
to->GenerateTexture = from->VGUI_GenerateTexture;
|
to->GenerateTexture = from->VGUI_GenerateTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VGui_RegisterCvars( void )
|
||||||
|
{
|
||||||
|
Cvar_RegisterVariable( &vgui_utf8 );
|
||||||
|
}
|
||||||
|
|
||||||
|
qboolean VGui_LoadProgs( HINSTANCE hInstance )
|
||||||
|
{
|
||||||
|
void (*F)( vguiapi_t* );
|
||||||
|
qboolean client = hInstance != NULL;
|
||||||
|
|
||||||
|
// not loading interface from client.dll, load vgui_support.dll instead
|
||||||
|
if( !client )
|
||||||
|
{
|
||||||
|
string vguiloader, vguilib;
|
||||||
|
|
||||||
|
// HACKHACK: try to load path from custom path
|
||||||
|
// to support having different versions of VGUI
|
||||||
|
if( Sys_GetParmFromCmdLine( "-vguilib", vguilib ) && !COM_LoadLibrary( vguilib, false, false ))
|
||||||
|
{
|
||||||
|
Con_Reportf( S_WARN "VGUI preloading failed. Default library will be used! Reason: %s", COM_GetLibraryError());
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !Sys_GetParmFromCmdLine( "-vguiloader", vguiloader ))
|
||||||
|
{
|
||||||
|
Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, sizeof( vguiloader ));
|
||||||
|
}
|
||||||
|
|
||||||
|
hInstance = vgui.hInstance = COM_LoadLibrary( vguiloader, false, false );
|
||||||
|
|
||||||
|
if( !vgui.hInstance )
|
||||||
|
{
|
||||||
|
if( FS_FileExists( vguiloader, false ))
|
||||||
|
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s\n", COM_GetLibraryError() );
|
||||||
|
else Con_Reportf( "vgui_support: not found\n" );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// try legacy API first
|
||||||
|
F = COM_GetProcAddress( hInstance, client ? "InitVGUISupportAPI" : "InitAPI" );
|
||||||
|
|
||||||
|
if( F )
|
||||||
|
{
|
||||||
|
VGui_FillAPIFromRef( &vgui.dllFuncs, &ref.dllFuncs );
|
||||||
|
F( &vgui.dllFuncs );
|
||||||
|
|
||||||
|
vgui.initialized = vgui.dllFuncs.initialized = true;
|
||||||
|
Con_Reportf( "vgui_support: initialized legacy API in %s module\n", client ? "client" : "support" );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Con_Reportf( S_ERROR "Failed to find VGUI support API entry point in %s module\n", client ? "client" : "support" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
VGui_Startup
|
VGui_Startup
|
||||||
|
|
||||||
Load vgui_support library and call VGui_Startup
|
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void VGui_Startup( const char *clientlib, int width, int height )
|
void VGui_Startup( int width, int height )
|
||||||
{
|
{
|
||||||
static qboolean failed = false;
|
// vgui not initialized from both support and client modules, skip
|
||||||
|
if( !vgui.initialized )
|
||||||
void (*F) ( vguiapi_t * );
|
|
||||||
char vguiloader[256];
|
|
||||||
char vguilib[256];
|
|
||||||
|
|
||||||
vguiloader[0] = vguilib[0] = '\0';
|
|
||||||
|
|
||||||
if( failed )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !vgui.initialized )
|
height = Q_min( 480, height );
|
||||||
{
|
|
||||||
vgui_utf8 = Cvar_Get( "vgui_utf8", "0", FCVAR_ARCHIVE, "enable utf-8 support for vgui text" );
|
|
||||||
|
|
||||||
VGui_FillAPIFromRef( &vgui, &ref.dllFuncs );
|
if( width <= 640 ) width = 640;
|
||||||
|
else if( width <= 800 ) width = 800;
|
||||||
|
else if( width <= 1024 ) width = 1024;
|
||||||
|
else if( width <= 1152 ) width = 1152;
|
||||||
|
else if( width <= 1280 ) width = 1280;
|
||||||
|
else if( width <= 1600 ) width = 1600;
|
||||||
|
|
||||||
s_pVGuiSupport = COM_LoadLibrary( clientlib, false, false );
|
if( vgui.dllFuncs.Startup )
|
||||||
|
vgui.dllFuncs.Startup( width, height );
|
||||||
if( s_pVGuiSupport )
|
|
||||||
{
|
|
||||||
F = COM_GetProcAddress( s_pVGuiSupport, "InitVGUISupportAPI" );
|
|
||||||
if( F )
|
|
||||||
{
|
|
||||||
F( &vgui );
|
|
||||||
vgui.initialized = true;
|
|
||||||
Con_Reportf( "vgui_support: found internal client support\n" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
COM_FreeLibrary( s_pVGuiSupport );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !vgui.initialized )
|
|
||||||
{
|
|
||||||
// HACKHACK: load vgui with correct path first if specified.
|
|
||||||
// it will be reused while resolving vgui support and client deps
|
|
||||||
if( Sys_GetParmFromCmdLine( "-vguilib", vguilib ))
|
|
||||||
{
|
|
||||||
if( Q_strstr( vguilib, ".dll" ))
|
|
||||||
Q_strncpy( vguiloader, "vgui_support.dll", 256 );
|
|
||||||
else
|
|
||||||
Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 );
|
|
||||||
|
|
||||||
if( !COM_LoadLibrary( vguilib, false, false ))
|
|
||||||
Con_Reportf( S_WARN "VGUI preloading failed. Default library will be used! Reason: %s\n", COM_GetLibraryError() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( Q_strstr( clientlib, ".dll" ))
|
|
||||||
Q_strncpy( vguiloader, "vgui_support.dll", 256 );
|
|
||||||
|
|
||||||
if( !vguiloader[0] && !Sys_GetParmFromCmdLine( "-vguiloader", vguiloader ))
|
|
||||||
Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 );
|
|
||||||
|
|
||||||
s_pVGuiSupport = COM_LoadLibrary( vguiloader, false, false );
|
|
||||||
|
|
||||||
if( !s_pVGuiSupport )
|
|
||||||
{
|
|
||||||
s_pVGuiSupport = COM_LoadLibrary( va( "../%s", vguiloader ), false, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !s_pVGuiSupport )
|
|
||||||
{
|
|
||||||
if( FS_FileExists( vguiloader, false ))
|
|
||||||
{
|
|
||||||
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s\n", COM_GetLibraryError() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Con_Reportf( "vgui_support: not found\n" );
|
|
||||||
}
|
|
||||||
failed = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
F = COM_GetProcAddress( s_pVGuiSupport, "InitAPI" );
|
|
||||||
if( F )
|
|
||||||
{
|
|
||||||
F( &vgui );
|
|
||||||
vgui.initialized = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Con_Reportf( S_ERROR "Failed to find vgui_support library entry point!\n" );
|
|
||||||
failed = true;
|
|
||||||
COM_FreeLibrary( s_pVGuiSupport );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( height < 480 )
|
|
||||||
height = 480;
|
|
||||||
|
|
||||||
if( width <= 640 )
|
|
||||||
width = 640;
|
|
||||||
else if( width <= 800 )
|
|
||||||
width = 800;
|
|
||||||
else if( width <= 1024 )
|
|
||||||
width = 1024;
|
|
||||||
else if( width <= 1152 )
|
|
||||||
width = 1152;
|
|
||||||
else if( width <= 1280 )
|
|
||||||
width = 1280;
|
|
||||||
else if( width <= 1600 )
|
|
||||||
width = 1600;
|
|
||||||
#ifdef XASH_DLL_LOADER
|
|
||||||
else if ( Q_strstr( vguiloader, ".dll" ) )
|
|
||||||
width = 1600;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if( vgui.initialized )
|
|
||||||
{
|
|
||||||
vgui.Startup( width, height );
|
|
||||||
}
|
|
||||||
else if ( COM_CheckString( clientlib ) )
|
|
||||||
{
|
|
||||||
failed = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -269,146 +227,138 @@ Unload vgui_support library and call VGui_Shutdown
|
|||||||
*/
|
*/
|
||||||
void VGui_Shutdown( void )
|
void VGui_Shutdown( void )
|
||||||
{
|
{
|
||||||
if( vgui.Shutdown )
|
if( vgui.dllFuncs.Shutdown )
|
||||||
vgui.Shutdown();
|
vgui.dllFuncs.Shutdown();
|
||||||
|
|
||||||
if( s_pVGuiSupport )
|
if( vgui.hInstance )
|
||||||
COM_FreeLibrary( s_pVGuiSupport );
|
COM_FreeLibrary( vgui.hInstance );
|
||||||
s_pVGuiSupport = NULL;
|
|
||||||
|
|
||||||
|
vgui.hInstance = NULL;
|
||||||
vgui.initialized = false;
|
vgui.initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void VGUI_InitKeyTranslationTable( void )
|
static void VGUI_InitKeyTranslationTable( void )
|
||||||
{
|
{
|
||||||
static qboolean bInitted = false;
|
static qboolean initialized = false;
|
||||||
|
|
||||||
if( bInitted )
|
if( initialized ) return;
|
||||||
return;
|
|
||||||
bInitted = true;
|
initialized = true;
|
||||||
|
|
||||||
// set virtual key translation table
|
// set virtual key translation table
|
||||||
memset( s_pVirtualKeyTrans, -1, sizeof( s_pVirtualKeyTrans ) );
|
memset( vgui.virtualKeyTrans, -1, sizeof( vgui.virtualKeyTrans ) );
|
||||||
|
|
||||||
s_pVirtualKeyTrans['0'] = KEY_0;
|
// TODO: engine keys are not enough here!
|
||||||
s_pVirtualKeyTrans['1'] = KEY_1;
|
// make crossplatform way to pass SDL keys here
|
||||||
s_pVirtualKeyTrans['2'] = KEY_2;
|
|
||||||
s_pVirtualKeyTrans['3'] = KEY_3;
|
|
||||||
s_pVirtualKeyTrans['4'] = KEY_4;
|
|
||||||
s_pVirtualKeyTrans['5'] = KEY_5;
|
|
||||||
s_pVirtualKeyTrans['6'] = KEY_6;
|
|
||||||
s_pVirtualKeyTrans['7'] = KEY_7;
|
|
||||||
s_pVirtualKeyTrans['8'] = KEY_8;
|
|
||||||
s_pVirtualKeyTrans['9'] = KEY_9;
|
|
||||||
s_pVirtualKeyTrans['A'] = s_pVirtualKeyTrans['a'] = KEY_A;
|
|
||||||
s_pVirtualKeyTrans['B'] = s_pVirtualKeyTrans['b'] = KEY_B;
|
|
||||||
s_pVirtualKeyTrans['C'] = s_pVirtualKeyTrans['c'] = KEY_C;
|
|
||||||
s_pVirtualKeyTrans['D'] = s_pVirtualKeyTrans['d'] = KEY_D;
|
|
||||||
s_pVirtualKeyTrans['E'] = s_pVirtualKeyTrans['e'] = KEY_E;
|
|
||||||
s_pVirtualKeyTrans['F'] = s_pVirtualKeyTrans['f'] = KEY_F;
|
|
||||||
s_pVirtualKeyTrans['G'] = s_pVirtualKeyTrans['g'] = KEY_G;
|
|
||||||
s_pVirtualKeyTrans['H'] = s_pVirtualKeyTrans['h'] = KEY_H;
|
|
||||||
s_pVirtualKeyTrans['I'] = s_pVirtualKeyTrans['i'] = KEY_I;
|
|
||||||
s_pVirtualKeyTrans['J'] = s_pVirtualKeyTrans['j'] = KEY_J;
|
|
||||||
s_pVirtualKeyTrans['K'] = s_pVirtualKeyTrans['k'] = KEY_K;
|
|
||||||
s_pVirtualKeyTrans['L'] = s_pVirtualKeyTrans['l'] = KEY_L;
|
|
||||||
s_pVirtualKeyTrans['M'] = s_pVirtualKeyTrans['m'] = KEY_M;
|
|
||||||
s_pVirtualKeyTrans['N'] = s_pVirtualKeyTrans['n'] = KEY_N;
|
|
||||||
s_pVirtualKeyTrans['O'] = s_pVirtualKeyTrans['o'] = KEY_O;
|
|
||||||
s_pVirtualKeyTrans['P'] = s_pVirtualKeyTrans['p'] = KEY_P;
|
|
||||||
s_pVirtualKeyTrans['Q'] = s_pVirtualKeyTrans['q'] = KEY_Q;
|
|
||||||
s_pVirtualKeyTrans['R'] = s_pVirtualKeyTrans['r'] = KEY_R;
|
|
||||||
s_pVirtualKeyTrans['S'] = s_pVirtualKeyTrans['s'] = KEY_S;
|
|
||||||
s_pVirtualKeyTrans['T'] = s_pVirtualKeyTrans['t'] = KEY_T;
|
|
||||||
s_pVirtualKeyTrans['U'] = s_pVirtualKeyTrans['u'] = KEY_U;
|
|
||||||
s_pVirtualKeyTrans['V'] = s_pVirtualKeyTrans['v'] = KEY_V;
|
|
||||||
s_pVirtualKeyTrans['W'] = s_pVirtualKeyTrans['w'] = KEY_W;
|
|
||||||
s_pVirtualKeyTrans['X'] = s_pVirtualKeyTrans['x'] = KEY_X;
|
|
||||||
s_pVirtualKeyTrans['Y'] = s_pVirtualKeyTrans['y'] = KEY_Y;
|
|
||||||
s_pVirtualKeyTrans['Z'] = s_pVirtualKeyTrans['z'] = KEY_Z;
|
|
||||||
|
|
||||||
s_pVirtualKeyTrans[K_KP_5 - 5] = KEY_PAD_0;
|
vgui.virtualKeyTrans['0'] = KEY_0;
|
||||||
s_pVirtualKeyTrans[K_KP_5 - 4] = KEY_PAD_1;
|
vgui.virtualKeyTrans['1'] = KEY_1;
|
||||||
s_pVirtualKeyTrans[K_KP_5 - 3] = KEY_PAD_2;
|
vgui.virtualKeyTrans['2'] = KEY_2;
|
||||||
s_pVirtualKeyTrans[K_KP_5 - 2] = KEY_PAD_3;
|
vgui.virtualKeyTrans['3'] = KEY_3;
|
||||||
s_pVirtualKeyTrans[K_KP_5 - 1] = KEY_PAD_4;
|
vgui.virtualKeyTrans['4'] = KEY_4;
|
||||||
s_pVirtualKeyTrans[K_KP_5 - 0] = KEY_PAD_5;
|
vgui.virtualKeyTrans['5'] = KEY_5;
|
||||||
s_pVirtualKeyTrans[K_KP_5 + 1] = KEY_PAD_6;
|
vgui.virtualKeyTrans['6'] = KEY_6;
|
||||||
s_pVirtualKeyTrans[K_KP_5 + 2] = KEY_PAD_7;
|
vgui.virtualKeyTrans['7'] = KEY_7;
|
||||||
s_pVirtualKeyTrans[K_KP_5 + 3] = KEY_PAD_8;
|
vgui.virtualKeyTrans['8'] = KEY_8;
|
||||||
s_pVirtualKeyTrans[K_KP_5 + 4] = KEY_PAD_9;
|
vgui.virtualKeyTrans['9'] = KEY_9;
|
||||||
s_pVirtualKeyTrans[K_KP_SLASH] = KEY_PAD_DIVIDE;
|
vgui.virtualKeyTrans['A'] = vgui.virtualKeyTrans['a'] = KEY_A;
|
||||||
s_pVirtualKeyTrans['*'] = KEY_PAD_MULTIPLY;
|
vgui.virtualKeyTrans['B'] = vgui.virtualKeyTrans['b'] = KEY_B;
|
||||||
s_pVirtualKeyTrans[K_KP_MINUS] = KEY_PAD_MINUS;
|
vgui.virtualKeyTrans['C'] = vgui.virtualKeyTrans['c'] = KEY_C;
|
||||||
s_pVirtualKeyTrans[K_KP_PLUS] = KEY_PAD_PLUS;
|
vgui.virtualKeyTrans['D'] = vgui.virtualKeyTrans['d'] = KEY_D;
|
||||||
s_pVirtualKeyTrans[K_KP_ENTER] = KEY_PAD_ENTER;
|
vgui.virtualKeyTrans['E'] = vgui.virtualKeyTrans['e'] = KEY_E;
|
||||||
//s_pVirtualKeyTrans[K_KP_DECIMAL] = KEY_PAD_DECIMAL;
|
vgui.virtualKeyTrans['F'] = vgui.virtualKeyTrans['f'] = KEY_F;
|
||||||
s_pVirtualKeyTrans['['] = KEY_LBRACKET;
|
vgui.virtualKeyTrans['G'] = vgui.virtualKeyTrans['g'] = KEY_G;
|
||||||
s_pVirtualKeyTrans[']'] = KEY_RBRACKET;
|
vgui.virtualKeyTrans['H'] = vgui.virtualKeyTrans['h'] = KEY_H;
|
||||||
s_pVirtualKeyTrans[';'] = KEY_SEMICOLON;
|
vgui.virtualKeyTrans['I'] = vgui.virtualKeyTrans['i'] = KEY_I;
|
||||||
s_pVirtualKeyTrans['\''] = KEY_APOSTROPHE;
|
vgui.virtualKeyTrans['J'] = vgui.virtualKeyTrans['j'] = KEY_J;
|
||||||
s_pVirtualKeyTrans['`'] = KEY_BACKQUOTE;
|
vgui.virtualKeyTrans['K'] = vgui.virtualKeyTrans['k'] = KEY_K;
|
||||||
s_pVirtualKeyTrans[','] = KEY_COMMA;
|
vgui.virtualKeyTrans['L'] = vgui.virtualKeyTrans['l'] = KEY_L;
|
||||||
s_pVirtualKeyTrans['.'] = KEY_PERIOD;
|
vgui.virtualKeyTrans['M'] = vgui.virtualKeyTrans['m'] = KEY_M;
|
||||||
s_pVirtualKeyTrans[K_KP_SLASH] = KEY_SLASH;
|
vgui.virtualKeyTrans['N'] = vgui.virtualKeyTrans['n'] = KEY_N;
|
||||||
s_pVirtualKeyTrans['\\'] = KEY_BACKSLASH;
|
vgui.virtualKeyTrans['O'] = vgui.virtualKeyTrans['o'] = KEY_O;
|
||||||
s_pVirtualKeyTrans['-'] = KEY_MINUS;
|
vgui.virtualKeyTrans['P'] = vgui.virtualKeyTrans['p'] = KEY_P;
|
||||||
s_pVirtualKeyTrans['='] = KEY_EQUAL;
|
vgui.virtualKeyTrans['Q'] = vgui.virtualKeyTrans['q'] = KEY_Q;
|
||||||
s_pVirtualKeyTrans[K_ENTER] = KEY_ENTER;
|
vgui.virtualKeyTrans['R'] = vgui.virtualKeyTrans['r'] = KEY_R;
|
||||||
s_pVirtualKeyTrans[K_SPACE] = KEY_SPACE;
|
vgui.virtualKeyTrans['S'] = vgui.virtualKeyTrans['s'] = KEY_S;
|
||||||
s_pVirtualKeyTrans[K_BACKSPACE] = KEY_BACKSPACE;
|
vgui.virtualKeyTrans['T'] = vgui.virtualKeyTrans['t'] = KEY_T;
|
||||||
s_pVirtualKeyTrans[K_TAB] = KEY_TAB;
|
vgui.virtualKeyTrans['U'] = vgui.virtualKeyTrans['u'] = KEY_U;
|
||||||
s_pVirtualKeyTrans[K_CAPSLOCK] = KEY_CAPSLOCK;
|
vgui.virtualKeyTrans['V'] = vgui.virtualKeyTrans['v'] = KEY_V;
|
||||||
s_pVirtualKeyTrans[K_KP_NUMLOCK] = KEY_NUMLOCK;
|
vgui.virtualKeyTrans['W'] = vgui.virtualKeyTrans['w'] = KEY_W;
|
||||||
s_pVirtualKeyTrans[K_ESCAPE] = KEY_ESCAPE;
|
vgui.virtualKeyTrans['X'] = vgui.virtualKeyTrans['x'] = KEY_X;
|
||||||
//s_pVirtualKeyTrans[K_KP_SCROLLLOCK] = KEY_SCROLLLOCK;
|
vgui.virtualKeyTrans['Y'] = vgui.virtualKeyTrans['y'] = KEY_Y;
|
||||||
s_pVirtualKeyTrans[K_INS] = KEY_INSERT;
|
vgui.virtualKeyTrans['Z'] = vgui.virtualKeyTrans['z'] = KEY_Z;
|
||||||
s_pVirtualKeyTrans[K_DEL] = KEY_DELETE;
|
|
||||||
s_pVirtualKeyTrans[K_HOME] = KEY_HOME;
|
vgui.virtualKeyTrans[K_KP_5 - 5] = KEY_PAD_0;
|
||||||
s_pVirtualKeyTrans[K_END] = KEY_END;
|
vgui.virtualKeyTrans[K_KP_5 - 4] = KEY_PAD_1;
|
||||||
s_pVirtualKeyTrans[K_PGUP] = KEY_PAGEUP;
|
vgui.virtualKeyTrans[K_KP_5 - 3] = KEY_PAD_2;
|
||||||
s_pVirtualKeyTrans[K_PGDN] = KEY_PAGEDOWN;
|
vgui.virtualKeyTrans[K_KP_5 - 2] = KEY_PAD_3;
|
||||||
s_pVirtualKeyTrans[K_PAUSE] = KEY_BREAK;
|
vgui.virtualKeyTrans[K_KP_5 - 1] = KEY_PAD_4;
|
||||||
//s_pVirtualKeyTrans[K_SHIFT] = KEY_RSHIFT;
|
vgui.virtualKeyTrans[K_KP_5 - 0] = KEY_PAD_5;
|
||||||
s_pVirtualKeyTrans[K_SHIFT] = KEY_LSHIFT; // SHIFT -> left SHIFT
|
vgui.virtualKeyTrans[K_KP_5 + 1] = KEY_PAD_6;
|
||||||
//s_pVirtualKeyTrans[SDLK_RALT] = KEY_RALT;
|
vgui.virtualKeyTrans[K_KP_5 + 2] = KEY_PAD_7;
|
||||||
s_pVirtualKeyTrans[K_ALT] = KEY_LALT; // ALT -> left ALT
|
vgui.virtualKeyTrans[K_KP_5 + 3] = KEY_PAD_8;
|
||||||
//s_pVirtualKeyTrans[SDLK_RCTRL] = KEY_RCONTROL;
|
vgui.virtualKeyTrans[K_KP_5 + 4] = KEY_PAD_9;
|
||||||
s_pVirtualKeyTrans[K_CTRL] = KEY_LCONTROL; // CTRL -> left CTRL
|
vgui.virtualKeyTrans[K_KP_SLASH] = KEY_PAD_DIVIDE;
|
||||||
s_pVirtualKeyTrans[K_WIN] = KEY_LWIN;
|
vgui.virtualKeyTrans['*'] = KEY_PAD_MULTIPLY;
|
||||||
//s_pVirtualKeyTrans[SDLK_APPLICATION] = KEY_RWIN;
|
vgui.virtualKeyTrans[K_KP_MINUS] = KEY_PAD_MINUS;
|
||||||
//s_pVirtualKeyTrans[K_WIN] = KEY_APP;
|
vgui.virtualKeyTrans[K_KP_PLUS] = KEY_PAD_PLUS;
|
||||||
s_pVirtualKeyTrans[K_UPARROW] = KEY_UP;
|
vgui.virtualKeyTrans[K_KP_ENTER] = KEY_PAD_ENTER;
|
||||||
s_pVirtualKeyTrans[K_LEFTARROW] = KEY_LEFT;
|
vgui.virtualKeyTrans[K_KP_NUMLOCK] = KEY_NUMLOCK;
|
||||||
s_pVirtualKeyTrans[K_DOWNARROW] = KEY_DOWN;
|
vgui.virtualKeyTrans['['] = KEY_LBRACKET;
|
||||||
s_pVirtualKeyTrans[K_RIGHTARROW] = KEY_RIGHT;
|
vgui.virtualKeyTrans[']'] = KEY_RBRACKET;
|
||||||
s_pVirtualKeyTrans[K_F1] = KEY_F1;
|
vgui.virtualKeyTrans[';'] = KEY_SEMICOLON;
|
||||||
s_pVirtualKeyTrans[K_F2] = KEY_F2;
|
vgui.virtualKeyTrans['`'] = KEY_BACKQUOTE;
|
||||||
s_pVirtualKeyTrans[K_F3] = KEY_F3;
|
vgui.virtualKeyTrans[','] = KEY_COMMA;
|
||||||
s_pVirtualKeyTrans[K_F4] = KEY_F4;
|
vgui.virtualKeyTrans['.'] = KEY_PERIOD;
|
||||||
s_pVirtualKeyTrans[K_F5] = KEY_F5;
|
vgui.virtualKeyTrans['-'] = KEY_MINUS;
|
||||||
s_pVirtualKeyTrans[K_F6] = KEY_F6;
|
vgui.virtualKeyTrans['='] = KEY_EQUAL;
|
||||||
s_pVirtualKeyTrans[K_F7] = KEY_F7;
|
vgui.virtualKeyTrans['/'] = KEY_SLASH;
|
||||||
s_pVirtualKeyTrans[K_F8] = KEY_F8;
|
vgui.virtualKeyTrans['\\'] = KEY_BACKSLASH;
|
||||||
s_pVirtualKeyTrans[K_F9] = KEY_F9;
|
vgui.virtualKeyTrans['\''] = KEY_APOSTROPHE;
|
||||||
s_pVirtualKeyTrans[K_F10] = KEY_F10;
|
vgui.virtualKeyTrans[K_TAB] = KEY_TAB;
|
||||||
s_pVirtualKeyTrans[K_F11] = KEY_F11;
|
vgui.virtualKeyTrans[K_ENTER] = KEY_ENTER;
|
||||||
s_pVirtualKeyTrans[K_F12] = KEY_F12;
|
vgui.virtualKeyTrans[K_SPACE] = KEY_SPACE;
|
||||||
|
vgui.virtualKeyTrans[K_CAPSLOCK] = KEY_CAPSLOCK;
|
||||||
|
vgui.virtualKeyTrans[K_BACKSPACE] = KEY_BACKSPACE;
|
||||||
|
vgui.virtualKeyTrans[K_ESCAPE] = KEY_ESCAPE;
|
||||||
|
vgui.virtualKeyTrans[K_INS] = KEY_INSERT;
|
||||||
|
vgui.virtualKeyTrans[K_DEL] = KEY_DELETE;
|
||||||
|
vgui.virtualKeyTrans[K_HOME] = KEY_HOME;
|
||||||
|
vgui.virtualKeyTrans[K_END] = KEY_END;
|
||||||
|
vgui.virtualKeyTrans[K_PGUP] = KEY_PAGEUP;
|
||||||
|
vgui.virtualKeyTrans[K_PGDN] = KEY_PAGEDOWN;
|
||||||
|
vgui.virtualKeyTrans[K_PAUSE] = KEY_BREAK;
|
||||||
|
vgui.virtualKeyTrans[K_SHIFT] = KEY_LSHIFT; // SHIFT -> left SHIFT
|
||||||
|
vgui.virtualKeyTrans[K_ALT] = KEY_LALT; // ALT -> left ALT
|
||||||
|
vgui.virtualKeyTrans[K_CTRL] = KEY_LCONTROL; // CTRL -> left CTRL
|
||||||
|
vgui.virtualKeyTrans[K_WIN] = KEY_LWIN;
|
||||||
|
vgui.virtualKeyTrans[K_UPARROW] = KEY_UP;
|
||||||
|
vgui.virtualKeyTrans[K_LEFTARROW] = KEY_LEFT;
|
||||||
|
vgui.virtualKeyTrans[K_DOWNARROW] = KEY_DOWN;
|
||||||
|
vgui.virtualKeyTrans[K_RIGHTARROW] = KEY_RIGHT;
|
||||||
|
vgui.virtualKeyTrans[K_F1] = KEY_F1;
|
||||||
|
vgui.virtualKeyTrans[K_F2] = KEY_F2;
|
||||||
|
vgui.virtualKeyTrans[K_F3] = KEY_F3;
|
||||||
|
vgui.virtualKeyTrans[K_F4] = KEY_F4;
|
||||||
|
vgui.virtualKeyTrans[K_F5] = KEY_F5;
|
||||||
|
vgui.virtualKeyTrans[K_F6] = KEY_F6;
|
||||||
|
vgui.virtualKeyTrans[K_F7] = KEY_F7;
|
||||||
|
vgui.virtualKeyTrans[K_F8] = KEY_F8;
|
||||||
|
vgui.virtualKeyTrans[K_F9] = KEY_F9;
|
||||||
|
vgui.virtualKeyTrans[K_F10] = KEY_F10;
|
||||||
|
vgui.virtualKeyTrans[K_F11] = KEY_F11;
|
||||||
|
vgui.virtualKeyTrans[K_F12] = KEY_F12;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum VGUI_KeyCode VGUI_MapKey( int keyCode )
|
static enum VGUI_KeyCode VGUI_MapKey( int keyCode )
|
||||||
{
|
{
|
||||||
VGUI_InitKeyTranslationTable();
|
VGUI_InitKeyTranslationTable();
|
||||||
|
|
||||||
if( keyCode < 0 || keyCode >= ARRAYSIZE( s_pVirtualKeyTrans ))
|
if( keyCode >= 0 && keyCode < ARRAYSIZE( vgui.virtualKeyTrans ))
|
||||||
{
|
return vgui.virtualKeyTrans[keyCode];
|
||||||
return (enum VGUI_KeyCode)-1;
|
|
||||||
}
|
return (enum VGUI_KeyCode)-1;
|
||||||
else
|
|
||||||
{
|
|
||||||
return s_pVirtualKeyTrans[keyCode];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VGui_MouseEvent( int key, int clicks )
|
void VGui_MouseEvent( int key, int clicks )
|
||||||
@ -416,7 +366,7 @@ void VGui_MouseEvent( int key, int clicks )
|
|||||||
enum VGUI_MouseAction mact;
|
enum VGUI_MouseAction mact;
|
||||||
enum VGUI_MouseCode code;
|
enum VGUI_MouseCode code;
|
||||||
|
|
||||||
if( !vgui.initialized )
|
if( !vgui.dllFuncs.Mouse )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch( key )
|
switch( key )
|
||||||
@ -434,22 +384,22 @@ void VGui_MouseEvent( int key, int clicks )
|
|||||||
else
|
else
|
||||||
mact = MA_RELEASED;
|
mact = MA_RELEASED;
|
||||||
|
|
||||||
vgui.Mouse( mact, code );
|
vgui.dllFuncs.Mouse( mact, code );
|
||||||
}
|
}
|
||||||
|
|
||||||
void VGui_MWheelEvent( int y )
|
void VGui_MWheelEvent( int y )
|
||||||
{
|
{
|
||||||
if( !vgui.initialized )
|
if( !vgui.dllFuncs.Mouse )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vgui.Mouse( MA_WHEEL, y );
|
vgui.dllFuncs.Mouse( MA_WHEEL, y );
|
||||||
}
|
}
|
||||||
|
|
||||||
void VGui_KeyEvent( int key, int down )
|
void VGui_KeyEvent( int key, int down )
|
||||||
{
|
{
|
||||||
enum VGUI_KeyCode code;
|
enum VGUI_KeyCode code;
|
||||||
|
|
||||||
if( !vgui.initialized )
|
if( !vgui.dllFuncs.Key )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(( code = VGUI_MapKey( key )) < 0 )
|
if(( code = VGUI_MapKey( key )) < 0 )
|
||||||
@ -457,47 +407,43 @@ void VGui_KeyEvent( int key, int down )
|
|||||||
|
|
||||||
if( down )
|
if( down )
|
||||||
{
|
{
|
||||||
vgui.Key( KA_PRESSED, code );
|
vgui.dllFuncs.Key( KA_PRESSED, code );
|
||||||
vgui.Key( KA_TYPED, code );
|
vgui.dllFuncs.Key( KA_TYPED, code );
|
||||||
}
|
}
|
||||||
else vgui.Key( KA_RELEASED, code );
|
else vgui.dllFuncs.Key( KA_RELEASED, code );
|
||||||
}
|
}
|
||||||
|
|
||||||
void VGui_MouseMove( int x, int y )
|
void VGui_MouseMove( int x, int y )
|
||||||
{
|
{
|
||||||
if( vgui.initialized )
|
if( vgui.dllFuncs.MouseMove )
|
||||||
{
|
{
|
||||||
float xscale = (float)refState.width / (float)clgame.scrInfo.iWidth;
|
float xscale = (float)refState.width / (float)clgame.scrInfo.iWidth;
|
||||||
float yscale = (float)refState.height / (float)clgame.scrInfo.iHeight;
|
float yscale = (float)refState.height / (float)clgame.scrInfo.iHeight;
|
||||||
vgui.MouseMove( x / xscale, y / yscale );
|
vgui.dllFuncs.MouseMove( x / xscale, y / yscale );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VGui_Paint( void )
|
void VGui_Paint( void )
|
||||||
{
|
{
|
||||||
if( vgui.initialized )
|
if( vgui.dllFuncs.Paint )
|
||||||
vgui.Paint();
|
vgui.dllFuncs.Paint();
|
||||||
}
|
|
||||||
|
|
||||||
void VGui_RunFrame( void )
|
|
||||||
{
|
|
||||||
//stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VGui_UpdateInternalCursorState( VGUI_DefaultCursor cursorType )
|
void VGui_UpdateInternalCursorState( VGUI_DefaultCursor cursorType )
|
||||||
{
|
{
|
||||||
s_currentCursor = cursorType;
|
vgui.cursor = cursorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *GAME_EXPORT VGui_GetPanel( void )
|
void *GAME_EXPORT VGui_GetPanel( void )
|
||||||
{
|
{
|
||||||
if( vgui.initialized )
|
if( vgui.dllFuncs.GetPanel )
|
||||||
return vgui.GetPanel();
|
return vgui.dllFuncs.GetPanel();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VGui_ReportTextInput( const char *text )
|
void VGui_ReportTextInput( const char *text )
|
||||||
{
|
{
|
||||||
if ( vgui.initialized )
|
if( vgui.dllFuncs.TextInput )
|
||||||
vgui.TextInput( text );
|
vgui.dllFuncs.TextInput( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,16 +16,12 @@ GNU General Public License for more details.
|
|||||||
#ifndef VGUI_DRAW_H
|
#ifndef VGUI_DRAW_H
|
||||||
#define VGUI_DRAW_H
|
#define VGUI_DRAW_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "port.h"
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// vgui_draw.c
|
// vgui_draw.c
|
||||||
//
|
//
|
||||||
void VGui_Startup( const char *clientlib, int width, int height );
|
void VGui_RegisterCvars( void );
|
||||||
|
qboolean VGui_LoadProgs( HINSTANCE hInstance );
|
||||||
|
void VGui_Startup( int width, int height );
|
||||||
void VGui_Shutdown( void );
|
void VGui_Shutdown( void );
|
||||||
void VGui_Paint( void );
|
void VGui_Paint( void );
|
||||||
void VGui_RunFrame( void );
|
void VGui_RunFrame( void );
|
||||||
@ -37,7 +33,5 @@ qboolean VGui_IsActive( void );
|
|||||||
void *VGui_GetPanel( void );
|
void *VGui_GetPanel( void );
|
||||||
void VGui_ReportTextInput( const char *text );
|
void VGui_ReportTextInput( const char *text );
|
||||||
void VGui_UpdateInternalCursorState( VGUI_DefaultCursor cursorType );
|
void VGui_UpdateInternalCursorState( VGUI_DefaultCursor cursorType );
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
#endif // VGUI_DRAW_H
|
||||||
#endif
|
|
||||||
#endif//VGUI_DRAW_H
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user