Page 1 of 1

Need help with drawing an image!

Posted: Thu Jan 22, 2015 3:45 am
by Happy5354
Hello... I'm trying to draw a simple image, I read the filesystem page on the wiki and trying to open an image and draw it but apparently, I can't...

Here's my code to open and draw the image:

Code: Select all

function love.load()
	picture = love.graphics.newImage("bg.jpg")
end

function love.update( dt )
end

function love.draw()
	love.graphics.draw(picture, 200, 200)
end
In my root folder(where the .love is located) there is:
  • main.lua
    conf.lua
    bg.jpg
    main.zip
    run.bat

PS: the "run.bat" file is only renaming the "main.zip" file into "main.love" and then I run it

Thanks for your time!

Re: Need help with drawing an image!

Posted: Thu Jan 22, 2015 11:01 am
by Robin
Could you upload the .love?

Re: Need help with drawing an image!

Posted: Thu Jan 22, 2015 2:43 pm
by s-ol
Happy5354 wrote:Hello... I'm trying to draw a simple image, I read the filesystem page on the wiki and trying to open an image and draw it but apparently, I can't...
1.) What happens?
2.) Upload your .love

3.) How did you try to run it?

the first two should always be covered when asking for help, we absolutely cannot help if you don't tell us what exactly is happening.

Re: Need help with drawing an image!

Posted: Thu Jan 22, 2015 10:58 pm
by Happy5354
When I rename the .zip into .love and run it, I get: ' main.lua:2: Could not open file bg.png. Cannot read file '

PS: I tried it at school, and it works, and uploaded it on mega and opened it at home, worked too... But I still want to know why.

By the way I attached my .love file

Re: Need help with drawing an image!

Posted: Thu Jan 22, 2015 11:04 pm
by Positive07
You posted this:

Code: Select all

picture = love.graphics.newImage("bg.jpg")
Which does work...

But in your .love file you do this:

Code: Select all

picture = love.graphics.newImage(".\bg.jpg")
Which does not work...

Re: Need help with drawing an image!

Posted: Fri Jan 23, 2015 2:39 am
by Happy5354
Yeah, I checked on Google, and I guy wrote this, I forgot to remove it...