From ec84e81e17e0836610b2103d352d78b7975f5304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Mon, 6 Jun 2022 20:19:13 +0200 Subject: [PATCH] Replace Android-specific member variables with static variables --- src/engine/client/input.cpp | 13 ++++++------- src/engine/client/input.h | 3 --- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index a3b58918d..890df638f 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -55,9 +55,6 @@ CInput::CInput() m_NumTextInputInstances = 0; m_EditingTextLen = -1; m_aEditingText[0] = 0; - - m_LastX = 0; - m_LastY = 0; } void CInput::Init() @@ -78,11 +75,13 @@ bool CInput::MouseRelative(float *pX, float *pY) float Sens = g_Config.m_InpMousesens / 100.0f; #if defined(CONF_PLATFORM_ANDROID) // No relative mouse on Android + static int s_LastX = 0; + static int s_LastY = 0; SDL_GetMouseState(&nx, &ny); - int XTmp = nx - m_LastX; - int YTmp = ny - m_LastY; - m_LastX = nx; - m_LastY = ny; + int XTmp = nx - s_LastX; + int YTmp = ny - s_LastY; + s_LastX = nx; + s_LastY = ny; nx = XTmp; ny = YTmp; Sens = 1; diff --git a/src/engine/client/input.h b/src/engine/client/input.h index 263c0adec..5caccacf8 100644 --- a/src/engine/client/input.h +++ b/src/engine/client/input.h @@ -11,9 +11,6 @@ class CInput : public IEngineInput { IEngineGraphics *m_pGraphics; - int m_LastX; - int m_LastY; - int m_InputGrabbed; char *m_pClipboardText;