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
m_InputCounter = (m_InputCounter % 0xFFFF) + 1;
{
int i;
const Uint8 *pState = SDL_GetKeyboardState(&i);
if(i >= KEY_LAST)
i = KEY_LAST - 1;
mem_copy(m_aInputState, pState, i);
if(m_EditingTextLen == 0)
m_EditingTextLen = -1;
}
int NumKeyStates;
const Uint8 *pState = SDL_GetKeyboardState(&NumKeyStates);
if(NumKeyStates >= KEY_MOUSE_1)
NumKeyStates = KEY_MOUSE_1;
mem_copy(m_aInputState, pState, NumKeyStates);
mem_zero(m_aInputState + NumKeyStates, KEY_LAST - NumKeyStates);
if(m_EditingTextLen == 0)
m_EditingTextLen = -1;
// these states must always be updated manually because they are not in the GetKeyState from SDL
const int MouseState = SDL_GetMouseState(NULL, NULL);