core/input: add a way to flush active keys
This commit is contained in:
parent
a7676297ca
commit
b80bd248a7
2 changed files with 16 additions and 0 deletions
|
@ -78,6 +78,17 @@ function InputManager:getKey(padkey)
|
||||||
return key
|
return key
|
||||||
end
|
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)
|
function InputManager:update(dt)
|
||||||
for k,v in pairs(self.keys) do
|
for k,v in pairs(self.keys) do
|
||||||
local isDown = self:isDown(k)
|
local isDown = self:isDown(k)
|
||||||
|
|
|
@ -58,4 +58,9 @@ function Scene:clear()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Scene:flushKeys()
|
||||||
|
core.input:flushKeys()
|
||||||
|
self.keys = core.input.keys
|
||||||
|
end
|
||||||
|
|
||||||
return Scene
|
return Scene
|
||||||
|
|
Loading…
Reference in a new issue