engine: move some input code

This commit is contained in:
Velaron 2020-08-21 13:39:01 +03:00 committed by Alibek Omarov
parent df7f8259a1
commit b4aecfbf23
2 changed files with 20 additions and 12 deletions

View File

@ -567,23 +567,16 @@ static void IN_JoyAppendMove( usercmd_t *cmd, float forwardmove, float sidemove
void IN_CollectInput( float *forward, float *side, float *pitch, float *yaw, qboolean includeMouse, qboolean includeSdlMouse )
{
if( includeMouse )
if( includeMouse
#if XASH_SDL
&& includeSdlMouse
#endif
)
{
#if XASH_INPUT == INPUT_SDL
/// TODO: check if we may move this to platform
if( includeSdlMouse )
{
int x, y;
SDL_GetRelativeMouseState( &x, &y );
*pitch += y * m_pitch->value;
*yaw -= x * m_yaw->value;
}
#else
float x, y;
Platform_MouseMove( &x, &y );
*pitch += y * m_pitch->value;
*yaw -= x * m_yaw->value;
#endif // SDL
#ifdef XASH_USE_EVDEV
IN_EvdevMove( yaw, pitch );

View File

@ -55,6 +55,21 @@ void GAME_EXPORT Platform_SetMousePos( int x, int y )
SDL_WarpMouseInWindow( host.hWnd, x, y );
}
/*
========================
Platform_MouseMove
========================
*/
void Platform_MouseMove( float *x, float *y )
{
int m_x, m_y;
SDL_GetMouseState( &m_x, &m_y );
*x = (float)m_x;
*y = (float)m_y;
}
/*
=============
Platform_GetClipobardText