Skip to content

Commit

Permalink
MouseCapture keybind
Browse files Browse the repository at this point in the history
  • Loading branch information
lightmanLP committed Dec 18, 2024
1 parent 008316d commit 378781d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/graphic/Fast3D/Fast3dWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ bool Fast3dWindow::KeyUp(int32_t scancode) {
Ship::Context::GetInstance()->GetWindow()->ToggleFullscreen();
}

if (scancode == Ship::Context::GetInstance()->GetConfig()->GetInt("Shortcuts.MouseCapture", Ship::KbScancode::LUS_KB_F2)) {
bool captureState = Ship::Context::GetInstance()->GetWindow()->IsMouseCaptured();
if (captureState || !Ship::Context::GetInstance()->GetWindow()->GetGui()->GetMenuOrMenubarVisible()) {
Ship::Context::GetInstance()->GetWindow()->SetMouseCapture(!captureState);
}
}

Ship::Context::GetInstance()->GetWindow()->SetLastScancode(-1);
return Ship::Context::GetInstance()->GetControlDeck()->ProcessKeyboardEvent(
Ship::KbEventType::LUS_KB_EVENT_KEY_UP, static_cast<Ship::KbScancode>(scancode));
Expand Down

0 comments on commit 378781d

Please sign in to comment.