Basic Image Question

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Neverfly
Prole
Posts: 10
Joined: Sat Jun 06, 2009 5:39 pm

Basic Image Question

Post 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
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Basic Image Question

Post 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
Neverfly
Prole
Posts: 10
Joined: Sat Jun 06, 2009 5:39 pm

Re: Basic Image Question

Post by Neverfly »

Ok, so what would be the final code?
I really didn't get that example.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Basic Image Question

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

Who is online

Users browsing this forum: Bing [Bot] and 1 guest