osre
osre copied to clipboard
Refactoring: Keyboard-Listener
void KeyboardEventListener::onOSEvent(const Event &osEvent, const EventData *data) {
- if (data == nullptr) {
-
return; - } auto *keyData = static_cast<KeyboardButtonEventData *>(data); if (osEvent == Platform::KeyboardButtonDownEvent) { mKeyboardInputState.mKeymap[keyData->m_key] = 1; mKeyboardInputState.mLast = keyData->m_key;
- } else {
- } else if (osEvent == Platform::KeyboardButtonUpEvent) { mKeyboardInputState.mKeymap[keyData->m_key] = 0; mKeyboardInputState.mLast = Platform::KEY_UNKNOWN; } }