Page 1 of 1

Love.graphics.image comes up blank

Posted: Fri Oct 21, 2011 11:05 pm
by mgthefourth
Hi all,

I'm new to Love but have so far been able to make it work. Recently I tried to display an image to the screen with this code:

Code: Select all

function love.load()
   img  = love.graphics.newImage("test.png")


end

function love.update(dt)

end
function love.draw()
	love.graphics.draw(img, 0, 0)
end
But when I drag the folder (containing the main.lua file and an image named test.png (see attached)) all I get is an empty white box.

I drew the png file in MSPaint.


Am I missing something fundamental or is MSPaint just the wrong program to use?

Thanks,

mg.
Original image
Original image
test.png (3.19 KiB) Viewed 1911 times

Re: Love.graphics.image comes up blank

Posted: Fri Oct 21, 2011 11:08 pm
by slime
PO2_Syndrome, LÖVE 0.8.0 will automatically pad images for you transparently, if needed.

Re: Love.graphics.image comes up blank

Posted: Sat Oct 22, 2011 10:48 am
by mgthefourth
Thank you so much, I had been stuck like that for a while.

Just a small point,

Some of the example images (namely the one used in this tutorial http://love2d.org/wiki/AnAL don't use PO2 widths and heights, which is would probably cause confusion for beginners.

Thanks again

mg.

Re: Love.graphics.image comes up blank

Posted: Sun Oct 23, 2011 4:59 pm
by Jasoco
Fortunately when 0.8.0 is finally released, it will no longer be a problem. I wish it would come out for realsies. I have two pre-release 0.8.0's because both have differences and a lot of examples that use the new features use the old stuff and a lot use the new stuff so I have to keep both.