Hi guys,
I've just started working with LOVE and I have one small question.
Is it possible to draw multiple objects as one? For example, instead of doing
love.graphics.rectangle( "fill", x1, y1, width1, height1)
love.graphics.rectangle( "fill", x2, y2, width2, height2),
I want to draw both rectangle with just one line of code, by pre-defining them somehow, like
double_rectangle = rectangle1 + rectangle2
draw double_rectangle
I'm asking because I'm working with multiple stacked rectangles of different transparencies and drawing them every frame is very CPU-intensive.
Hope you can help!
Linking/merging drawings
- DaedalusYoung
- Party member
- Posts: 413
- Joined: Sun Jul 14, 2013 8:04 pm
Re: Linking/merging drawings
If they're static, you can draw them to a Canvas, then draw the Canvas to screen.
Re: Linking/merging drawings
Love doesn't have a built-in "shape batch" so to speak, but you can use Mesh to pack the vertices and draw them with one draw call... requires a little extra work though.
Re: Linking/merging drawings
You can also wrap them into a function, and call that for the actual drawing.
Who is online
Users browsing this forum: Bing [Bot] and 6 guests