drawPolygon: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\| *((\[\[[a-zA-Z0-9_ |()]+\]\],? ?)+) * \}\}" to "|seealso= $1 }}") |
m (formatting and another example) |
||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| arma3 | |game1= arma3 | ||
|1.58 | |version1= 1.58 | ||
|gr1= GUI Control - Map | |gr1= GUI Control - Map | ||
| Draws given polygon on the given map control with given color. The polygon must consist of at least 3 points. Unlike with other draw | |descr= Draws given polygon on the given map control with given color. The polygon must consist of at least 3 points. Unlike with other <tt>draw*</tt> 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. | ||
| map [[drawPolygon]] [polygon, color] | |s1= map [[drawPolygon]] [polygon, color] | ||
|p1= map: [[Control]] | |p1= map: [[Control]] | ||
Line 15: | Line 15: | ||
|p2= polygon: [[Array]] of [[Position3D]] | |p2= polygon: [[Array]] of [[Position3D]] | ||
|p3= color: [[Color|Color (RGBA)] | |p3= color: [[Array]] - Line color in format [[Color|Color (RGBA)]] | ||
| [[Nothing]] | |r1= [[Nothing]] | ||
|x1= <code>test_polygon = []; | |x1= <code>test_polygon = []; | ||
Line 29: | Line 29: | ||
[[params]] ["_control"]; | [[params]] ["_control"]; | ||
_control [[drawPolygon]] [test_polygon, [0,0,1,1]]; | _control [[drawPolygon]] [test_polygon, [0,0,1,1]]; | ||
}];</code> | |||
|x2= Draw a polygon by adjusting the {{ic|_radius}} and {{ic|_numVertices}}<code>vertices [[a = b|=]] []; | |||
[[private]] _numVertices [[a = b|=]] 2; | |||
[[private]] _numVertices [[a = b|=]] _numVertices [[max]] 3; | |||
[[private]] _radius [[a = b|=]] 100; | |||
[[for]] "_i" [[from]] 1 [[to]] _numVertices [[do]] | |||
{ | |||
vertices [[pushBack]] ([[player]] [[getRelPos]] [_radius, 360/_numVertices [[a * b|*]] _i]); | |||
}; | |||
[[findDisplay]] 12 [[displayCtrl]] 51 [[ctrlAddEventHandler]] ["Draw", | |||
{ | |||
[[params]] ["_control"]; | |||
_control [[drawPolygon]] [vertices, [0,0,1,1]]; | |||
}];</code> | }];</code> | ||
|seealso= [[drawEllipse]], [[drawIcon]], [[drawLine]], [[drawRectangle]], [[drawArrow]], [[drawTriangle]], [[inPolygon]] | |seealso= [[drawEllipse]], [[drawIcon]], [[drawLine]], [[drawRectangle]], [[drawArrow]], [[drawTriangle]], [[inPolygon]] | ||
}} | }} |
Revision as of 12:18, 28 March 2021
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* 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:
- GUI Control - Map
Syntax
- Syntax:
- map drawPolygon [polygon, color]
- Parameters:
- map: Control
- polygon: Array of Position3D
- color: Array - Line color in format Color (RGBA)
- 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]]; }];
- Example 2:
- Draw a polygon by adjusting the
_radius
and_numVertices
vertices = []; private _numVertices = 2; private _numVertices = _numVertices max 3; private _radius = 100; for "_i" from 1 to _numVertices do { vertices pushBack (player getRelPos [_radius, 360/_numVertices * _i]); }; findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { params ["_control"]; _control drawPolygon [vertices, [0,0,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