Difference between revisions of "love.graphics.newGeometry"

m
(Added non-table variant and optional draw mode and vertex map parameters)
Line 1: Line 1:
{{newin|[[0.9.0]]|090|new=function}}
+
{{newin|[[0.9.0]]|090|type=function}}
 
Creates a new [[Geometry]].
 
Creates a new [[Geometry]].
 +
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
geometry = love.graphics.newGeometry( vertices )
+
geometry = love.graphics.newGeometry( vertices, draw_mode, vertex_map )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
 
{{param|table|vertices|The table filled with vertex information tables for each vertex as follows:}}
 
{{param|table|vertices|The table filled with vertex information tables for each vertex as follows:}}
{{subparam|number|[1]|The x vertex coordinate.}}
+
{{subparam|number|[1]|The position of the vertex on the x-axis.}}
{{subparam|number|[2]|The y vertex coordinate.}}
+
{{subparam|number|[2]|The position of the vertex on the y-axis.}}
{{subparam|number|[3]|The u texture coordinate.}}
+
{{subparam|number|[3]|The u texture coordinate. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see [[WrapMode]].)}}
{{subparam|number|[4]|The v texture coordinate.}}
+
{{subparam|number|[4]|The v texture coordinate. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see [[WrapMode]].)}}
 
{{subparam|number|[5] (255)|The red color component.}}
 
{{subparam|number|[5] (255)|The red color component.}}
 
{{subparam|number|[6] (255)|The green color component.}}
 
{{subparam|number|[6] (255)|The green color component.}}
 
{{subparam|number|[7] (255)|The blue color component.}}
 
{{subparam|number|[7] (255)|The blue color component.}}
 
{{subparam|number|[8] (255)|The alpha color component.}}
 
{{subparam|number|[8] (255)|The alpha color component.}}
 +
{{param|GeometryDrawMode|draw_mode ("fan")|How the vertices are used when drawing. The default mode "fan" is sufficient for simple convex polygons.}}
 +
{{param|table|vertex_map ({1, 2, 3, ...})|A table describing the order of the vertices when they are drawn. The vertex map allows you to re-order or reuse vertices when drawing without changing the actual vertex parameters.}}
 +
=== Returns ===
 +
{{param|Geometry|geometry|The new geometry.}}
 +
 +
== Function ==
 +
=== Synopsis ===
 +
<source lang="lua">
 +
geometry = love.graphics.newGeometry( vertex1, vertex2, vertex3, ..., draw_mode, vertex_map )
 +
</source>
 +
=== Arguments ===
 +
{{param|table|vertex1|The vertex information table for the first vertex.}}
 +
{{param|table|vertex2|The vertex information table for the second vertex.}}
 +
{{param|table|vertex3|The vertex information table for the third vertex.}}
 +
{{param|GeometryDrawMode|draw_mode ("fan")|How the vertices are used when drawing. The default mode "fan" is sufficient for simple convex polygons.}}
 +
{{param|table|vertex_map ({1, 2, 3, ...})|A table describing the order of the vertices when they are drawn. The vertex map allows you to re-order or reuse vertices when drawing without changing the actual vertex parameters.}}
 
=== Returns ===
 
=== Returns ===
 
{{param|Geometry|geometry|The new geometry.}}
 
{{param|Geometry|geometry|The new geometry.}}
 +
 
<!--
 
<!--
 
Transform this to apply to geometries.
 
Transform this to apply to geometries.
Line 36: Line 54:
  
 
function love.draw()
 
function love.draw()
love.graphics.drawg(img, top_left, 50, 50)
+
love.graphics.draw(img, top_left, 50, 50)
love.graphics.drawg(img, bottom_left, 50, 200)
+
love.graphics.draw(img, bottom_left, 50, 200)
 
end
 
end
 
</source>
 
</source>

Revision as of 16:55, 16 August 2013

Available since LÖVE 0.9.0
This function is not supported in earlier versions.

Creates a new Geometry.

Function

Synopsis

geometry = love.graphics.newGeometry( vertices, draw_mode, vertex_map )

Arguments

table vertices
The table filled with vertex information tables for each vertex as follows:
number [1]
The position of the vertex on the x-axis.
number [2]
The position of the vertex on the y-axis.
number [3]
The u texture coordinate. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see WrapMode.)
number [4]
The v texture coordinate. Texture coordinates are normally in the range of [0, 1], but can be greater or less (see WrapMode.)
number [5] (255)
The red color component.
number [6] (255)
The green color component.
number [7] (255)
The blue color component.
number [8] (255)
The alpha color component.
GeometryDrawMode draw_mode ("fan")
How the vertices are used when drawing. The default mode "fan" is sufficient for simple convex polygons.
table vertex_map ({1, 2, 3, ...})
A table describing the order of the vertices when they are drawn. The vertex map allows you to re-order or reuse vertices when drawing without changing the actual vertex parameters.

Returns

Geometry geometry
The new geometry.

Function

Synopsis

geometry = love.graphics.newGeometry( vertex1, vertex2, vertex3, ..., draw_mode, vertex_map )

Arguments

table vertex1
The vertex information table for the first vertex.
table vertex2
The vertex information table for the second vertex.
table vertex3
The vertex information table for the third vertex.
GeometryDrawMode draw_mode ("fan")
How the vertices are used when drawing. The default mode "fan" is sufficient for simple convex polygons.
table vertex_map ({1, 2, 3, ...})
A table describing the order of the vertices when they are drawn. The vertex map allows you to re-order or reuse vertices when drawing without changing the actual vertex parameters.

Returns

Geometry geometry
The new geometry.

See Also


Other Languages