Use ACRE2 add display passthrough keys API in spectator (#5735)

* Use ACRE2 add display passthrough keys API
* Assure backwards compatibility with older ACRE2 versions
This commit is contained in:
jonpas 2017-12-09 00:08:30 +01:00 committed by SilentSpike
parent 18d4b9660d
commit 82f3a57e22
4 changed files with 28 additions and 11 deletions

View File

@ -17,6 +17,7 @@ PREP(ui_handleChildDestroyed);
PREP(ui_handleKeyDown);
PREP(ui_handleKeyUp);
PREP(ui_handleListClick);
PREP(ui_handleLoad);
PREP(ui_handleMapClick);
PREP(ui_handleMapDraw);
PREP(ui_handleMouseButtonDblClick);

View File

@ -197,13 +197,4 @@ if ((_key in (actionKeys "CuratorInterface")) && {!isNull (getAssignedCuratorLog
true
};
// Handle acre spectate headset down (if present)
if (
["acre_sys_radio"] call EFUNC(common,isModLoaded) &&
{ [_key, [_shift, _ctrl, _alt]] isEqualTo ((["ACRE2", "HeadSet"] call CBA_fnc_getKeybind) select 5) }
) exitWith {
[] call acre_sys_core_fnc_toggleHeadset;
true
};
false // default to unhandled

View File

@ -0,0 +1,25 @@
/*
* Author: SilentSpike, Jonpas
* Function used to handle load event.
*
* Arguments:
* 0: Spectator display <DISPLAY>
*
* Return Value:
* None
*
* Example:
* _this call ace_spectator_fnc_ui_handleLoad
*
* Public: No
*/
#include "script_component.hpp"
params ["_display"];
uiNamespace setVariable [QGVAR(display), _display];
// Handle ACRE2 Toggle Spectator (if present)
if (!isNil "acre_api_fnc_addDisplayPassthroughKeys") then {
[_display] call acre_api_fnc_addDisplayPassthroughKeys;
};

View File

@ -18,8 +18,8 @@ class GVAR(display) {
enableSimulation = 1;
movingEnable = 0;
closeOnMissionEnd = 1;
onLoad = QUOTE(with uiNameSpace do {GVAR(display) = _this select 0};);
onLoad = QUOTE(_this call FUNC(ui_handleLoad));
onKeyDown = QUOTE(_this call FUNC(ui_handleKeyDown));
onKeyUp = QUOTE(_this call FUNC(ui_handleKeyUp));