Difference between revisions of "love.graphics.line (Français)"

(Created page with "Absice du premier point")
 
Line 1: Line 1:
Absice du premier point
+
Dessine des lignes reliant des points.
 +
== Function ==
 +
=== Synopsis ===
 +
<source lang="lua">
 +
love.graphics.line( x1, y1, x2, y2, ... )
 +
</source>
 +
=== Arguments ===
 +
{{param|number|x1|Absice du premier point.}}
 +
{{param|number|y1|Ordonnée du premier point.}}
 +
{{param|number|x2|Abscice du deuxième point.}}
 +
{{param|number|y2|Ordonnée du deuxième point.}}
 +
{{param|number|...|Il est possible d'ajouter des points suplémentaires pour dessiner une polyline.}}
 +
=== Returns ===
 +
Rien.
 +
== Function ==
 +
=== Synopsis ===
 +
<source lang="lua">
 +
love.graphics.line( points )
 +
</source>
 +
=== Arguments ===
 +
{{param|table|points|A table of point positions, as described above.}}
 +
=== Returns ===
 +
Nothing.
 +
== Examples ==
 +
Draw the outline of a simple trapezoid.
 +
<source lang="lua">
 +
function love.draw()
 +
  love.graphics.line(200,50, 400,50, 500,300, 100,300, 200,50)  -- last pair is a repeat to complete the trapezoid
 +
end
 +
</source>
 +
Draw a line from the center of the screen to the mouse pointer.
 +
<source lang="lua">
 +
w = love.graphics.getWidth() / 2  -- half the window width
 +
h = love.graphics.getHeight() / 2  -- half the window height
 +
function love.draw()
 +
  local mx, my = love.mouse.getPosition()  -- current position of the mouse
 +
  love.graphics.line(w, h, mx, my)
 +
end
 +
</source>
 +
Draw a zigzag line from a single table.
 +
<source lang="lua">
 +
sometable = {
 +
  100, 100,
 +
  200, 200,
 +
  300, 100,
 +
  400, 200,
 +
}
 +
function love.draw()
 +
  love.graphics.line(sometable)
 +
end
 +
</source>
 +
== See Also ==
 +
* [[parent::love.graphics]]
 +
* [[love.graphics.setLine]]
 +
* [[love.graphics.setLineWidth]]
 +
* [[love.graphics.setLineStyle]]
 +
[[Category:Functions]]
 +
[[Sub-Category::Drawing| ]]
 +
{{#set:Description=Draws lines between points.}}
 +
{{#set:Since=000}}
 +
== Other Languages ==
 +
{{i18n|love.graphics.line}}

Revision as of 22:08, 9 August 2017

Dessine des lignes reliant des points.

Function

Synopsis

love.graphics.line( x1, y1, x2, y2, ... )

Arguments

number x1
Absice du premier point.
number y1
Ordonnée du premier point.
number x2
Abscice du deuxième point.
number y2
Ordonnée du deuxième point.
number ...
Il est possible d'ajouter des points suplémentaires pour dessiner une polyline.

Returns

Rien.

Function

Synopsis

love.graphics.line( points )

Arguments

table points
A table of point positions, as described above.

Returns

Nothing.

Examples

Draw the outline of a simple trapezoid.

function love.draw()
   love.graphics.line(200,50, 400,50, 500,300, 100,300, 200,50)   -- last pair is a repeat to complete the trapezoid
end

Draw a line from the center of the screen to the mouse pointer.

w = love.graphics.getWidth() / 2   -- half the window width
h = love.graphics.getHeight() / 2   -- half the window height
function love.draw()
   local mx, my = love.mouse.getPosition()  -- current position of the mouse
   love.graphics.line(w, h, mx, my)
end

Draw a zigzag line from a single table.

sometable = {
   100, 100,
   200, 200,
   300, 100,
   400, 200,
}
function love.draw()
   love.graphics.line(sometable)
end

See Also


Other Languages