Page 1 of 1

love.graphics.draw not drawing anything.

Posted: Sun Dec 06, 2015 4:37 pm
by ntnick
'ello love2d forums.

I'm using HUMP's gamestate module, and calling love.graphics.draw from a gamestate's :draw function dosen't work.

Code: Select all

tiles = {}

player = { x = 10, y = 10, speed = 15 }
maptest = love.graphics.newImage("images/maptest.png")

function tiles:draw()
  love.graphics.draw(maptest, 1, 1)
end

return tiles
Basically, the image dosen't render.
maptest.png is 640x640, and I've tried using other images but they don't work either.

Any suggestions?

Re: love.graphics.draw not drawing anything.

Posted: Sun Dec 06, 2015 4:50 pm
by s-ol
Did you ever enter the gamestate? And do Gamestate.registerEvents()?

Re: love.graphics.draw not drawing anything.

Posted: Sun Dec 06, 2015 6:31 pm
by ntnick
S0lll0s wrote:Did you ever enter the gamestate? And do Gamestate.registerEvents()?
I did enter the gamestate, but I haven't used .registerEvents yet. I'll try that, and report back.

edit: .registerEvents did not work. Nothing is being rendered.

Re: love.graphics.draw not drawing anything.

Posted: Sun Dec 06, 2015 10:55 pm
by s-ol
Well if you don't post your full code we can't help. It cannot work without .registerEvents unless you call Gamestate.draw on your own in love.draw. Also if you have a custom love.draw already you need to make sure .registerEvents is called after defining that, for example in love.load.