create multiple lines with one function

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
cemcmd
Prole
Posts: 6
Joined: Sat Dec 03, 2016 12:07 am

create multiple lines with one function

Post by cemcmd »

I want to create multiple lines from constantly changing X and Y variables. But I can not figure out how to create more than 1 line other than to use more than 1 "love.graphics.line" function.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: create multiple lines with one function

Post by s-ol »

1. there is nothing wrong with calling love.graphics.line multiple times.
2. you can give more than two coordinate pairs to love.graphics.line to create a continuous line with more than one segment (see wiki page example)
3. if you draw a lot of lines you can theoreticall create a mesh to draw them, but it's quite complicated since you need to turn every line into at least two triangles and add those vertices to the Mesh.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: create multiple lines with one function

Post by Jasoco »

Löve can draw thousands of objects per frame without getting anywhere close to going lower than 60FPS. You don't need to be afraid to draw a lot of objects.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], Google [Bot], slime and 1 guest