Handle the clock

This commit is contained in:
SilentSpike 2015-07-19 13:31:19 +01:00
parent 619c2d780b
commit 3b1afe930e
3 changed files with 35 additions and 0 deletions

View File

@ -3,6 +3,7 @@
ADDON = false; ADDON = false;
PREP(handleCamera); PREP(handleCamera);
PREP(handleClock);
PREP(handleCompass); PREP(handleCompass);
PREP(handleInterface); PREP(handleInterface);
PREP(handleKilled); PREP(handleKilled);

View File

@ -0,0 +1,31 @@
/*
* Author: Karel Moricky, SilentSpike
* Handles the spectator UI clock
*
* Arguments:
* 0: Parameters <ANY>
* 1: PFH handle <NUMBER>
*
* Return Value:
* None <NIL>
*
* 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);

View File

@ -122,6 +122,9 @@ switch (toLower _mode) do {
// Handle the compass heading // Handle the compass heading
[FUNC(handleCompass), 0, _display] call CBA_fnc_addPerFrameHandler; [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 // Hacky way to enable keybindings
//_display displayAddEventHandler ["KeyUp", {[_this,'keyup'] call CBA_events_fnc_keyHandler}]; //_display displayAddEventHandler ["KeyUp", {[_this,'keyup'] call CBA_events_fnc_keyHandler}];
//_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}]; //_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}];