Drawing Quads

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Drawing Quads

Post 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. :)
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Drawing Quads

Post by Santos »

davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Drawing Quads

Post by davisdude »

Thanks for the link.
SpriteBatches might be the way to go.
Still, I think it would be nice.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Drawing Quads

Post by Karai17 »

A Quad is not an image, it is set of metadata describing part of an image.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Drawing Quads

Post by davisdude »

That's a good point. I hadn't though of that. :oops:
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 7 guests