MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / OnKeyPressed

Method OnKeyPressed

Sources/Main.cpp:541–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539}
540
541void 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
568void GameEventHandler::OnKeyReleased(const KeyboardEvent& event)
569{

Callers 1

OnBackInvokedMethod · 0.45

Calls 2

setResolutionMethod · 0.45
setCursorMethod · 0.45

Tested by

no test coverage detected