roomy icon indicating copy to clipboard operation
roomy copied to clipboard

Hooking onto keypressed does not trigger the callback.

Open Yeahyay opened this issue 6 years ago • 5 comments

While testing roomy on love 11.0.0, the keypressed callback does not work, but the keyreleased callback does.

Yeahyay avatar Feb 05 '19 06:02 Yeahyay

code example?

tesselode avatar Feb 05 '19 06:02 tesselode

stateManager = roomy.new()

function love.update(dt)
	timer = timer+dt
	FPS = 1/tick.dt
end

function love.draw()
end

stateManager:hook{callbacks = {"update", "draw", "quit", "keypressed", "keyreleased"}, applyBefore = {"draw"}}

requireDirectory("states") --essentially requires game.lua

stateManager:switch(game)
stateManager:apply()

game.loaded = true

in game.lua

game = {}
game.name = "game"
game.loaded = false
function game:keypressed(key)
	print(key)
end
function game:keyreleased(key)
	print(key)
end

Yeahyay avatar Feb 05 '19 07:02 Yeahyay

It's a little hard to tell what's wrong without seeing the whole code. When do you switch to the game state?

tesselode avatar Feb 05 '19 21:02 tesselode

It's a little hard to tell what's wrong without seeing the whole code. When do you switch to the game state?

Edited the original comment.

Yeahyay avatar Feb 05 '19 21:02 Yeahyay

still don't see anything that looks wrong. if you post a love file i could take a look

tesselode avatar Feb 05 '19 23:02 tesselode