mirror of
https://github.com/slendidev/lunar.git
synced 2025-12-08 10:29:52 +02:00
@@ -76,7 +76,7 @@ auto Application::run() -> void
|
||||
} else if (e.type == SDL_EVENT_KEY_DOWN && e.key.repeat == false) {
|
||||
if (e.key.key == SDLK_F11 && e.key.mod & SDL_KMOD_LCTRL) {
|
||||
mouse_captured(!mouse_captured());
|
||||
m_show_imgui = mouse_captured();
|
||||
m_show_imgui = !mouse_captured();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,10 @@ auto Application::run() -> void
|
||||
|
||||
auto Application::mouse_captured(bool new_state) -> void
|
||||
{
|
||||
SDL_CaptureMouse(new_state);
|
||||
if (!SDL_SetWindowRelativeMouseMode(m_window, new_state)) {
|
||||
m_logger.err("Failed to capture mouse");
|
||||
return;
|
||||
}
|
||||
|
||||
m_mouse_captured = new_state;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ struct Application {
|
||||
~Application();
|
||||
|
||||
auto run() -> void;
|
||||
|
||||
auto mouse_captured(bool new_state) -> void;
|
||||
auto mouse_captured() const -> bool { return m_mouse_captured; }
|
||||
auto toggle_mouse_captured() -> void { mouse_captured(!m_mouse_captured); }
|
||||
|
||||
Reference in New Issue
Block a user