Page 1 of 1

Drawing Quads

Posted: Mon Oct 13, 2014 9:03 pm
by davisdude
When you create a quad using love.graphics.newQuad, is there any particular reason that the image is not stored as part of the data?
What I mean by that is this:
Why should I have to do

Code: Select all

local Image = love.graphics.newImage( 'Image.png' )
local Quad = love.graphics.newQuad( 0, 0, 32, 32, 32, 32 )

-- Later:
love.graphics.draw( Image, Quad, 0, 0 )
Why can I not just do this:

Code: Select all

local Image = love.graphisc.newImage( 'Image.png' )
local Quad = love.graphics.newQuad( Image, 0, 0, 32, 32, 32, 32 )

-- Later
love.graphics.draw( Quad, 0, 0 )
This would be more like the traditional love.draw method and less confusing, in my opinion.

It could be argued that this keeps less typing (i.e. not typing the image every time you make a new quad), which I understand.
It could also be argued that it is a good coding method to remind you that it is a quad, and not an image, or for flexibility (but are there any examples of this?).

I'm just wondering, that's all. I think this would be better, but I'm no engine developer, just a curious programmer. Thanks. :)

Re: Drawing Quads

Posted: Mon Oct 13, 2014 10:42 pm
by Santos

Re: Drawing Quads

Posted: Tue Oct 14, 2014 1:14 am
by davisdude
Thanks for the link.
SpriteBatches might be the way to go.
Still, I think it would be nice.

Re: Drawing Quads

Posted: Sat Oct 18, 2014 12:34 am
by Karai17
A Quad is not an image, it is set of metadata describing part of an image.

Re: Drawing Quads

Posted: Sat Oct 18, 2014 2:20 am
by davisdude
That's a good point. I hadn't though of that. :oops: