bool InputManager::IsSpacebarPressed() { return ToggleKey(GLFW_KEY_SPACE); }
bool InputManager::IsDownPressed() { return ToggleKey(GLFW_KEY_DOWN); }
bool InputManager::IsCPressed() { return ToggleKey(GLFW_KEY_C); }
bool InputManager::IsUpPressed() { return ToggleKey(GLFW_KEY_UP); }
bool InputManager::IsRightPressed() { return ToggleKey(GLFW_KEY_RIGHT); }
bool InputManager::IsLeftPressed() { return ToggleKey(GLFW_KEY_LEFT); }
bool InputManager::IsEscapePressed() { return ToggleKey(GLFW_KEY_ESCAPE); }
// Process more complicated key combinations void ProcessKeyTable (COMBINATION_KEY* asKeys_) { short nShifts = 0; if (IsPressed(VK_SHIFT)) nShifts |= MOD_SHIFT; if (IsPressed(VK_LCONTROL)) nShifts |= MOD_LCTRL; if (IsPressed(VK_LMENU)) nShifts |= MOD_LALT; if (IsPressed(VK_RMENU)) nShifts |= MOD_RALT; // Have the shift states changed while a combo is in progress? if (nComboModifiers != MOD_NONE && nComboModifiers != nShifts) { // If the combo key is still pressed, start the timer running to re-press it as we're about to release it if (IsPressed(nComboKey)) { TRACE("Starting combo timer\n"); dwComboTime = OSD::GetTime(); } // We're done with the shift state now, so clear it to prevent the time getting reset nComboModifiers = MOD_NONE; } // Combo unpress timer active? if (dwComboTime) { TRACE("Combo timer active\n"); // If we're within the threshold, ensure the key remains released if ((OSD::GetTime() - dwComboTime) < 250) { TRACE("Releasing combo key\n"); ReleaseKey(nComboKey); } // Otherwise clear the expired timer else { TRACE("Combo timer expired\n"); dwComboTime = 0; } } for (int i = 0 ; asKeys_[i].nSamKey != SK_NONE; i++) { if (IsPressed(asKeys_[i].nKey) && asKeys_[i].nMods == nShifts) { // Release the PC keys used for the key combination ReleaseKey(asKeys_[i].nKey); if (nShifts & MOD_SHIFT) ToggleKey(VK_SHIFT); if (nShifts & MOD_LCTRL) ToggleKey(VK_LCONTROL); if (nShifts & MOD_LALT) { ToggleKey(VK_LMENU); ReleaseKey(VK_RCONTROL); } // Press the SAM key(s) required to generate the symbol PressSamKey(asKeys_[i].nSamKey); PressSamKey(asKeys_[i].nSamMods); // Remember the key involved with the shifted state for a combo nComboKey = asKeys_[i].nKey; nComboModifiers = nShifts; } } }