Skip to content

Commit

Permalink
add keyhandler to main map display (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
commy2 committed Feb 13, 2018
1 parent 91c8e89 commit 67c54e9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
3 changes: 3 additions & 0 deletions addons/events/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class Extended_DisplayLoad_EventHandlers {
class RscDisplayMission {
ADDON = QUOTE(_this call (uiNamespace getVariable 'FUNC(initDisplayMission)'));
};
class RscDiary {
ADDON = QUOTE(if (ctrlIDD (_this select 0) == 12) then {_this call (uiNamespace getVariable 'FUNC(initDisplayMainMap)')};);
};
class RscDisplayCurator {
ADDON = QUOTE(_this call (uiNamespace getVariable 'FUNC(initDisplayCurator)'));
};
Expand Down
1 change: 1 addition & 0 deletions addons/events/XEH_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

if (hasInterface) then {
PREP(initDisplayMission);
PREP(initDisplayMainMap);
PREP(initDisplayCurator);

PREP(keyHandler);
Expand Down
12 changes: 12 additions & 0 deletions addons/events/fnc_initDisplayMainMap.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "script_component.hpp"

params ["_display"];

// set up CBA_fnc_addKeyHandler
_display displayAddEventHandler ["KeyDown", {if (visibleMap) then {call FUNC(keyHandlerDown)};}];
_display displayAddEventHandler ["KeyUp", {if (visibleMap) then {call FUNC(keyHandlerUp)};}];
_display displayAddEventHandler ["MouseButtonDown", {if (visibleMap) then {call FUNC(mouseHandlerDown)};}];
_display displayAddEventHandler ["MouseButtonUp", {if (visibleMap) then {call FUNC(mouseHandlerUp)};}];
_display displayAddEventHandler ["MouseZChanged", {if (visibleMap) then {call FUNC(mouseWheelHandler)};}];
_display displayAddEventHandler ["MouseMoving", {if (visibleMap) then {call FUNC(userKeyHandler)};}];
_display displayAddEventHandler ["MouseHolding", {if (visibleMap) then {call FUNC(userKeyHandler)};}];
14 changes: 7 additions & 7 deletions addons/events/fnc_initDisplayMission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ if (!isNil QGVAR(handlerHash)) then {
};

// set up CBA_fnc_addKeyHandler
_display displayAddEventHandler ["KeyDown", {call FUNC(keyHandlerDown)}];
_display displayAddEventHandler ["KeyUp", {call FUNC(keyHandlerUp)}];
_display displayAddEventHandler ["MouseButtonDown", {call FUNC(mouseHandlerDown)}];
_display displayAddEventHandler ["MouseButtonUp", {call FUNC(mouseHandlerUp)}];
_display displayAddEventHandler ["MouseZChanged", {call FUNC(mouseWheelHandler)}];
_display displayAddEventHandler ["MouseMoving", {call FUNC(userKeyHandler)}];
_display displayAddEventHandler ["MouseHolding", {call FUNC(userKeyHandler)}];
_display displayAddEventHandler ["KeyDown", {if (!visibleMap) then {call FUNC(keyHandlerDown)};}];
_display displayAddEventHandler ["KeyUp", {if (!visibleMap) then {call FUNC(keyHandlerUp)};}];
_display displayAddEventHandler ["MouseButtonDown", {if (!visibleMap) then {call FUNC(mouseHandlerDown)};}];
_display displayAddEventHandler ["MouseButtonUp", {if (!visibleMap) then {call FUNC(mouseHandlerUp)};}];
_display displayAddEventHandler ["MouseZChanged", {if (!visibleMap) then {call FUNC(mouseWheelHandler)};}];
_display displayAddEventHandler ["MouseMoving", {if (!visibleMap) then {call FUNC(userKeyHandler)};}];
_display displayAddEventHandler ["MouseHolding", {if (!visibleMap) then {call FUNC(userKeyHandler)};}];

0 comments on commit 67c54e9

Please sign in to comment.