From 9291d9b714a71a5088872924337eb60d2118e47f Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Sun, 27 Jun 2021 22:39:17 +0200 Subject: [PATCH] Medical - Hide cursor when unconscious (#8269) * Hide cursor when blocking inputs * Update addons/common/DisableMouseDialog.hpp Co-authored-by: PabstMirror * Update addons/common/functions/fnc_disableUserInput.sqf Co-authored-by: PabstMirror * Update addons/common/DisableMouseDialog.hpp Co-authored-by: PabstMirror --- addons/common/CfgWrapperUI.hpp | 10 +++++++ addons/common/DisableMouseDialog.hpp | 18 ++++++++++++ addons/common/ProgressScreen.hpp | 26 ------------------ addons/common/config.cpp | 22 +++++++-------- addons/common/data/blank_cursor_ca.paa | Bin 0 -> 1522 bytes .../common/functions/fnc_disableUserInput.sqf | 4 +++ 6 files changed, 43 insertions(+), 37 deletions(-) create mode 100644 addons/common/CfgWrapperUI.hpp create mode 100644 addons/common/DisableMouseDialog.hpp create mode 100644 addons/common/data/blank_cursor_ca.paa diff --git a/addons/common/CfgWrapperUI.hpp b/addons/common/CfgWrapperUI.hpp new file mode 100644 index 0000000000..fd2282bcf5 --- /dev/null +++ b/addons/common/CfgWrapperUI.hpp @@ -0,0 +1,10 @@ +class CfgWrapperUI { + class Cursors { + class Arrow; + class GVAR(blank): Arrow { + // This texture has a single 99% transparent pixel and is otherwise blank + // The single pixel is necessary, otherwise appears as a black 32 px square + texture = QPATHTOF(data\blank_cursor_ca.paa); + }; + }; +}; diff --git a/addons/common/DisableMouseDialog.hpp b/addons/common/DisableMouseDialog.hpp new file mode 100644 index 0000000000..c723ea759e --- /dev/null +++ b/addons/common/DisableMouseDialog.hpp @@ -0,0 +1,18 @@ +class ctrlMapEmpty; +class GVAR(DisableMouse_Dialog) { + idd = -1; + movingEnable = 0; + onLoad = QUOTE(with uiNameSpace do { GVAR(dlgDisableMouse) = _this # 0; };); + objects[] = {}; + class controlsBackground { + // Transparent map allows setting custom cursor + class Background: ctrlMapEmpty { + idc = 101; + fade = 1; + x = "safezoneXAbs"; + y = "safezoneY"; + w = "safezoneWAbs"; + h = "safezoneH"; + }; + }; +}; diff --git a/addons/common/ProgressScreen.hpp b/addons/common/ProgressScreen.hpp index 8933fae6f9..6770ca598b 100644 --- a/addons/common/ProgressScreen.hpp +++ b/addons/common/ProgressScreen.hpp @@ -49,29 +49,3 @@ class GVAR(ProgressBar_Dialog) { }; }; }; - -class GVAR(DisableMouse_Dialog) { - idd = -1; - movingEnable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(dlgDisableMouse)),_this select 0)];); - objects[] = {}; - class controlsBackground { - class Background { - idc = -1; - moving = 0; - font = "TahomaB"; - text = ""; - sizeEx = 0; - lineSpacing = 0; - type = 0; - style = 0; - size = 1; - colorBackground[] = {0, 0, 0, 0};//0.5 - colorText[] = {0, 0, 0, 0}; - x = "safezoneX"; - y = "safezoneY"; - w = "safezoneW"; - h = "safezoneH"; - }; - }; -}; diff --git a/addons/common/config.cpp b/addons/common/config.cpp index 6416f244b8..4378428641 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -14,18 +14,17 @@ class CfgPatches { }; }; -#include "CfgEventHandlers.hpp" - -#include "CfgLocationTypes.hpp" -#include "CfgSounds.hpp" -#include "CfgVehicles.hpp" -#include "CfgWeapons.hpp" -#include "CfgMagazines.hpp" - -#include "CfgMoves.hpp" -#include "CfgVoice.hpp" -#include "CfgUnitInsignia.hpp" #include "CfgEden.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgLocationTypes.hpp" +#include "CfgMagazines.hpp" +#include "CfgMoves.hpp" +#include "CfgSounds.hpp" +#include "CfgUnitInsignia.hpp" +#include "CfgVehicles.hpp" +#include "CfgVoice.hpp" +#include "CfgWeapons.hpp" +#include "CfgWrapperUI.hpp" class ACE_Rsc_Display_Base { idd = -1; @@ -62,6 +61,7 @@ class ACE_Rsc_Control_Base { #include "ACE_Settings.hpp" #include "define.hpp" #include "ProgressScreen.hpp" +#include "DisableMouseDialog.hpp" #include "HintConfig.hpp" #include "RscInfoType.hpp" #include "CompassControl.hpp" diff --git a/addons/common/data/blank_cursor_ca.paa b/addons/common/data/blank_cursor_ca.paa new file mode 100644 index 0000000000000000000000000000000000000000..8af652c087df11fb11e9eae62ad6dedc4e9febd3 GIT binary patch literal 1522 zcmZSm@9ypx;_M#g$il$DP+woq0Om(H`hxiXfdIsJcl2=s@fm>_#1D3J^LGHU8-TbS zDAC8tz;G3aNe2oH3JeS^K!ZIdsd!FOA>Dvc9it&I8UjN-1OylaAf*e$BMLwYRQABU iHB$H-3>*v&Fi$gpibk@6fdyEi0>cvq6o3pwXaWFTAZvI4 literal 0 HcmV?d00001 diff --git a/addons/common/functions/fnc_disableUserInput.sqf b/addons/common/functions/fnc_disableUserInput.sqf index 379c1d6312..514fa3601c 100644 --- a/addons/common/functions/fnc_disableUserInput.sqf +++ b/addons/common/functions/fnc_disableUserInput.sqf @@ -41,6 +41,10 @@ if (_state) then { private _display = uiNamespace getVariable QGVAR(dlgDisableMouse); + // Hide cursor by using custom transparent cursor + private _map = _display displayCtrl 101; + _map ctrlMapCursor ["", QGVAR(blank)]; + _display displayAddEventHandler ["KeyDown", { params ["", "_key"];