gamepad
The community/plugin/gamepad
directory contains code that enables the use of a gamepad to control a computer, and a visual tester for debugging the gamepad integration.
The core functionality is in gamepad.py
and gamepad.talon
. The python file defines actions for each gamepad input, such as gamepad_press_dpad_left
and gamepad_stick_left
. It also defines helper functions such as gamepad_scroll
and gamepad_mouse_move
. The talon file maps gamepad events to the actions defined in the python file. For example, it maps the gamepad dpad_left:down
event to the user.gamepad_button_down("dpad_left")
action, which then calls actions.user.gamepad_press_dpad_left()
.
The README.md
provides a basic overview of the plugin. It includes a link to a demo video of the plugin in use and instructions for how to use the included gamepad tester.
The gamepad_settings.talon
file contains a commented out tag user.gamepad
. Uncommenting this tag will enable the gamepad functionality defined in gamepad.talon
.
The gamepad tester functionality is defined in gamepad_tester.py
, gamepad_tester_open.talon
, and gamepad_tester.talon
. The python file defines an on-screen GUI that renders the current state of the gamepad buttons, triggers, and sticks. The gamepad_tester.talon
file has a single command, "gamepad tester"
, which toggles the gamepad tester UI using the user.gamepad_tester_toggle
action defined in the python file. The gamepad_tester_open.talon
file maps gamepad events to actions that update the state of the gamepad tester UI. For example, the gamepad(dpad_up:down)
event triggers the user.gamepad_tester_button("dpad_up", true)
action, which updates the on-screen representation of the D-pad up button to indicate that it is pressed.