quakeforge/libs/input
Bill Currie 62f592b92c [input] Create an automatic imt switcher
An imt switcher automatically changes the context's active imt based on
a user specified list of binary inputs. The inputs may be either buttons
(indicated as +button) or cvars (bare name). For buttons, the
pressed/not pressed state is used, and cvars are interpreted as ints
being 0 or not 0. The order of the inputs determines the bit number of
the input, with the first input being bit 0, second bit 1, third bit 2
etc. A default imt is given so large switchers do not need to be fully
configured (the default imt is written to all states).

A context can have any number of switchers attached. The switchers can
wind up fighting over the active imt, but this seems to be something for
the "user" (eg, configuration system) to sort out rather than the
switcher code enforcing anything.

As a result of the inputs being treated as bits, a switcher with N
inputs will have 2**N states, thus there's a maximum of 16 inputs for
now as 65536 states is a lot of configuration.

Using a switcher, setting up a standard strafe/mouse look configuration
is fairly easy.

    imt_create key_game imt_mod
    imt_create key_game imt_mod_strafe imt_mod
    imt_create key_game imt_mod_freelook
    imt_create key_game imt_mod_lookstrafe imt_mod_freelook
    imt_switcher_create mouse key_game imt_mod_strafe +strafe lookstrafe +mlook freelook
    imt_switcher 0 imt_mod 2 imt_mod 4 imt_mod_freelook 8 imt_mod_freelook 12 imt_mod_freelook
    imt_switcher 6 imt_mod_lookstrafe 10 imt_mod_lookstrafe 14 imt_mod_lookstrafe
    in_bind imt_mod mouse axis 0 move.yaw
    in_bind imt_mod mouse axis 1 move.forward
    in_bind imt_mod_strafe mouse axis 0 move.side
    in_bind imt_mod_lookstrafe mouse axis 0 move.side
    in_bind imt_mod_freelook mouse axis 1 move.pitch

This takes advantage of imt chaining and the default imt for the
switcher (there are 8 states that use imt_mod_strafe).

The switcher name must be unique across all contexts, and every imt used
in a switcher must be in the switcher's context.
2021-11-25 20:23:18 +09:00
..
evdev [input] Free phys and uniq device strings 2021-09-27 19:53:16 +09:00
in_axis.c [input] Add axis listeners 2021-11-25 20:04:08 +09:00
in_binding.c [input] Remove some cruft 2021-11-25 13:36:02 +09:00
in_button.c [input] Add listeners to buttons 2021-11-25 20:04:08 +09:00
in_common.c [input] Allow drivers to initialize cvars early 2021-11-21 11:33:58 +09:00
in_evdev.c [input] Drop unfocused evdev axis/button events 2021-11-22 14:59:32 +09:00
in_event.c [input] Make event names easy to print 2021-11-22 14:59:32 +09:00
in_imt.c [input] Create an automatic imt switcher 2021-11-25 20:23:18 +09:00
keys.c [input] Make a start on the new binding system 2021-11-03 19:02:39 +09:00
Makemodule.am [client] Reimplement legacy bind and unbind commands 2021-11-25 13:36:02 +09:00