Class engine.KeyCommand
Receives keypresses and acts upon them
Methods
engine.KeyCommand:setupProfiler ()
Adds the profiler keybind (ctrl, alt, shift, p)
engine.KeyCommand:setupRebootKeys ()
Adds the game reboot keybind (ctrl, alt, shift, r/n)
engine.KeyCommand:reset ()
Reset all binds
engine.KeyCommand:addCommand (sym, mods, fct, anymod)
Adds a key/command combination
engine.KeyCommand:addIgnore (sym, v)
Adds a key to be fully ignored
engine.KeyCommand:addCommands (t)
Adds many key/command at once
engine.KeyCommand:setTextInput (fct)
Receives any unbound keys as UTF8 characters (if possible)
Methods
- engine.KeyCommand:setupProfiler ()
- Adds the profiler keybind (ctrl, alt, shift, p)
- engine.KeyCommand:setupRebootKeys ()
- Adds the game reboot keybind (ctrl, alt, shift, r/n)
- engine.KeyCommand:reset ()
- Reset all binds
- engine.KeyCommand:addCommand (sym, mods, fct, anymod)
-
Adds a key/command combination
Parameters:
- sym the key to handle
- mods a table with the mod keys needed, i.e: {"ctrl", "alt"}
- fct the function to call when the key is pressed
- anymod allow any modifier
- engine.KeyCommand:addIgnore (sym, v)
-
Adds a key to be fully ignored
Parameters:
- sym the key to handle
- v boolean to ignore or not
- engine.KeyCommand:addCommands (t)
-
Adds many key/command at once
Parameters:
- t
Usage:
self.key:addCommands{<br/> _LEFT = function()<br/> print("left")<br/> end,<br/> _RIGHT = function()<br/> print("right")<br/> end,<br/> {{"x","ctrl"}] = function()<br/> print("control+x")<br/> end,<br/> }
- engine.KeyCommand:setTextInput (fct)
-
Receives any unbound keys as UTF8 characters (if possible)
Parameters:
- fct the function to call for each key, get a single parameter to pass the UTF8 string