graphics.drawRectangle: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{ScriptItem |endpoint = client |type = function |name = graphics.drawRectangle |usage = draw a rectangle in 2D space |parameters = Vec2 position, Vec2 size, [ int colour1 = C...") |
No edit summary |
||
(3 intermediate revisions by one other user not shown) | |||
Line 4: | Line 4: | ||
|name = graphics.drawRectangle | |name = graphics.drawRectangle | ||
|usage = draw a rectangle in 2D space | |usage = draw a rectangle in 2D space | ||
|parameters = Vec2 position, Vec2 size, [ int colour1 = COLOUR_WHITE ], [ int colour2 = COLOUR_WHITE ], [ int colour3 = COLOUR_WHITE ], [ int colour4 = COLOUR_WHITE ], [ float rotation = 0.0 ], [ Vec2 center = Vec2(0.0,0.0) ], [ Vec2 sourcePos = Vec2(0.0,0.0) ], [ Vec2 sourceSize = Vec2(1.0,1.0) ], [ Vec2 scale = Vec2(1.0,1.0) ] | |parameters = Surface surface, Vec2 position, Vec2 size, [ int colour1 = COLOUR_WHITE ], [ int colour2 = COLOUR_WHITE ], [ int colour3 = COLOUR_WHITE ], [ int colour4 = COLOUR_WHITE ], [ float rotation = 0.0 ], [ Vec2 center = Vec2(0.0,0.0) ], [ Vec2 sourcePos = Vec2(0.0,0.0) ], [ Vec2 sourceSize = Vec2(1.0,1.0) ], [ Vec2 scale = Vec2(1.0,1.0) ] | ||
|parameter1 = Vec3 position The 2D position for the rectangle. | |parameter1 = Surface surface The surface object, which can be null. | ||
| | |parameter2 = Vec3 position The 2D position for the rectangle, in pixels. | ||
| | |parameter3 = Vec3 size The 2D size for the rectangle, in pixels. | ||
| | |parameter4 = int colour1 optional COLOUR_WHITE The 1st colour for the rectangle, created by [[toColour|toColour]]. | ||
| | |parameter5 = int colour2 optional COLOUR_WHITE The 2nd colour for the rectangle, created by [[toColour|toColour]]. | ||
| | |parameter6 = int colour3 optional COLOUR_WHITE The 3rd colour for the rectangle, created by [[toColour|toColour]]. | ||
| | |parameter7 = int colour4 optional COLOUR_WHITE The 4th colour for the rectangle, created by [[toColour|toColour]]. | ||
| | |parameter8 = float rotation optional 0.0 The rotation of the rectangle. | ||
| | |parameter9 = Vec2 center optional Vec2(0.0,0.0) The center of the rectangle. | ||
| | |parameter10 = Vec2 sourcePos optional Vec2(0.0,0.0) The source position of the rectangle. | ||
| | |parameter11 = Vec2 sourceSize optional Vec2(1.0,1.0) The source size of the rectangle. | ||
|parameter12 = Vec2 scale optional Vec2(1.0,1.0) The scale of the rectangle. | |||
|return1 = void | |return1 = void | ||
|returnFail1 = void | |returnFail1 = void | ||
}} | }} |
Latest revision as of 23:08, 16 September 2022
Function
Client Only
Online and Offline
Available since Client 1.0.0
void graphics.drawRectangle(Surface surface, Vec2 position, Vec2 size, [ int colour1 = COLOUR_WHITE ], [ int colour2 = COLOUR_WHITE ], [ int colour3 = COLOUR_WHITE ], [ int colour4 = COLOUR_WHITE ], [ float rotation = 0.0 ], [ Vec2 center = Vec2(0.0,0.0) ], [ Vec2 sourcePos = Vec2(0.0,0.0) ], [ Vec2 sourceSize = Vec2(1.0,1.0) ], [ Vec2 scale = Vec2(1.0,1.0) ])
The graphics.drawRectangle function is used to draw a rectangle in 2D space.
Parameters
1) | Surface | surface | The surface object, which can be null. |
2) | Vec3 | position | The 2D position for the rectangle, in pixels. |
3) | Vec3 | size | The 2D size for the rectangle, in pixels. |
4) | int | colour1 | Optional, defaults to COLOUR_WHITE. The 1st colour for the rectangle, created by toColour. |
5) | int | colour2 | Optional, defaults to COLOUR_WHITE. The 2nd colour for the rectangle, created by toColour. |
6) | int | colour3 | Optional, defaults to COLOUR_WHITE. The 3rd colour for the rectangle, created by toColour. |
7) | int | colour4 | Optional, defaults to COLOUR_WHITE. The 4th colour for the rectangle, created by toColour. |
8) | float | rotation | Optional, defaults to 0.0. The rotation of the rectangle. |
9) | Vec2 | center | Optional, defaults to Vec2(0.0,0.0). The center of the rectangle. |
10) | Vec2 | sourcePos | Optional, defaults to Vec2(0.0,0.0). The source position of the rectangle. |
11) | Vec2 | sourceSize | Optional, defaults to Vec2(1.0,1.0). The source size of the rectangle. |
12) | Vec2 | scale | Optional, defaults to Vec2(1.0,1.0). The scale of the rectangle. |
Return
void | This function doesn't return a value. |
Notes
There aren't any notes for this function.
Examples
There aren't any examples for this function.
Compatibility
There isn't any compatibility information for this function.