mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-11 14:42:05 +08:00
engine: client: add ability to build engine without touch input support
This commit is contained in:
@@ -19,6 +19,8 @@ GNU General Public License for more details.
|
||||
#include "vgui_draw.h"
|
||||
#include "mobility_int.h"
|
||||
|
||||
#if !XASH_NO_TOUCH
|
||||
|
||||
typedef enum
|
||||
{
|
||||
touch_command, // just tap a button
|
||||
@@ -162,7 +164,6 @@ static CVAR_DEFINE_AUTO( touch_joy_radius, "1.0", FCVAR_FILTERABLE, "joy radius
|
||||
static CVAR_DEFINE_AUTO( touch_move_indicator, "0.0", FCVAR_FILTERABLE, "indicate move events (0 to disable)" );
|
||||
static CVAR_DEFINE_AUTO( touch_joy_texture, "touch_default/joy", FCVAR_FILTERABLE, "texture for move indicator");
|
||||
static CVAR_DEFINE( touch_emulate, "_touch_emulate", "0", FCVAR_PRIVILEGED, "emulate touch with mouse" );
|
||||
CVAR_DEFINE_AUTO( touch_enable, DEFAULT_TOUCH_ENABLE, FCVAR_ARCHIVE | FCVAR_FILTERABLE, "enable touch controls" );
|
||||
|
||||
// code looks smaller with it
|
||||
#define TO_SCRN_Y(x) (refState.width * (x) * Touch_AspectRatio())
|
||||
@@ -1184,7 +1185,6 @@ void Touch_Init( void )
|
||||
Cvar_RegisterVariable( &touch_joy_texture );
|
||||
|
||||
// input devices cvar
|
||||
Cvar_RegisterVariable( &touch_enable );
|
||||
Cvar_RegisterVariable( &touch_emulate );
|
||||
|
||||
touch.initialized = true;
|
||||
@@ -2260,3 +2260,5 @@ void Touch_Shutdown( void )
|
||||
touch.initialized = false;
|
||||
Mem_FreePool( &touch.mempool );
|
||||
}
|
||||
|
||||
#endif // !XASH_NO_TOUCH
|
||||
|
||||
@@ -49,6 +49,7 @@ static CVAR_DEFINE_AUTO( cl_backspeed, "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL |
|
||||
static CVAR_DEFINE_AUTO( cl_sidespeed, "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL | FCVAR_FILTERABLE, "Default side move speed" );
|
||||
|
||||
static CVAR_DEFINE_AUTO( m_grab_debug, "0", FCVAR_PRIVILEGED, "show debug messages on mouse state change" );
|
||||
CVAR_DEFINE_AUTO( touch_enable, DEFAULT_TOUCH_ENABLE, FCVAR_ARCHIVE | FCVAR_FILTERABLE, "enable touch controls" );
|
||||
|
||||
/*
|
||||
================
|
||||
@@ -120,6 +121,7 @@ static void IN_StartupMouse( void )
|
||||
Cvar_RegisterVariable( &look_filter );
|
||||
Cvar_RegisterVariable( &m_rawinput );
|
||||
Cvar_RegisterVariable( &m_grab_debug );
|
||||
Cvar_RegisterVariable( &touch_enable );
|
||||
|
||||
// You can use -nomouse argument to prevent using mouse from client
|
||||
// -noenginemouse will disable all mouse input
|
||||
|
||||
+20
-2
@@ -51,6 +51,8 @@ void IN_SetMouseGrab( qboolean set );
|
||||
|
||||
extern convar_t m_yaw;
|
||||
extern convar_t m_pitch;
|
||||
extern convar_t touch_enable;
|
||||
|
||||
//
|
||||
// in_touch.c
|
||||
//
|
||||
@@ -61,8 +63,23 @@ typedef enum
|
||||
event_motion
|
||||
} touchEventType;
|
||||
|
||||
extern convar_t touch_enable;
|
||||
|
||||
#if XASH_NO_TOUCH
|
||||
static inline void Touch_Draw( void ) { }
|
||||
static inline void Touch_SetClientOnly( byte state ) { }
|
||||
static inline void Touch_RemoveButton( const char *name, qboolean privileged ) { }
|
||||
static inline void Touch_HideButtons( const char *name, unsigned char hide, qboolean privileged ) { }
|
||||
static inline void Touch_AddClientButton( const char *name, const char *texture, const char *command, float x1, float y1, float x2, float y2, byte *color, int round, float aspect, int flags ) { }
|
||||
static inline void Touch_AddDefaultButton( const char *name, const char *texturefile, const char *command, float x1, float y1, float x2, float y2, byte *color, int round, float aspect, int flags ) { }
|
||||
static inline void Touch_WriteConfig( void ) { }
|
||||
static inline void Touch_Init( void ) { }
|
||||
static inline void Touch_Shutdown( void ) { }
|
||||
static inline void Touch_GetMove( float * forward, float *side, float *yaw, float *pitch ) { }
|
||||
static inline void Touch_ResetDefaultButtons( void ) { }
|
||||
static inline int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy ) { return 0; }
|
||||
static inline void Touch_KeyEvent( int key, int down ) { }
|
||||
static inline qboolean Touch_WantVisibleCursor( void ) { return false; }
|
||||
static inline void Touch_NotifyResize( void ) { }
|
||||
#else
|
||||
void Touch_Draw( void );
|
||||
void Touch_SetClientOnly( byte state );
|
||||
void Touch_RemoveButton( const char *name, qboolean privileged );
|
||||
@@ -78,6 +95,7 @@ int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx
|
||||
void Touch_KeyEvent( int key, int down );
|
||||
qboolean Touch_WantVisibleCursor( void );
|
||||
void Touch_NotifyResize( void );
|
||||
#endif
|
||||
|
||||
//
|
||||
// in_joy.c
|
||||
|
||||
Reference in New Issue
Block a user