Ryan a20dfa2b8f Add 'mulit/' from commit '285fa7e933d1986bcbd354294c05cee40ef43cea'
git-subtree-dir: mulit
git-subtree-mainline: 69233e59c8a641ceb835daae961ebce1127faa79
git-subtree-split: 285fa7e933d1986bcbd354294c05cee40ef43cea
2017-07-28 11:17:18 -04:00

24 lines
573 B
Plaintext

function gui:setHotKey(key)
local tab=key:split("+")
self.hotkeys=tab
self.cooldown=false
self.Alarm=multi:newAlarm(1)
self.Alarm.parent=self
self.args={}
self.funcHK=multi:newConnection()
self.Alarm:OnRing(function(alarm) alarm.parent.cooldown=false end)
function self:OnHotKey(func)
self.funcHK:connect(func)
end
self:OnUpdate(function(self)
if self.cooldown then return end
for i=1,#self.hotkeys do
if not(love.keyboard.isDown(self.hotkeys[i])) then
return
end
end
self.cooldown=true
self.funcHK:Fire(self)
self.Alarm:Reset()
end)
end