Page 1 of 1

Images help

Posted: Wed Jul 06, 2011 7:56 pm
by n0ug4t
I am trying to display an image on screen, but when I draw it all I'm getting is a white box. Here's the main.lua:

Code: Select all

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

function love.draw()
	love.graphics.draw(img)
end
Am I doing something wrong with the .draw method?

Re: Images help

Posted: Wed Jul 06, 2011 8:00 pm
by nevon
You're experiencing PO2 Syndrome

Re: Images help

Posted: Wed Jul 06, 2011 8:03 pm
by NobleFlame
Might I ask where you stored the images?

Re: Images help

Posted: Wed Jul 06, 2011 8:09 pm
by n0ug4t
@Noble
Images are in the same folder as the main.lua file, I wouldn't suspect problems with the file path. Although I did notice that LOVE removes backslashes (\). Any way to get around that for files stored in other places?

@Nevon
PO2 syndrome seemed to be the culprit. Thanks a bunch. Karma++

Re: Images help

Posted: Wed Jul 06, 2011 8:19 pm
by NobleFlame
Im asking because im not sure where to store my audio... As you can see im a noob to LOVE.

Wait? That sounded strange... Im a noob... to love... o.e

Re: Images help

Posted: Wed Jul 06, 2011 8:21 pm
by nevon
n0ug4t wrote:@Noble
Images are in the same folder as the main.lua file, I wouldn't suspect problems with the file path. Although I did notice that LOVE removes backslashes (\). Any way to get around that for files stored in other places?
You should be using *NIX style paths. So gfx/my_fancy_image.png, not gfx\my_fancy_image.png

Re: Images help

Posted: Wed Jul 06, 2011 8:28 pm
by n0ug4t
Thanks again.

Re: Images help

Posted: Thu Jul 07, 2011 7:10 am
by Robin
Also, LÖVE doesn't remove backslashes, Lua does. This allows you to do things like:

Code: Select all

text = "one line of text\nsecond line of text."
print(text)
-- prints:
-- one line of text
-- second line of text