ui: Add option to hide cursor after a period of time

This commit is contained in:
Revix-0 2022-12-19 16:11:37 +01:00 committed by mborgerson
parent e5dd3cc1ce
commit 1d3c7c05d4
3 changed files with 15 additions and 0 deletions

View File

@ -136,6 +136,9 @@ display:
show_notifications:
type: bool
default: true
hide_cursor:
type: bool
default: true
use_animations:
type: bool
default: true

View File

@ -316,6 +316,8 @@ void MainMenuDisplayView::Draw()
"Show main menu bar when mouse is activated");
Toggle("Show notifications", &g_config.display.ui.show_notifications,
"Display notifications in upper-right corner");
Toggle("Hide mouse cursor", &g_config.display.ui.hide_cursor,
"Hide the mouse cursor when it is not moving");
int ui_scale_idx;
if (g_config.display.ui.auto_scale) {

View File

@ -256,6 +256,16 @@ void xemu_hud_render(void)
}
}
static uint32_t last_mouse_move = 0;
if (g_input_mgr.MouseMoved()) {
last_mouse_move = now;
}
// FIXME: Handle time wrap around
if (g_config.display.ui.hide_cursor && (now - last_mouse_move) > 3000) {
ImGui::SetMouseCursor(ImGuiMouseCursor_None);
}
if (!ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow) &&
!g_scene_mgr.IsDisplayingScene()) {