do not copy keyboard over mouse state, refactoring

This commit is contained in:
Robert Müller 2022-01-16 11:52:04 +01:00
parent 79879591b1
commit 6675de319b

View file

@ -223,15 +223,14 @@ int CInput::Update()
// keep the counter between 1..0xFFFF, 0 means not pressed // keep the counter between 1..0xFFFF, 0 means not pressed
m_InputCounter = (m_InputCounter % 0xFFFF) + 1; m_InputCounter = (m_InputCounter % 0xFFFF) + 1;
{ int NumKeyStates;
int i; const Uint8 *pState = SDL_GetKeyboardState(&NumKeyStates);
const Uint8 *pState = SDL_GetKeyboardState(&i); if(NumKeyStates >= KEY_MOUSE_1)
if(i >= KEY_LAST) NumKeyStates = KEY_MOUSE_1;
i = KEY_LAST - 1; mem_copy(m_aInputState, pState, NumKeyStates);
mem_copy(m_aInputState, pState, i); mem_zero(m_aInputState + NumKeyStates, KEY_LAST - NumKeyStates);
if(m_EditingTextLen == 0) if(m_EditingTextLen == 0)
m_EditingTextLen = -1; m_EditingTextLen = -1;
}
// these states must always be updated manually because they are not in the GetKeyState from SDL // these states must always be updated manually because they are not in the GetKeyState from SDL
const int MouseState = SDL_GetMouseState(NULL, NULL); const int MouseState = SDL_GetMouseState(NULL, NULL);