allow additional bindings for keyboard cycling

This commit is contained in:
fysx 2015-02-27 22:20:33 +01:00
parent 4eadfee6f4
commit 3f10e0f86a

View file

@ -30,8 +30,16 @@ local NO_WIDGET = {}
local cycle = { local cycle = {
-- binding = {key = key, modifier1, modifier2, ...} XXX: modifiers are OR-ed! -- binding = {key = key, modifier1, modifier2, ...} XXX: modifiers are OR-ed!
prev = {key = 'tab', 'lshift', 'rshift'}, prev = {
next = {key = 'tab'}, { key = 'up'},
{ key = 'left'},
{ key = 'tab', 'lshift', 'rshift'},
},
next = {
{ key = 'down'},
{ key = 'right'},
{ key = 'tab'},
}
} }
local function pressed(k) local function pressed(k)
@ -57,8 +65,12 @@ local function tryGrab(id)
end end
local function isBindingDown(bind) local function isBindingDown(bind)
local modifiersDown = #bind == 0 or love.keyboard.isDown(unpack(bind)) for i,b in pairs (bind) do
return key == bind.key and modifiersDown local modifiersDown = #b == 0 or love.keyboard.isDown(unpack(b))
if key == b.key and modifiersDown then
return true
end
end
end end
local function makeCyclable(id) local function makeCyclable(id)