Jump to content
HazJ

Drawing on GPS panel

Recommended Posts

Hi all, I am trying to draw icons on the GPS panel. Currently having issues with it though, not sure where I am going wrong exactly. I have a feeling the control/IDC is wrong? The function (fn_playerIcons.sqf) works fine, it works on the normal map control #51. Code is quite messy, needs a cleanup/rewrite but for now just trying to get it working.

_miniMapKey = [];

{
	_miniMapKey append _x;
} forEach
[
	actionKeys "MiniMap",
	actionKeys "MiniMapToggle",
	actionKeys "ListLeftVehicleDisplay",
	actionKeys "ListPrevLeftVehicleDisplay",
	actionKeys "CloseLeftVehicleDisplay",
	actionKeys "ListRightVehicleDisplay",
	actionKeys "ListPrevRightVehicleDisplay",
	actionKeys "CloseRightVehicleDisplay",
	actionKeys "User20"
];
	case (_key in _miniMapKey) :
	{
		systemChat "Mini Map Key Pressed";
		_handled = false;
		[] spawn
		{
			if !("ItemGPS" in assignedItems player) exitWith
			{
				systemChat "No GPS";
			};
			sleep 1.15;
			waitUntil {visibleGPS};
			sleep 1.15;
			if (!visibleGPS) then
			{
				((uiNamespace getVariable "RscCustomInfoMiniMap") displayCtrl 101) ctrlRemoveEventHandler ["Draw", miniMapEH];
				systemChat "GPS Not Visible";
				miniMapEH = nil;
				if (DEBUG_MODE isEqualTo 1) then
				{
					systemChat "[DEBUG] :: MINI MAP EH REMOVED";
				};
			} else
			{
				miniMapEH = ((uiNamespace getVariable "RscCustomInfoMiniMap") displayCtrl 101) ctrlAddEventHandler ["Draw", tky_fnc_playerIcons];
				systemChat "GPS Visible";
				if (DEBUG_MODE isEqualTo 1) then
				{
					systemChat "[DEBUG] :: MINI MAP EH ADDED";
				};
			};
		};
	};

Even tried all of these:

{
	((uiNamespace getVariable "RscCustomInfoMiniMap") displayCtrl _x) ctrlAddEventHandler ["Draw", tky_fnc_playerIcons];
} forEach
[
	15110,
	102,
	15112,
	199,
	198,
	197,
	13301,
	101
];

Any ideas?

 

Cheers,

Haz

Share this post


Link to post
Share on other sites

Sorry to be of literally, absolutely, inarguably ZERO help, but I spent way too much time over the weekend trying to determine controls/idcs or anything else along those lines to get me started on something, and got nowhere....... So I went a different and much more logical direction with things.

 

Just a thought though. Are you trying to add stuff to the gps map? Because any markers on the main map will show on the gps.

Share this post


Link to post
Share on other sites

I am using drawIcon not createMarker therefore they have to be drawn on all. Main map, GPS, and any custom displays with map control.

  • Like 1

Share this post


Link to post
Share on other sites

Hello HazJ,

The mini-map control is held within a controls group and so you need to access it via the command controlsGroupCtrl. I did not go as far as to actually draw icons but I am assuming from the hint of params that the rest should work as you said it already does, hopefully this info helps. For future work on these IGUI displays you can loop through them and use the command ctrlType in order to figure out what controls are what so that you are not just staring at the control ids.

// Wait for display
waitUntil {!isNull (uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull])};
private _display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull];

// Controls
private _miniMapControlGroup = _display displayCtrl 13301;
private _miniMap = _miniMapControlGroup controlsGroupCtrl 101;

// Event handler
_miniMap ctrlAddEventHandler ["Draw", {hintSilent (format [":: %1", _this])}];

gKpTeMb.png

  • Like 1

Share this post


Link to post
Share on other sites

Update: The control does draw icons as intended.

// Wait for display
waitUntil {!isNull (uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull])};
private _display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull];

// Controls
private _miniMapControlGroup = _display displayCtrl 13301;
private _miniMap = _miniMapControlGroup controlsGroupCtrl 101;

// Event handler
_miniMap ctrlAddEventHandler ["Draw", {

	// Wiki example
	(_this select 0) drawIcon [
		"iconStaticMG",
		[1,0,0,1],
		getPos player,
		24,
		24,
		getDir player,
		"Player Vehicle",
		1,
		0.03,
		"TahomaB",
		"right"
	]
}];

aDrAgZy.png

  • Like 5

Share this post


Link to post
Share on other sites

Damn! Thanks, knew it was something simple. Didn't bother to check type, just assumed. Always a bad idea to do so haha. Thanks.

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×