Jump to content
Sign in to follow this  
Safkon

Map icons rendering. Icons disappear

Recommended Posts

Hello!

I have problems with drawing icons (default solder icons for all units) in onDraw event handler.
Some of the icons are rendered, some are not. Some rendered icons can disappear after moving or zooming map.

My dialog:

Spoiler

#include "\a3\ui_f\hpp\definecommongrids.inc"
#include "DefaultStaff.hpp"

class RespawnDialog
{
	idd = -1;
	access = 0;
	movingEnable = true;
	enableSimulation = true;
	Controls[] = 
	{
		Background,
		MapFrame,
	};
	
	class MapFrame : RscMapControl
	{
		idc = 1804
		x = 16 * GUI_GRID_W + GUI_GRID_X;
		y = 2 * GUI_GRID_H + GUI_GRID_Y;
		w = 23 * GUI_GRID_W;
		h = 16 * GUI_GRID_H;
		sizeEx = 1 * GUI_GRID_H;
		onDraw = "_this execVM 'scripts\dialog\respawn\onDrawMap.sqf'";
	};

	class Background: IGUIBack
	{
		idc = 2200;
		x = 0 * GUI_GRID_W + GUI_GRID_X;
		y = 0 * GUI_GRID_H + GUI_GRID_Y;
		w = 40 * GUI_GRID_W;
		h = 25 * GUI_GRID_H;
		colorBackground[] = {0,0,0,0.8};
	};
};

 


Map onDrawMap script:
 

Spoiler

 


params ["_control"];

{
	_pos = getPosVisual _x;
	_dir = getDir _x;
	_control drawIcon [
		"iconman", //"respawn_background", // texture
		[1,0,0,1], // text and icon color in format [r,g,b,a] 
		_pos, // position
		24, // width
		24, // height
		_dir // angle
	];
} forEach allUnits;

systemChat "END";

_control


Seems like I'm make some stupid mistake, but I can't figure out what exactly. 🤔

In-game dialog after creation:

Spoiler

20210123225951-1.jpg


After map moving upper:

Spoiler

20210123225959-1.jpg


Top-left squad with broken rendering

P.S.
Scripts and dialog code is shortened for ease of understanding

Share this post


Link to post
Share on other sites

Ah... problem in execVM.
Seems like onDraw = "_this execVM 'scripts\dialog\respawn\onDrawMap.sqf'"; takes a lot of time for execution and this is not acceptable for UI rendering

onDraw = "_this call compile preprocessFileLineNumbers 'scripts\dialog\respawn\onDrawMap.sqf'"; - works as expected without artifacts

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
Sign in to follow this  

×