| 539 | } |
| 540 | |
| 541 | void GameEventHandler::OnKeyPressed(const KeyboardEvent& event) |
| 542 | { |
| 543 | #if defined(NCINE_HAS_WINDOWS) |
| 544 | // Allow F11 and Alt+Enter to switch fullscreen |
| 545 | // TODO: Don't override F11 in web browser with newer version of `contrib.glfw3` |
| 546 | if (event.sym == Keys::F11 || (event.sym == Keys::Return && (event.mod & KeyMod::Mask) == KeyMod::LAlt)) { |
| 547 | # if defined(DEATH_TARGET_WINDOWS_RT) |
| 548 | // Xbox is always fullscreen |
| 549 | if (Environment::CurrentDeviceType == DeviceType::Xbox) { |
| 550 | return; |
| 551 | } |
| 552 | # endif |
| 553 | PreferencesCache::EnableFullscreen = !PreferencesCache::EnableFullscreen; |
| 554 | if (PreferencesCache::EnableFullscreen) { |
| 555 | theApplication().GetGfxDevice().setResolution(true); |
| 556 | theApplication().GetInputManager().setCursor(IInputManager::Cursor::Hidden); |
| 557 | } else { |
| 558 | theApplication().GetGfxDevice().setResolution(false); |
| 559 | theApplication().GetInputManager().setCursor(IInputManager::Cursor::Arrow); |
| 560 | } |
| 561 | return; |
| 562 | } |
| 563 | #endif |
| 564 | |
| 565 | _currentHandler->OnKeyPressed(event); |
| 566 | } |
| 567 | |
| 568 | void GameEventHandler::OnKeyReleased(const KeyboardEvent& event) |
| 569 | { |
no test coverage detected