My images won't load..

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.
Wheaties
Prole
Posts: 2
Joined: Fri Jul 02, 2010 4:30 am

My images won't load..

Post by Wheaties »

I am using:

Code: Select all

pappi = love.graphics.newImage("pappi.png")
and then later

Code: Select all

   love.graphics.draw(pappi, x, y)
Just the standard stuff.. But my images won't load. I have them in the file I am dragging into the LOVE exe, anything I am doing wrong?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: My images won't load..

Post by Robin »

Is this in main.lua?

Is the drawing code in love.draw()?

Are you dragging the folder main.lua is in on the exe?

If you answered any of these questions with "no": there's your answer. ;)
Help us help you: attach a .love.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: My images won't load..

Post by kikito »

Check the lowercase-uppercase of the filenames and extensions. If there is any difference between your source code and your files (i.e. in your code you wrote pappi.png but your file was pappi.PNG) then it will work on the "uncompressed" windows folder but it will not work when you make the compressed file.
When I write def I mean function.
Wheaties
Prole
Posts: 2
Joined: Fri Jul 02, 2010 4:30 am

Re: My images won't load..

Post by Wheaties »

Well, I may need to rephrase this. The image itself is kind of loading, but I get a giant white box and no image, same when I run the hamster-ball tutorial code.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: My images won't load..

Post by kikito »

Could be like a power-of-two issue then.

Try updating your graphic card drivers, and if that doesn't solve it, re-dimension the images so they are power-of-two sized (for example 128x128, or 128x256)
When I write def I mean function.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: My images won't load..

Post by TechnoCat »

The hamster should be po2. Right now it is 82×81. Someone update it! http://love2d.org/wiki/File:Resource-HamsterBall.png
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: My images won't load..

Post by nevon »

TechnoCat wrote:The hamster should be po2. Right now it is 82×81. Someone update it! http://love2d.org/wiki/File:Resource-HamsterBall.png
Fixed.
Will
Prole
Posts: 3
Joined: Sun Jul 11, 2010 9:09 am

Re: My images won't load..

Post by Will »

I had the exact same problem. I was trying to use an image for a background; it was 800 x 600. I changed it to 512 x 512 and it displayed. This poses a problem for me though. Since the window for Love runs at a default 800 x 600 resolution, how am I supposed to add a background if the framework doesn't support images that are 800 x 600?

Is there a way to make the resolution of the default window smaller? Maybe something like 768 x 768, perhaps? I'm new to Love and new to Lua as well. Help would be greatly appreciated.

So far the framework seems really nice. I hope to continue using it. Thanks.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: My images won't load..

Post by vrld »

Will wrote:Is there a way to make the resolution of the default window smaller? Maybe something like 768 x 768, perhaps? I'm new to Love and new to Lua as well.
Yes, there is:

http://love2d.org/wiki/Config_Files
http://love2d.org/wiki/love.graphics.setMode
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: My images won't load..

Post by nevon »

Will wrote:I had the exact same problem. I was trying to use an image for a background; it was 800 x 600. I changed it to 512 x 512 and it displayed. This poses a problem for me though. Since the window for Love runs at a default 800 x 600 resolution, how am I supposed to add a background if the framework doesn't support images that are 800 x 600?
Just create your image like you want it, and then add transparent padding to make it 1024x1024.
Will wrote:Is there a way to make the resolution of the default window smaller? Maybe something like 768 x 768, perhaps? I'm new to Love and new to Lua as well. Help would be greatly appreciated.
There is. 768 isn't a power of two though.
Post Reply

Who is online

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