Use KEY_FIRST and KEY_UNKNOWN instead of 0

This commit is contained in:
Robert Müller 2023-04-21 18:38:46 +02:00
parent c959665226
commit 09462cff67
2 changed files with 3 additions and 3 deletions

View file

@ -335,7 +335,7 @@ void CInput::Clear()
bool CInput::KeyState(int Key) const bool CInput::KeyState(int Key) const
{ {
if(Key < 0 || Key >= KEY_LAST) if(Key < KEY_FIRST || Key >= KEY_LAST)
return false; return false;
return m_aInputState[Key]; return m_aInputState[Key];
} }
@ -618,7 +618,7 @@ int CInput::Update()
} }
case SDL_TEXTINPUT: case SDL_TEXTINPUT:
m_EditingTextLen = -1; m_EditingTextLen = -1;
AddEvent(Event.text.text, 0, IInput::FLAG_TEXT); AddEvent(Event.text.text, KEY_UNKNOWN, IInput::FLAG_TEXT);
break; break;
// handle keys // handle keys
case SDL_KEYDOWN: case SDL_KEYDOWN:

View file

@ -126,7 +126,7 @@ int CBinds::GetModifierMaskOfKey(int Key)
bool CBinds::OnInput(const IInput::CEvent &Event) bool CBinds::OnInput(const IInput::CEvent &Event)
{ {
// don't handle invalid events // don't handle invalid events
if(Event.m_Key <= 0 || Event.m_Key >= KEY_LAST) if(Event.m_Key <= KEY_FIRST || Event.m_Key >= KEY_LAST)
return false; return false;
int Mask = GetModifierMask(Input()); int Mask = GetModifierMask(Input());