Browse Source

engine: input: implement input devices collecting

pull/2/head
Alibek Omarov 5 years ago
parent
commit
6aa4765c3e
  1. 58
      engine/client/input.c
  2. 3
      engine/client/input.h

58
engine/client/input.c

@ -51,6 +51,64 @@ convar_t *cl_sidespeed; @@ -51,6 +51,64 @@ convar_t *cl_sidespeed;
convar_t *cl_backspeed;
convar_t *look_filter;
/*
================
IN_CollectInputDevices
Returns a bit mask representing connected devices or, at least, enabled
================
*/
uint IN_CollectInputDevices( void )
{
uint ret = 0;
if( !m_ignore->value ) // no way to check is mouse connected, so use cvar only
ret |= INPUT_DEVICE_MOUSE;
#if 0 // TOUCHTODO
if( touch_enable->value )
ret |= INPUT_DEVICE_TOUCH;
#endif
if( Joy_IsActive() ) // connected or enabled
ret |= INPUT_DEVICE_JOYSTICK;
Con_Reportf( "Connected devices: %s%s%s%s\n",
FBitSet( ret, INPUT_DEVICE_MOUSE ) ? "mouse " : "",
FBitSet( ret, INPUT_DEVICE_TOUCH ) ? "touch " : "",
FBitSet( ret, INPUT_DEVICE_JOYSTICK ) ? "joy " : "",
FBitSet( ret, INPUT_DEVICE_VR ) ? "vr " : "");
return ret;
}
/*
=================
IN_LockInputDevices
tries to lock any possibilty to connect another input device after
player is connected to the server
=================
*/
void IN_LockInputDevices( qboolean lock )
{
extern convar_t *joy_enable; // private to input system
if( lock )
{
SetBits( m_ignore->flags, FCVAR_READ_ONLY );
SetBits( joy_enable->flags, FCVAR_READ_ONLY );
// TOUCHTODO
}
else
{
ClearBits( m_ignore->flags, FCVAR_READ_ONLY );
ClearBits( joy_enable->flags, FCVAR_READ_ONLY );
// TOUCHTODO
}
}
/*
===========
IN_StartupMouse

3
engine/client/input.h

@ -41,6 +41,9 @@ void IN_MouseRestorePos( void ); @@ -41,6 +41,9 @@ void IN_MouseRestorePos( void );
void IN_ToggleClientMouse( int newstate, int oldstate );
void IN_SetCursor( void *hCursor );
uint IN_CollectInputDevices( void );
void IN_LockInputDevices( qboolean lock );
//
// in_touch.c
//

Loading…
Cancel
Save