Page 1 of 1

Why won't the image load?[On Windows 64bit]

Posted: Tue Oct 08, 2013 10:51 pm
by goodguy68
OK So I don't know what the problem is, I looked to see if anyone else knew what the problem would be a no... So every time I go to load up an image on .love, it can't find the image. I've tried many diffrent ways/routes to the image, but it still doesn't load. Heres the love.load part of the codeing.

Code: Select all

function love.load()
	image = love.graphics.newImage("HappyB-Day.png")
	local f = love.graphics.newFont(48)
	love.graphics.setFont(f)
	love.graphics.setColor(0,0,0,255)
	love.graphics.setBackgroundColor(255,255,255)
end
Anywhere I'm suppost to place the HappyB-Day.png file or something? Please if you can help me, thank you. <3

Re: Why won't the image load?[On Windows 64bit]

Posted: Wed Oct 09, 2013 4:39 am
by raidho36
I fail to see your problem. I have W764 and it works just fine for me. Besides, you haven't provided an error message. You're supposed to read these thoughtfully, 'y'no.

Just to clarify: unless you specify an absolute path, your working directory is assumed to be base for the relative path. Without subpaths, your files must be in the same folder as executable file. Also, make sure you spelled your filename correctly down the single glyph. Windows should make no difference between uppercase and lowercase letters (hello DOS legacy), but just make sure. Also, make sure you don't overwrite your "image" anywhere before you get to draw it.

Re: Why won't the image load?[On Windows 64bit]

Posted: Wed Oct 09, 2013 7:16 am
by Plu
Can you provide the .love file? The image should be in the same folder as your main.lua and it should be named exactly like it is in the code, including capital letters.

Re: Why won't the image load?[On Windows 64bit]

Posted: Wed Oct 09, 2013 10:12 am
by HJW012
Did you ever actually draw in the image or did you only define the variable that is the directory to the image? If you haven't, you can try this.

Code: Select all

function love.draw()
 love.graphics.draw(imagename, x, y)
end

Re: Why won't the image load?[On Windows 64bit]

Posted: Thu Oct 10, 2013 10:58 am
by iPoisonxL
I think he's referring that Love2D tells him the image doesn't exist. The way you're calling it is checking in the same directory as main.lua, so make sure it's in the same directory. If it's another folder, like for example IMG, call love.graphics.loadImage("IMG/Happy-Bday.png")