On the left, starting with .map is the key definition (mouse0:btn2.pressed). On the right you find the events (dolly).
The definition of a key consists of a device ID, channel ID and channel modifier (not on axes):
dev:channel[.up|down|pressed|long|double]
There are two types of events for mapping:
A list of the accepted devices can be found under '/sys/share/input/devs', the list of the channels (keys/buttons)provided
by the device can be found in the 'channels' subdirectory of each device. The list of the actual states
is under '/sys/share/input/states'. The following table is an extract of devices and channels (keys/buttons)
Device key | Description |
keyb0:bs | Backspace key on the standard keyboard |
keyb0:tab | Tabulator key on the standard keyboard |
keyb0:return | Return key on the standard keyboard |
keyb0:shift | Shift key on the standard keyboard |
keyb0:ctrl | Right or left control key on the standard keyboard |
keyb0:menu | ??? key on the standard keyboard |
keyb0:capital | Caps lock key on the standard keyboard |
keyb0:esc | Escape key on the standard keyboard |
keyb0:space | Spacebar on the standard keyboard |
keyb0:prior | ??? key on the standard keyboard |
keyb0:next | ??? key on the standard keyboard |
keyb0:end | End key on the standard keyboard |
keyb0:home | Home key on the standard keyboard |
keyb0:left | Left arrow key on the standard keyboard |
keyb0:right | Right arrow key on the standard keyboard |
keyb0:up | Up arrow key on the standard keyboard |
keyb0:down | Down arrow key on the standard keyboard |
keyb0:select | ??? key on the standard keyboard |
keyb0:print | Print key on the standard keyboard |
keyb0:exec | ??? key on the standard keyboard |
keyb0:snap | ??? key on the standard keyboard |
keyb0:insert | Ins key on the standard keyboard |
keyb0:delete | Del key on the standard keyboard |
keyb0:help | ??? key on the standard keyboard |
keyb0:[1-0, a-z] | The corresponding keys on the standard keyboard |
keyb0:lwin | Left windows key on the standard windows keyboard |
keyb0:rwin | Right windows key on the standard windows keyboard |
keyb0:num[0-9] | 0-9 keys on the standard keyboard num pad |
keyb0:mult | Multiply key on the standard keyboard num pad |
keyb0:plus | Plus key on the standard keyboard num pad |
keyb0:divide | Divide key on the standard keyboard num pad |
keyb0:minus | Minus key on the standard keyboard num pad |
keyb0:sep | ??? key on the standard keyboard |
keyb0:decimal | ??? key on the standard keyboard |
keyb0:f[1-24] | Corresponding F keys on the standard keyboard (like F1, F2..) |
keyb0:numloc | Number lock key on the standard keyboard |
keyb0:scroll | Scroll lock key on the standard keyboard |
joy0:btn[0-x] | Button 0 to X on your Joystick, depends on how many button your joystick has. |
joy0:[+|-][x|y] | Axis move on your Joystick. Use getslider if you want to know how far it is pushed. (.getslider "joy0:-x") |
joy0:btn[0-x] | Button 0 to X, depends on how many button your joystick has. |
mouse0:[+|-][x|y] | Axis move on your mouse. Same as on Joysticks above |
mouse0:btn[0-x] | Button 0 to X, same as on Joysticks above |
So how do you query keys ? Either by mapping an event to the key combination, or by doing the query by yourself in script or code. The
interface is the same. You use the two functions getslider getbutton which get the name of the key/state passed. The first one
would be used for sliders (for example on joysticks how far they are pushed..) whereas the second just returns true or false.
The last thing you might be interrested in is key recording. This is an important feature for demos or replays. The last one is quite often found in racing games, where the moves of the cars are replayed to show the race after the finish. You could also create cutscenes with key recording. You use the logging functions to write the keys to the screen (standard out). The recording functions are used for key recording.
A key recording demo showing key mapping, querying logging and recording.