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) local source = VirtualPad(self, sourceid, data)
table.insert(self.sources, source) table.insert(self.sources, source)
end end
self.fakekeys = self:getKeyList(1)
end end
-- INFO FUNCTIONS -- INFO FUNCTIONS

View file

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