fix(core): finally fix key flushing correctly

This commit is contained in:
Kazhnuz 2019-08-14 16:22:43 +02:00
parent da647237a7
commit becd4aace5
2 changed files with 9 additions and 5 deletions

View file

@ -41,6 +41,8 @@ function InputManager:initSources()
local source = VirtualPad(self, sourceid, data)
table.insert(self.sources, source)
end
self.fakekeys = self:getKeyList(1)
end
-- INFO FUNCTIONS

View file

@ -140,10 +140,10 @@ function Scene:setKeys()
if (self.inputLockedTimer <= 0 ) then
self.inputLocked = false
end
self.menusystem.keys = self.sources[1].fakekeys
self.menusystem.keys = self:getKeys(1)
else
self.sources = core.input.sources
self.menusystem.keys = self.sources[1].keys
self.menusystem.keys = self:getKeys(1)
end
end
@ -153,17 +153,19 @@ function Scene:getKeys(sourceid)
end
local sourceid = sourceid or 1
if (self.inputLocked) then
return self.sources[sourceid].keys
else
core.debug:print("scene", "inputs are currently locked")
return core.input.fakekeys
else
return self.sources[sourceid].keys
end
end
function Scene:flushKeys()
core.input:flushKeys()
self.sources = core.input:getSources()
self.inputLockedTimer = 1
self.inputLockedTimer = 2
self.inputLocked = true
end