2015-02-21 20:11:03 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: NouberNou and esteldunedain
|
2015-02-21 20:11:03 +00:00
|
|
|
* Render a single interaction icon
|
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* 0: Text <STRING>
|
2015-04-20 23:28:01 +00:00
|
|
|
* 1: Icon <STRING>
|
2015-03-23 21:08:31 +00:00
|
|
|
* 2: 2d position <ARRAY>
|
2015-04-30 04:37:52 +00:00
|
|
|
* 3: Text Settings <STRING>
|
2015-02-21 20:11:03 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-18 18:38:27 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
#define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa)
|
2015-04-29 06:26:13 +00:00
|
|
|
private ["_ctrl", "_pos", "_displayNum"];
|
2015-04-30 04:37:52 +00:00
|
|
|
PARAMS_4(_text,_icon,_sPos,_textSettings);
|
2015-02-21 20:11:03 +00:00
|
|
|
|
2015-03-23 22:16:10 +00:00
|
|
|
//systemChat format ["Icon %1 - %2,%3", _text, _sPos select 0, _sPos select 1];
|
2015-02-27 04:55:16 +00:00
|
|
|
|
2015-03-23 21:08:31 +00:00
|
|
|
if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
|
2015-03-23 21:26:20 +00:00
|
|
|
_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
|
|
|
};
|
|
|
|
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
|
2015-05-01 03:32:16 +00:00
|
|
|
|
2015-03-23 21:08:31 +00:00
|
|
|
if(_icon == "") then {
|
|
|
|
_icon = DEFAULT_ICON;
|
2015-01-18 18:38:27 +00:00
|
|
|
};
|
2015-04-12 03:21:05 +00:00
|
|
|
|
2015-04-12 04:15:38 +00:00
|
|
|
_text = if (GVAR(UseListMenu)) then {
|
2015-04-30 04:37:52 +00:00
|
|
|
format ["<img image='%1' align='left'/><t %2>%3</t>", _icon, _textSettings, _text]
|
2015-04-12 04:15:38 +00:00
|
|
|
} else {
|
2015-05-01 03:04:22 +00:00
|
|
|
format ["<img image='%1' align='center'/><br/><t %2 align='center'>%3</t>", _icon, _textSettings, "ace_break_line" callExtension _text];
|
2015-04-12 04:15:38 +00:00
|
|
|
};
|
2015-04-12 03:21:05 +00:00
|
|
|
|
2015-04-25 12:34:09 +00:00
|
|
|
//_ctrl ctrlSetStructuredText parseText _text;
|
2015-04-25 11:28:21 +00:00
|
|
|
[_ctrl, GVAR(iconCount), _text] call FUNC(ctrlSetParsedTextCached);
|
2015-05-01 03:32:16 +00:00
|
|
|
GVAR(iconCount) = GVAR(iconCount) + 1;
|
2015-04-25 12:34:09 +00:00
|
|
|
|
2015-05-01 03:32:16 +00:00
|
|
|
_pos = if (GVAR(UseListMenu)) then {
|
|
|
|
[(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW]
|
2015-04-12 04:15:38 +00:00
|
|
|
} else {
|
2015-05-01 03:32:16 +00:00
|
|
|
[(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW]
|
2015-04-12 04:15:38 +00:00
|
|
|
};
|
2015-04-08 03:44:41 +00:00
|
|
|
|
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;
|