Skip to content
Snippets Groups Projects
Commit 12ea9ef8 authored by dg's avatar dg
Browse files

plop


git-svn-id: http://svn.net-core.org/repos/t-engine4@1400 51575b47-30f0-44d4-a5cc-537603b46e54
parent 71103878
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,8 @@ end
function _M:use(item)
local t = item
local curcol = self.c_tree.cur_col
local curcol = self.c_tree.cur_col - 1
if not item or item.nodes or curcol < 1 or curcol > 2 then return end
--
-- Make a dialog to ask for the key
......@@ -74,17 +75,16 @@ function _M:use(item)
end
if sym == KeyBind._BACKSPACE then
t["bind"..curcol] = nil
KeyBind.binds_remap[t.type] = KeyBind.binds_remap[t.type] or t.k.default
KeyBind.binds_remap[t.type][curcol] = nil
elseif sym ~= KeyBind._ESCAPE then
local ks = KeyBind:makeKeyString(sym, ctrl, shift, alt, meta, unicode)
print("Binding", t.name, "to", ks)
t["bind"..curcol] = ks
print("Binding", t.name, "to", ks, "::", curcol)
KeyBind.binds_remap[t.type] = KeyBind.binds_remap[t.type] or t.k.default
KeyBind.binds_remap[t.type][curcol] = ks
end
self.c_tree:drawItem(item)
game:unregisterDialog(d)
end}
......@@ -101,10 +101,10 @@ function _M:use(item)
core.key.modState("meta") and true or false
)
print("Binding", t.name, "to", ks)
t["bind"..curcol] = ks
KeyBind.binds_remap[t.type] = KeyBind.binds_remap[t.type] or t.k.default
KeyBind.binds_remap[t.type][curcol] = ks
self.c_tree:drawItem(item)
game:unregisterDialog(d)
end },
}
......
......@@ -58,7 +58,7 @@ for i, file in ipairs(fs.list("/settings/")) do
end
-- Load default keys
engine.KeyBind:load("move,actions,debug")
engine.KeyBind:load("move,hotkeys,inventory,actions,interface,debug")
-- Load remaps
if fs.exists("/keybinds.cfg") then
......
......@@ -182,6 +182,12 @@ function _M:generate()
MOVE_UP = function() self.sel = util.boundWrap(self.sel - 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display) self:onSelect() end,
MOVE_DOWN = function() self.sel = util.boundWrap(self.sel + 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display) self:onSelect() end,
}
if self.sel_by_col then
self.key:addBinds{
MOVE_LEFT = function() self.cur_col = util.boundWrap(self.cur_col - 1, 1, #self.sel_by_col) self:onSelect() end,
MOVE_RIGHT = function() self.cur_col = util.boundWrap(self.cur_col + 1, 1, #self.sel_by_col) self:onSelect() end,
}
end
self.key:addCommands{
_HOME = function()
self.sel = 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment