2015-03-23 21:08:31 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: esteldunedain
|
2015-03-23 21:08:31 +00:00
|
|
|
* Render a single interaction icon
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Arguments:
|
2015-03-23 21:08:31 +00:00
|
|
|
* 0: 2d position <ARRAY>
|
2015-03-23 22:16:10 +00:00
|
|
|
* 1: Icon <STRING>
|
2015-03-23 21:08:31 +00:00
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-03-23 21:08:31 +00:00
|
|
|
* None
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [[2, 5], "icon"] call ACE_interact_menu_fnc_renderSelector
|
|
|
|
*
|
2015-03-23 21:08:31 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
2015-03-23 22:16:10 +00:00
|
|
|
|
2015-08-04 22:46:57 +00:00
|
|
|
params ["_sPos", "_icon"];
|
2015-03-23 21:08:31 +00:00
|
|
|
|
|
|
|
if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
|
2016-01-08 04:43:37 +00:00
|
|
|
private _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]);
|
2015-03-23 21:08:31 +00:00
|
|
|
GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]);
|
2015-05-02 04:33:28 +00:00
|
|
|
if (GVAR(useCursorMenu)) then {
|
|
|
|
((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseMoving", DFUNC(handleMouseMovement)];
|
|
|
|
((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseButtonDown", DFUNC(handleMouseButtonDown)];
|
|
|
|
};
|
2015-03-23 21:08:31 +00:00
|
|
|
};
|
2015-03-23 22:16:10 +00:00
|
|
|
|
2016-01-08 04:43:37 +00:00
|
|
|
private _ctrl = GVAR(iconCtrls) select GVAR(iconCount);
|
2015-03-23 21:08:31 +00:00
|
|
|
|
2016-01-08 04:43:37 +00:00
|
|
|
private _pos = if (GVAR(UseListMenu)) then {
|
2015-05-01 03:32:16 +00:00
|
|
|
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='#FF0000' size='1.6'/>", _icon]] call FUNC(ctrlSetParsedTextCached);
|
|
|
|
[(_sPos select 0)-(0.014*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.05*SafeZoneW, 0.035*SafeZoneW]
|
2015-04-12 04:15:38 +00:00
|
|
|
} else {
|
2015-05-01 03:32:16 +00:00
|
|
|
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='#FF0000' size='1.6' align='center'/>", _icon]] call FUNC(ctrlSetParsedTextCached);
|
|
|
|
[(_sPos select 0)-(0.050*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.1*SafeZoneW, 0.035*SafeZoneW]
|
2015-04-12 04:15:38 +00:00
|
|
|
};
|
2015-04-08 03:44:41 +00:00
|
|
|
|
2015-05-01 03:32:16 +00:00
|
|
|
GVAR(iconCount) = GVAR(iconCount) + 1;
|
|
|
|
|
2015-04-08 03:57:58 +00:00
|
|
|
if (GVAR(cursorKeepCentered) && {uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}) then {
|
2015-04-08 03:44:41 +00:00
|
|
|
_pos set [0, ((_pos select 0) - (GVAR(cursorPos) select 0) + 0.5)];
|
|
|
|
_pos set [1, ((_pos select 1) - (GVAR(cursorPos) select 1) + 0.5)];
|
|
|
|
};
|
|
|
|
|
2015-04-28 19:02:03 +00:00
|
|
|
_ctrl ctrlSetPosition _pos;
|
2015-03-23 21:08:31 +00:00
|
|
|
_ctrl ctrlCommit 0;
|