Schatten 280 Posted September 4, 2021 Hi! I have custom HUD, whose resource is placed in RscTitles class in description.ext. The problem is that the HUD is continues displaying when, for example, pause menu is open, but unit info, stance indicator, GPS, etc. isn't. Is there a way to implement the same logic? The easiest way I think is to add checking for existence of pause menu display. But it's not elegant way, because my HUD is displaying when Splendid Camera is launched too, so I also need to check for existence of the Camera display too. Share this post Link to post Share on other sites
pierremgi 4830 Posted September 4, 2021 Are you using cutRsc or titleRsc ? If I remember cutRsc is better for this point. Share this post Link to post Share on other sites
Schatten 280 Posted September 4, 2021 @pierremgi, here are some source code: class Rsc_SCH_hud { duration = 1; fadeIn = 0; fadeOut = 0; idd = -1; onLoad = "call SCH_hud_eh_onRscLoad;"; class ControlsBackground { ... }; }; SCH_hud_eh_onRscLoad = compileFinal (preprocessFileLineNumbers (PATH + "\onRscLoad.sqf")); SCH_hud_var_layer = ["SCH_hud"] call BIS_fnc_rscLayer; addMissionEventHandler ["EachFrame", { SCH_hud_var_layer cutRsc ["Rsc_SCH_hud", "PLAIN", 1, false]; }]; I didn't find in Arma source code any global variable, that used to determine if pause menu is open. Seems, that pause menu layer hides other displays. I tried to use cutRsc without layer, but no luck. Share this post Link to post Share on other sites
pierremgi 4830 Posted September 4, 2021 Yes, I'm afraid you have to filter displays by a condition like: if (!isNull findDisplay 46 && isnull (findDisplay 602) && isnull (findDisplay 314) && isnull (findDisplay 49) && !dialog && isnil {uinamespace getvariable "bis_fnc_arsenal_display"}) then { SCH_hud_var_layer cutRsc ["Rsc_SCH_hud", "PLAIN", 1, false]; } else { SCH_hud_var_layer cutRsc ["default","PLAIN"]; }; Btw, I'm using the "draw3D" MEH. Not sure there is a big difference with "onEachFrame" one. Do you have any report about that? Note: Default must be defined in rscTitles: class Default { idd = -1; fadein = 0; fadeout = 0; duration = 0; }; 1 Share this post Link to post Share on other sites
Schatten 280 Posted September 5, 2021 38 minutes ago, pierremgi said: Yes, I'm afraid you have to filter displays Yea, as I wrote in the first message, it's plan B. Anyway, thanks! 39 minutes ago, pierremgi said: Btw, I'm using the "draw3D" MEH. Not sure there is a big difference with "onEachFrame" one. Do you have any report about that? Nope. I use Draw3D to display something in 3D space (for example, unit names above their heads using drawIcon3D) and EachFrame to display something in 2D space (HUD elements in my case). Share this post Link to post Share on other sites
pierremgi 4830 Posted September 5, 2021 1 hour ago, Schatten said: Nope. I use Draw3D to display something in 3D space (for example, unit names above their heads using drawIcon3D) and EachFrame to display something in 2D space (HUD elements in my case). I understand. On my side, I always used draw3D MEH even for my 2D HUDs. (I'm drawing in 2D compass or else). I didn't notice any lag or difficulty, and I'd like to understand what difference that could make, not only in term of performance, but also for rendering or else. (if someone has info on that...) Share this post Link to post Share on other sites
Schatten 280 Posted September 5, 2021 I found the solution. First, I move a control from my Rsc_SCH_hud display class to the root of description.ext file: class Rsc_SCH_hud_unitInfo: RscControlsGroupNoScrollbars { ... }; Next, I wrote the function (SCH_hud_fnc_drawUnitInfo) to draw the control: #include "\a3\ui_f\hpp\defineResincl.inc" #include "definitions.hpp" disableSerialization; _displays = uiNamespace getVariable ["IGUI_displays", []]; _index = _displays findIf { (ctrlIDD _x) == IDD_UNITINFO }; _display = if (_index >= 0) then { _displays select _index } else { displayNull }; if (isNull _display) exitWith { }; _control = _display displayCtrl UNIT_INFO_IDC; if (isNull _control) then { _control = _display ctrlCreate ["Rsc_SCH_hud_unitInfo", UNIT_INFO_IDC]; }; ... Because I need to display custom unit info, I find display with IDD IDD_UNITINFO. Finally, I use this code to launch the function: addMissionEventHandler ["Draw3D", { call SCH_hud_fnc_drawUnitInfo; }]; I use Draw3D instead of EachFrame, because the first MEH stops when the game looses focus, so seems it's more effective (it's my guess, I didn't check). 1 Share this post Link to post Share on other sites