drawTriangle: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) No edit summary |
Killzone Kid (talk | contribs) No edit summary |
||
(59 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{RV|type=command | ||
| | |game1= arma3 | ||
|version1= 1.76 | |||
| | |gr1= GUI Control - Map | ||
| Draws | |descr= [[File:drawTriangle.jpg|right|250px]] | ||
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. | |||
In order to draw color-filled triangle of the same color as {{hl|color}} param, set {{hl|fill}} param to opaque white procedural texture{{hl|"#(rgb,1,1,1)color(1,1,1,1)"}}.}} | |||
| map | |s1= map [[drawTriangle]] [vertices, color, fill] | ||
|p1= map: [[Control]] - map control | |p1= map: [[Control]] - map control | ||
|p2= | |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)]] | ||
|p4= fill: [[String]] - (Optional, default {{hl|""}}) fill texture file or [[Procedural Textures]]. See note in description for more info. | |||
|x1= < | |r1= [[Nothing]] | ||
|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]] [[drawEllipse]] [[drawIcon]] [[drawLine]] [[drawPolygon]] [[drawRectangle]] [[drawXPolygon]] | |||
}} | }} | ||
{{Note | |||
|user= Killzone_Kid | |||
|timestamp= 20170716153600 | |||
|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 96: | Line 85: | ||
}]; | }]; | ||
openMap true;</ | openMap true; | ||
</ | </sqf> | ||
</ | </spoiler> | ||
< | }} | ||
{{Note | |||
|user= Killzone_Kid | |||
|timestamp= 20181113210500 | |||
|text= Drawing holes ({{Link|https://www.youtube.com/watch?v{{=}}XZRtXsBFLAg|video}}): | |||
<spoiler> | |||
<sqf> | |||
t = time; | |||
i = 0; | |||
tex = "#(rgb,1,1,1)color(1,1,1,0.5)"; | |||
col = [1,1,1,1]; | |||
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", | |||
{ | |||
if (time > t) then | |||
{ | |||
col = [random 1, random 1, random 1, 1]; | |||
tex = [ | |||
"\A3\ui_f\data\map\markerbrushes\vertical_ca.paa", | |||
"\A3\ui_f\data\map\markerbrushes\bdiagonal_ca.paa", | |||
"\A3\ui_f\data\map\markerbrushes\cross_ca.paa", | |||
"\A3\ui_f\data\map\markerbrushes\diaggrid_ca.paa", | |||
"\A3\ui_f\data\map\markerbrushes\fdiagonal_ca.paa", | |||
"\A3\ui_f\data\map\markerbrushes\grid_ca.paa", | |||
"\A3\ui_f\data\map\markerbrushes\horizontal_ca.paa", | |||
"#(rgb,1,1,1)color(1,1,1,0.5)" | |||
] | |||
select (i % 8); | |||
t = time + 0.5; | |||
i = i + 1; | |||
}; | |||
_this select 0 drawTriangle | |||
[ | |||
[ | |||
[0,0],[100,500],[400,400], | |||
[0,0],[400,400],[500,100], | |||
[0,0],[500,100],[1000,0], | |||
[1000,0],[500,100],[600,400], | |||
[1000,0],[600,400],[900,500], | |||
[1000,0],[900,500],[1000,1000], | |||
[1000,1000],[900,500],[600,600], | |||
[1000,1000],[600,600],[500,900], | |||
[1000,1000],[500,900],[0,1000], | |||
[0,1000],[500,900],[400,600], | |||
[0,1000],[400,600],[100,500], | |||
[0,1000],[100,500],[0,0] | |||
], | |||
col, | |||
tex | |||
]; | |||
_this select 0 drawPolygon [[[0,0,0],[0,1000,0],[1000,1000,0],[1000,0,0]], col]; | |||
_this select 0 drawPolygon [[[100,500,0],[400,600,0],[500,900,0],[600,600,0],[900,500,0],[600,400,0],[500,100,0],[400,400,0]], col]; | |||
}]; | |||
openMap true; | |||
mapAnimAdd [0, 0.15, [500,500,0]]; | |||
mapAnimCommit; | |||
</sqf> | |||
</spoiler> | |||
}} |
Latest revision as of 23:36, 1 November 2024
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
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):