core/input: add a way to flush active keys

This commit is contained in:
Kazhnuz 2019-02-15 18:45:38 +01:00
parent a7676297ca
commit b80bd248a7
2 changed files with 16 additions and 0 deletions

View file

@ -78,6 +78,17 @@ function InputManager:getKey(padkey)
return key
end
function InputManager:flushKeys()
self.keys = {}
for k,v in pairs(self.data.keys) do
self.keys[k] = {}
self.keys[k].isDown = false
self.keys[k].isPressed = false
self.keys[k].isReleased = false
self.keys[k].test = "ok"
end
end
function InputManager:update(dt)
for k,v in pairs(self.keys) do
local isDown = self:isDown(k)

View file

@ -58,4 +58,9 @@ function Scene:clear()
end
function Scene:flushKeys()
core.input:flushKeys()
self.keys = core.input.keys
end
return Scene