Images help

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.
Post Reply
n0ug4t
Prole
Posts: 6
Joined: Tue Jul 05, 2011 11:17 pm

Images help

Post 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?
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Images help

Post by nevon »

You're experiencing PO2 Syndrome
User avatar
NobleFlame
Prole
Posts: 13
Joined: Wed Jul 06, 2011 4:17 pm

Re: Images help

Post by NobleFlame »

Might I ask where you stored the images?
~{::Noble Flame::}~
n0ug4t
Prole
Posts: 6
Joined: Tue Jul 05, 2011 11:17 pm

Re: Images help

Post 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++
User avatar
NobleFlame
Prole
Posts: 13
Joined: Wed Jul 06, 2011 4:17 pm

Re: Images help

Post 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
~{::Noble Flame::}~
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Images help

Post 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
Last edited by nevon on Wed Jul 06, 2011 8:33 pm, edited 1 time in total.
n0ug4t
Prole
Posts: 6
Joined: Tue Jul 05, 2011 11:17 pm

Re: Images help

Post by n0ug4t »

Thanks again.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Images help

Post 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
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests