drawPolygon: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "| A3 |= Game " to "| arma3 |Game name= ")
(Fix example)
Line 3: Line 3:


| arma3 |Game name=
| arma3 |Game name=
|1.58|Game Version= (number surrounded by NO SPACES)
 
|1.58|Game Version=
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 9: Line 10:
____________________________________________________________________________________________
____________________________________________________________________________________________


| map '''drawPolygon''' [polygon, color] |SYNTAX=
| map [[drawPolygon]] [polygon, color] |SYNTAX=


|p1= map: [[Control]] |PARAMETER1=
|p1= map: [[Control]] |PARAMETER1=
|p2= [polygon, color]: [[Array]] |PARAMETER2=
 
|p3= polygon: [[Array]] - array of positions in format [pos1, pos2, pos3,....posN], where pos is [[Position3D]] |PARAMETER3=
|p2= polygon: [[Array]] of [[Position3D]] |PARAMETER2=
|p4= color: [[Array]] - line color in format [r,g,b,a]|PARAMETER4=
 
|p3= color: [[Color]] - line color in format [r,g,b,a]|PARAMETER3=
 
| [[Nothing]] |RETURNVALUE=
| [[Nothing]] |RETURNVALUE=


|x1=<code>test_polygon = [];
|x1= <code>test_polygon = [];
[[for]] "_i" [[from]] 1 [[to]] 12 [[do]]  
[[for]] "_i" [[from]] 1 [[to]] 12 [[do]]  
{
{
test_polygon [[pushBack]] ([[player]] [[getPos]] [10 + [[random]] 100, 360/_i]);
test_polygon [[pushBack]] ([[player]] [[getPos]] [10 + [[random]] 100, 360/_i]);
};
};
[[findDisplay]] 12 [[displayCtrl]] 51 [[ctrlAddEventHandler]] ["Draw",  
[[findDisplay]] 12 [[displayCtrl]] 51 [[ctrlAddEventHandler]] ["Draw",  
{
{
_this [[select]] 0 [[drawPolygon]] [test_polygon, [0,0,1,1]];
[[params]] ["_control"];
}];</code>|=
_control [[drawPolygon]] [test_polygon, [0,0,1,1]];
}];</code> |EXAMPLE1=
____________________________________________________________________________________________
____________________________________________________________________________________________


|[[drawEllipse]], [[drawIcon]], [[drawLine]], [[drawRectangle]], [[drawArrow]], [[drawTriangle]], [[inPolygon]]|SEEALSO=
| [[drawEllipse]], [[drawIcon]], [[drawLine]], [[drawRectangle]], [[drawArrow]], [[drawTriangle]], [[inPolygon]] |SEEALSO=
 
}}
}}


Line 40: Line 44:


<h3 style="display:none">Bottom Section</h3>
<h3 style="display:none">Bottom Section</h3>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Revision as of 16:42, 16 June 2020

Hover & click on the images for description

Description

Description:
Draws given polygon on the given map control with given color. The polygon must consist of at least 3 points. Unlike with other draw<shape> commands and due to complexity, this command does not support filling of the polygon with color. Use drawTriangle command to construct and fill polygon shape as a workaround.
Groups:
Uncategorised

Syntax

Syntax:
map drawPolygon [polygon, color]
Parameters:
map: Control
polygon: Array of Position3D
color: Color - line color in format [r,g,b,a]
Return Value:
Nothing

Examples

Example 1:
test_polygon = []; for "_i" from 1 to 12 do { test_polygon pushBack (player getPos [10 + random 100, 360/_i]); }; findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { params ["_control"]; _control drawPolygon [test_polygon, [0,0,1,1]]; }];

Additional Information

See also:
drawEllipsedrawIcondrawLinedrawRectangledrawArrowdrawTriangleinPolygon

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

Notes

Bottom Section