Page 1 of 1

Basic Image Question

Posted: Sat Jun 06, 2009 7:52 pm
by Neverfly
Say I did this:

Code: Select all

function load()
image = love.graphics.newImage("Images/uziah.png")
end

function draw()
love.graphics.draw(image, 200,200)
end
Now, when I did image = love.graphics.newImage("Images/uziah.png"), I got the error:
could not load file Images/uziah.png

Now my question is, Where does the system look for an image. I typed in the full directory once, and It still didn't work.

BTW, Images is a folder which resides in C: Program Files/ LOVE

Re: Basic Image Question

Posted: Sat Jun 06, 2009 8:12 pm
by rude
LÖVE uses a virtual filesystem which mounts the directory of the running game. See love.filesystem.

Code: Select all

Correct directory structure:
c:\lol\awesome\game\main.lua
c:\lol\awesome\game\Images\uziah.png

Then run:
love c:\lol\awesome\game

Re: Basic Image Question

Posted: Sat Jun 06, 2009 9:31 pm
by Neverfly
Ok, so what would be the final code?
I really didn't get that example.

Re: Basic Image Question

Posted: Sat Jun 06, 2009 10:14 pm
by rude
The final code would be your initial code; there's nothing wrong with it. LÖVE mounts the directory containing main.lua as its virtual file system root.

Also, WTFM.

(W = watch)