Question about love.graphics.draws

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
surtic
Citizen
Posts: 74
Joined: Sat Jul 12, 2008 12:18 am

Question about love.graphics.draws

Post by surtic »

What exactly is the connection between an image's centre (as set by setCenter, or the default centre), and the position of a partial image on the screen? I have a feeling that any partial bitmap is automatically centred, regardless of setCenter (and that there is no control over the centre of the partial image).

For example, I have this code:

Code: Select all

function load()
  image = love.graphics.newImage("square.png")
  image:setCentre(0, 0)
end
The image is a 100x100 pixels square. When I draw it like this:

Code: Select all

  love.graphics.draw(image, 100, 100)
it's doing what I'm asking it to do, but when I draw it like this:

Code: Select all

  love.graphics.draws(image, 100, 100, 0, 0, 100, 100)
the image is centred about (100, 100). I don't think I have any control over the centre point of the partial bitmap.

I thought that this could be a solution to the sprite-sheet problem (and the image-from-image suggestion), but having no control over the centre point means that I can't (for example) rotate a partial image about its real centre (unless it's exactly the bitmap's centre).
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Question about love.graphics.draws

Post by rude »

There should be an overload of love.graphics.draws which allows you to set the center within the partial image.
surtic
Citizen
Posts: 74
Joined: Sat Jul 12, 2008 12:18 am

Re: Question about love.graphics.draws

Post by surtic »

Thanks, I missed that one.
Post Reply

Who is online

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