diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 52bcb614b3..fdd01c1d8b 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -3,6 +3,7 @@ ADDON = false; PREP(handleCamera); +PREP(handleClock); PREP(handleCompass); PREP(handleInterface); PREP(handleKilled); diff --git a/addons/spectator/functions/fnc_handleClock.sqf b/addons/spectator/functions/fnc_handleClock.sqf new file mode 100644 index 0000000000..59b3dcc0c4 --- /dev/null +++ b/addons/spectator/functions/fnc_handleClock.sqf @@ -0,0 +1,31 @@ +/* + * Author: Karel Moricky, SilentSpike + * Handles the spectator UI clock + * + * Arguments: + * 0: Parameters + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [ace_spectator_fnc_handleClock, 1, _display] call CBA_fnc_addPerFrameHandler; + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_display"]; + +// Kill PFH when display is closed +if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; + +// Reduce overhead when toolbar is hidden +if !(GVAR(showTool) && GVAR(showInterface)) exitWith {}; + +private "_clock"; + +_clock = (_display displayCtrl IDC_TOOL) controlsGroupCtrl IDC_TOOL_CLOCK; +_clock ctrlSetText ([daytime,"HH:MM"] call BIS_fnc_timeToString); diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 1ff6a6627b..735c96dbf3 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -122,6 +122,9 @@ switch (toLower _mode) do { // Handle the compass heading [FUNC(handleCompass), 0, _display] call CBA_fnc_addPerFrameHandler; + // Handle the clock time + [FUNC(handleClock), 1, _display] call CBA_fnc_addPerFrameHandler; + // Hacky way to enable keybindings //_display displayAddEventHandler ["KeyUp", {[_this,'keyup'] call CBA_events_fnc_keyHandler}]; //_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}];