Difference between revisions of "User:Pongles/love.graphics.rectangle"

(This is a userpage subpage, not the regular page. Trying out some changes in a sandbox.)
 
m (also this)
 
(4 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
=== Arguments ===
 
=== Arguments ===
 
{{param|DrawMode|mode|How to draw the rectangle.}}
 
{{param|DrawMode|mode|How to draw the rectangle.}}
 +
{{User:Pongles/DrawMode}}
 
{{param|number|x|The position of top-left corner along the x-axis.}}
 
{{param|number|x|The position of top-left corner along the x-axis.}}
 
{{param|number|y|The position of top-left corner along the y-axis.}}
 
{{param|number|y|The position of top-left corner along the y-axis.}}
Line 24: Line 25:
 
=== Arguments ===
 
=== Arguments ===
 
{{param|DrawMode|mode|How to draw the rectangle.}}
 
{{param|DrawMode|mode|How to draw the rectangle.}}
 +
{{User:Pongles/DrawMode}}
 
{{param|number|x|The position of top-left corner along the x-axis.}}
 
{{param|number|x|The position of top-left corner along the x-axis.}}
 
{{param|number|y|The position of top-left corner along the y-axis.}}
 
{{param|number|y|The position of top-left corner along the y-axis.}}
Line 38: Line 40:
 
<source lang="lua">
 
<source lang="lua">
 
function love.draw()
 
function love.draw()
     love.graphics.rectangle("fill", 20, 50, 60, 120 )
+
     love.graphics.rectangle( "fill", 20, 50, 60, 120 )
 
end
 
end
 
</source>
 
</source>
Line 44: Line 46:
 
== See Also ==
 
== See Also ==
 
* [[parent::love.graphics]]
 
* [[parent::love.graphics]]
[[Category:Functions]]
 
[[Sub-Category::Drawing| ]]
 
 
{{#set:Description=Draws a rectangle.}}
 
{{#set:Description=Draws a rectangle.}}
 
{{#set:Since=032}}
 
{{#set:Since=032}}

Latest revision as of 21:45, 20 March 2019

Draws a rectangle.

Function

Synopsis

love.graphics.rectangle( mode, x, y, width, height )

Arguments

DrawMode mode
How to draw the rectangle.
Constants
fill
Draw filled shape.
line
Draw outlined shape.
number x
The position of top-left corner along the x-axis.
number y
The position of top-left corner along the y-axis.
number width
Width of the rectangle.
number height
Height of the rectangle.

Returns

Nothing.

Function

Available since LÖVE 0.10.0
This variant is not supported in earlier versions.

Draws a rectangle with rounded corners.

Synopsis

love.graphics.rectangle( mode, x, y, width, height, rx, ry, segments )

Arguments

DrawMode mode
How to draw the rectangle.
Constants
fill
Draw filled shape.
line
Draw outlined shape.
number x
The position of top-left corner along the x-axis.
number y
The position of top-left corner along the y-axis.
number width
Width of the rectangle.
number height
Height of the rectangle.
number rx
The x-axis radius of each round corner. Cannot be greater than half the rectangle's width.
number ry (rx)
The y-axis radius of each round corner. Cannot be greater than half the rectangle's height.
number segments (nil)
The number of segments used for drawing the round corners. A default amount will be chosen if no number is given.

Returns

Nothing.

Examples

Draws a rectangle at 20,50 with a width of 60 and a height of 120

function love.draw()
    love.graphics.rectangle( "fill", 20, 50, 60, 120 )
end

See Also


Other Languages