mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- InputState: Exclude volume keys from setting AnyKeyStatus
to true.
This commit is contained in:
parent
a2b51edcdb
commit
8bb13bc4c2
2 changed files with 22 additions and 1 deletions
|
@ -53,6 +53,9 @@ enum EKeyCodes
|
|||
KEY_PGUP = 0xc9, // DIK_PRIOR
|
||||
KEY_PGDN = 0xd1, // DIK_NEXT
|
||||
|
||||
KEY_VOLUMEDOWN = 0xAE, // DIK_VOLUMEDOWN
|
||||
KEY_VOLUMEUP = 0xB0, // DIK_VOLUMEUP
|
||||
|
||||
KEY_FIRSTMOUSEBUTTON = 0x100,
|
||||
KEY_MOUSE1 = 0x100,
|
||||
KEY_MOUSE2 = 0x101,
|
||||
|
|
|
@ -86,14 +86,32 @@ void InputState::GetMouseDelta(ControlInfo * info)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static int exclKeys[] = { KEY_VOLUMEDOWN, KEY_VOLUMEUP };
|
||||
|
||||
void InputState::AddEvent(const event_t *ev)
|
||||
{
|
||||
if (ev->type == EV_KeyDown || ev->type == EV_KeyUp)
|
||||
{
|
||||
int key = ev->data1;
|
||||
bool state = ev->type == EV_KeyDown;
|
||||
bool ignore = false;
|
||||
KeyStatus[key] = (uint8_t)state;
|
||||
if (state && !(key > KEY_LASTJOYBUTTON && key < KEY_PAD_LTHUMB_RIGHT))
|
||||
|
||||
// Check if key is to be excluded from setting AnyKeyStatus.
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
if (exclKeys[i] == key)
|
||||
{
|
||||
ignore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (key > KEY_LASTJOYBUTTON && key < KEY_PAD_LTHUMB_RIGHT)
|
||||
{
|
||||
ignore = true;
|
||||
}
|
||||
|
||||
if (state && !ignore)
|
||||
AnyKeyStatus = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue