Love.graphics.image comes up blank

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
mgthefourth
Prole
Posts: 2
Joined: Fri Oct 21, 2011 10:42 pm

Love.graphics.image comes up blank

Post 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 1910 times
Attachments
Screenshot
Screenshot
screenshot.PNG (17.58 KiB) Viewed 1910 times
noImage.love
End result
(3.23 KiB) Downloaded 100 times
User avatar
slime
Solid Snayke
Posts: 3170
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Love.graphics.image comes up blank

Post by slime »

PO2_Syndrome, LÖVE 0.8.0 will automatically pad images for you transparently, if needed.
mgthefourth
Prole
Posts: 2
Joined: Fri Oct 21, 2011 10:42 pm

Re: Love.graphics.image comes up blank

Post 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.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Love.graphics.image comes up blank

Post 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.
Post Reply

Who is online

Users browsing this forum: Giapp and 8 guests