From 517c63ee1e25f9bce9b09a4563d030fdf504f3b9 Mon Sep 17 00:00:00 2001 From: blattersturm Date: Fri, 30 Apr 2021 11:04:20 +0200 Subject: [PATCH] feat(loading-screens): add 'loadscreen_cursor' option Fixes \!25. --- .../loading-screens-five/src/LoadingScreens.cpp | 11 +++++++++++ code/components/nui-core/src/CefInput.cpp | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/code/components/loading-screens-five/src/LoadingScreens.cpp b/code/components/loading-screens-five/src/LoadingScreens.cpp index 251cefa806..9da71f723a 100644 --- a/code/components/loading-screens-five/src/LoadingScreens.cpp +++ b/code/components/loading-screens-five/src/LoadingScreens.cpp @@ -500,6 +500,17 @@ static InitFunction initFunction([] () { autoShutdownNui = false; } + + static ConVar uiLoadingCursor("ui_loadingCursor", ConVar_None, false); + auto useCursor = mdComponent->GetEntries("loadscreen_cursor"); + if (useCursor.begin() != useCursor.end()) + { + uiLoadingCursor.GetHelper()->SetRawValue(true); + } + else + { + uiLoadingCursor.GetHelper()->SetRawValue(false); + } } }); diff --git a/code/components/nui-core/src/CefInput.cpp b/code/components/nui-core/src/CefInput.cpp index a6010a4eb4..36c81f741e 100644 --- a/code/components/nui-core/src/CefInput.cpp +++ b/code/components/nui-core/src/CefInput.cpp @@ -16,6 +16,7 @@ #include #include +#include extern nui::GameInterface* g_nuiGi; @@ -26,6 +27,8 @@ static bool g_hasOverriddenFocus = false; extern bool g_mainUIFlag; POINT g_cursorPos; +static ConVar uiLoadingCursor("ui_loadingCursor", ConVar_None, false); + bool isKeyDown(WPARAM wparam) { return (GetKeyState(wparam) & 0x8000) != 0; @@ -176,6 +179,11 @@ namespace nui } g_hasOverriddenFocus = hasFocus; + + if (uiLoadingCursor.GetValue()) + { + g_hasCursor = hasFocus; + } } void KeepInput(bool keepInput)