arcan-fe Wiki
Scriptable frontend for media applications.
Status: Beta
Brought to you by:
bjornstahl
This script is used to help query the user for all different kinds of weird input devices.
The basic pattern used looks somewhat like:
::lua
system_load("scripts/keyconf.lua")();
-- three labels to configure (the script will forcibly inject MENU_ESCAPE)
-- r as a first character indicates a REQUIRED label, empty space is optional
-- and a means an analog input.
labels = {"rKEYLABEL_A", " KEYLABEL_B", "aKEYLABEL_C"};
-- prepare a keyconfig that support the specified set of labels (could be nil and get a default one)
keyconfig = keyconf_create(labels);
-- if active, then there's nothing needed to be done, else we need a UI to help.
if (keyconfig.active == false) then
keyconfig:to_front();
oldinput = themename_input;
themename_input = function(iotbl)
-- returns true if done, false if more input is needed
if (keyconfig:input(iotbl) == true) then
-- here would be a good place to run other translations needed (e.g. keyconf_mame)
themename_input = oldinput;
end
end
end
The keyconf/ledconf/listview and similar support script all use the LUA pseudo-OO table approach. The construction function looks like:
::lua
function keyconf_create(menugroup, playergroup, keyname)
setting any of these arguments to nil reverts to the default input.
keyname sets the name of the lua script that will be used to load/save the keyconf as.
**Table methods **
| name | args | returns | description |
|---|---|---|---|
| new | Force a reconfigure of all labels | ||
| match | inputtbl | restary | Take an input table and return an array of all matching labels. |
| buildtbl | inputtbl, label, state | restbl | Build an input table based in a source table and a desired label. |
| reconfigure_players | Force a reconfiguure of the player- setup only. |
**Table members **
| symbol | kind | value |
|---|---|---|
| cooldown | num | number of ticks until a new input is accepted |
| keyfile | string | the keyfile in use |
| ignore_modifiers | boolean | should lookup etc. take shift/ctrl/alt/meta states into account. |
| n_players | num | the number of players set up |
| n_buttons | num | the number of buttons set up |
| n_axes | num | the number of analog axes set up |