drawIcon
- Local effect
- Arma 3 v0.50
- First in Armed Assault v1.00
Command · Markdown · JSON · original wiki page
Description
Draws an icon on the map.
As this command needs to be called every frame, it is preferable using the onDraw UI Event Handler.
Note
Some useful icons can be found in configFile >> "CfgVehicleIcons".
Syntax
map drawIcon [texture, color, position, width, height, angle, text, shadow, textSize, font, align]
Parameters:
map: Control
texture: String - icon texture
color: Color (RGBA) - text and icon color
position: Object, Position2D or Position3D
width: Number - width of the icon (but not the text)
height: Number - height of the icon (but not the text)
angle: Number - rotation angle of the icon not the text (add to it ctrlMapDir to show correctly on rotating minimap)
text: String - (Optional, default "")
shadow: Number or Boolean - (Optional, default false) can be one of:
- 0 (false): no shadow
- 1: shadow (for text)
- 2 (true): outline (works for text and for icon only if icon angle is 0)
textSize: Number - (Optional, default -1) size of the text in UI units (since arma3 0.72)
font: String - (Optional, default "") text's font (since arma3 0.72)
align: String - (Optional, default "right") text alignment. Can be:
- "left"
- "right"
- "center" (since arma3 0.72)
Returns: Nothing
Examples
Example 1
Red icon with text:
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
_this select 0 drawIcon [
"iconStaticMG",
[1,0,0,1],
getPosASLVisual player,
24,
24,
getDirVisual player,
"Player Vehicle",
1,
0.03,
"TahomaB",
"right"
]
}];
Example 2
Green text only:
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
_this select 0 drawIcon [
"#(rgb,1,1,1)color(1,1,1,1)",
[0,1,0,1],
player,
0,
0,
0,
name player
]
}];
See also
drawArrow · drawEllipse · drawLine · drawRectangle · drawPolygon · drawTriangle · drawXPolygon
Arma 3 1.54
This command does not seem to play nice with onEachFrame. It seems to draw on the main screen while maintaing position relative to the map position
Example:
onEachFrame {
findDisplay 12 displayCtrl 51 drawIcon ['iconStaticMG', [1,0,0,1], getPosASL player, 24, 24, getDir player, 'Player Vehicle', 1, 0.03, 'TahomaB', 'right'];
};
The icon size always stays the same, even after zooming in/out. To make the icon get bigger with map zoom, use this for width and height size:
private _scale = 6.4 * worldSize / 8192 * ctrlMapScale _map;
private _size = _sizeInMeters / _scale;
For example, the following icon has an exact size of 50 meters on the map, even after zooming in/out:
private _scale = 6.4 * worldSize / 8192 * ctrlMapScale _map;
private _size = 50 / _scale;
_map drawIcon ["iconStaticMG", [1,0,0,1], getPosASLVisual player, _size, _size, 0]