This guide will describe how inputs from the user (keyboard, mouse, etc.) are routed through InputWritr and how the DeviceLayr Gamepad can be used on top of it.
# InputWritr
## Events and Triggers
InputWritr is a module that automates interactions with user inputs and events.
Inputs are stored as both character codes (e.g. 37) and as a string representation of themselves (e.g. "left").
Triggers are what tie inputs with events and are specific actions on the inputs (e.g. press).
Events can be added using `addEvent` which takes in a trigger name, key code, and the function to run when the event is triggered.
Aliases are additional inputs that allow for an event to be triggered from multiple user sources.
They can be added and removed using `addAliasValues` and `removeAliasValues` which both take in the input and an array of key character codes as arguments.
More can be read about InputWritr on its [Readme](https://github.com/FullScreenShenanigans/InputWritr/blob/master/README.md).
# DeviceLayr
DeviceLayr is a module for GamePad API bindings which allow for the use of devices like controllers.
DeviceLayr has its own input and trigger mappings in addition to the mappings for InputWritr.
Connected devices are detected and registered with `checkNavigatorGamepads` which automatically adds them to the list of added gamepads once called and returns the number
The inputs for gamepads are joysticks, buttons, and controller triggers.
Joysticks have an x and y axis, which have a negative, netural, and positive status.
These statuses signal which direction the joystick is being tilted.
Aliases for gamepad triggers are binary signals for whether an active change was made to the status of the gamepad (e.g. pressing a button versus releasing).
`activateAllGamepadTriggers` checks the status of all registered gamepads and calls the equivalent InputWritr event if any triggers have occurred.