drawTriangle: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "Position3D" to "Position3D") |
Lou Montana (talk | contribs) m (Text replacement - "[[Image:" to "[[File:") |
||
(9 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
|gr1= GUI Control - Map | |gr1= GUI Control - Map | ||
|descr= [[ | |descr= [[File:drawTriangle.jpg|right|250px]] | ||
Draws one to multiple triangles on the map. | Draws one to multiple triangles on the map. | ||
{{Feature | informative | When {{hl|fill}} param is absent or is an empty string "", the triangle is drawn with lines of the color set in {{hl|color}} param. | {{Feature | informative | When {{hl|fill}} param is absent or is an empty string "", the triangle is drawn with lines of the color set in {{hl|color}} param. | ||
Line 15: | Line 15: | ||
|p1= map: [[Control]] - map control | |p1= map: [[Control]] - map control | ||
|p2= vertices: [[Array]] of [[Position]]s - triangle(s) vertices in multiple of 3, see {{ | |p2= vertices: [[Array]] of [[Position]]s - triangle(s) vertices in multiple of 3, see {{Link|#Example 1}} - if [[Position#Introduction|Position3D]] is provided for a vertex, its z value is ignored | ||
|p3= color: [[Array]] in format [[Color|Color (RGBA)]] | |p3= color: [[Array]] in format [[Color|Color (RGBA)]] | ||
Line 23: | Line 23: | ||
|r1= [[Nothing]] | |r1= [[Nothing]] | ||
|x1= < | |x1= <sqf> | ||
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", | |||
{ | { | ||
_this | _this select 0 drawTriangle | ||
[ | [ | ||
[ | [ | ||
// triangle 1 start | |||
player getRelPos [100, 0], | |||
player getRelPos [100, -135], | |||
player getRelPos [100, 135] | |||
// triangle 1 end | |||
], | ], | ||
[1,0,0,0.5], | [1,0,0,0.5], | ||
"#(rgb,1,1,1)color(1,1,1,1)" | "#(rgb,1,1,1)color(1,1,1,1)" | ||
]; | ]; | ||
}];</ | }]; | ||
</sqf> | |||
|seealso= [[drawArrow]] | |seealso= [[drawArrow]] [[drawEllipse]] [[drawIcon]] [[drawLine]] [[drawPolygon]] [[drawRectangle]] | ||
}} | }} | ||
Line 45: | Line 47: | ||
|user= Killzone_Kid | |user= Killzone_Kid | ||
|timestamp= 20170716153600 | |timestamp= 20170716153600 | ||
|text= Example [https://www.youtube.com/watch?v=gSiuLdUeq0M YouTube video] < | |text= Example [https://www.youtube.com/watch?v{{=}}gSiuLdUeq0M YouTube video] | ||
<spoiler> | |||
<sqf> | |||
ctrl = findDisplay 12 displayCtrl 51; | |||
_ctrl setVariable ["data", [1, "#(rgb,1,1,1)color(1,1,1,1)", 1000, position player, | _ctrl setVariable ["data", [1, "#(rgb,1,1,1)color(1,1,1,1)", 1000, position player, | ||
{ | { | ||
Line 75: | Line 80: | ||
_alpha = linearConversion [_dist, 0, _dist - _size, 1, 0]; | _alpha = linearConversion [_dist, 0, _dist - _size, 1, 0]; | ||
_map drawEllipse [_pos, _size * 2, _size * 2, 0, [0,0,1,_alpha], _fill]; | _map drawEllipse [_pos, _size * 2, _size * 2, 0, [0,0,1,_alpha], _fill]; | ||
_map drawTriangle [ | _map drawTriangle [[_pos getPos [_size, -_size], _size, _size] call _fn, [1,0,0,_alpha], _fill]; | ||
_map drawTriangle [ | _map drawTriangle [[_pos getPos [_size, -_size + 120], _size, _size] call _fn, [0,1,0,_alpha], _fill]; | ||
_map drawTriangle [ | _map drawTriangle [[_pos getPos [_size, -_size - 120], _size, _size] call _fn, [1,1,0,_alpha], _fill]; | ||
}]; | }]; | ||
openMap true;</ | openMap true; | ||
</sqf> | |||
</spoiler> | |||
}} | }} | ||
Line 86: | Line 93: | ||
|user= Killzone_Kid | |user= Killzone_Kid | ||
|timestamp= 20181113210500 | |timestamp= 20181113210500 | ||
|text= Drawing holes ( | |text= Drawing holes ({{Link|https://www.youtube.com/watch?v{{=}}XZRtXsBFLAg|video}}): | ||
<spoiler> | |||
<sqf> | |||
t = time; | |||
i = 0; | i = 0; | ||
tex = "#(rgb,1,1,1)color(1,1,1,0.5)"; | tex = "#(rgb,1,1,1)color(1,1,1,0.5)"; | ||
Line 138: | Line 148: | ||
openMap true; | openMap true; | ||
mapAnimAdd [0, 0.15, [500,500,0]]; | mapAnimAdd [0, 0.15, [500,500,0]]; | ||
mapAnimCommit;</ | mapAnimCommit; | ||
</sqf> | |||
</spoiler> | |||
}} | }} |
Revision as of 23:09, 20 November 2023
Description
- Description:
-
Draws one to multiple triangles on the map.
- Groups:
- GUI Control - Map
Syntax
- Syntax:
- map drawTriangle [vertices, color, fill]
- Parameters:
- map: Control - map control
- vertices: Array of Positions - triangle(s) vertices in multiple of 3, see Example 1 - if Position3D is provided for a vertex, its z value is ignored
- color: Array in format Color (RGBA)
- fill: String - (Optional, default "") fill texture file or Procedural Textures. See note in description for more info.
- Return Value:
- Nothing
Examples
- Example 1:
- CopyfindDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { _this select 0 drawTriangle [ [ // triangle 1 start player getRelPos [100, 0], player getRelPos [100, -135], player getRelPos [100, 135] // triangle 1 end ], [1,0,0,0.5], "#(rgb,1,1,1)color(1,1,1,1)" ]; }];
Additional Information
- See also:
- drawArrow drawEllipse drawIcon drawLine drawPolygon drawRectangle
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
- Posted on Jul 16, 2017 - 15:36 (UTC)
- Example YouTube video
- Posted on Nov 13, 2018 - 21:05 (UTC)
- Drawing holes (video):