Shibboleth Dev Log - 06
Today’s post we’ll go over the implementation of the InputManager
class!
Bindings and Bindings Config⌗
The bindings have a pretty simple JSON schema. The root object is an array. Each binding in the array takes this format:
Here’s a simple example using scale to bind WASD to movement and mouse look.
Input Mode⌗
The InputManager
has a simple “state machine”. It’s simple in the sense that it doesn’t have a data structure or anything that maintains edges and conditions. You just ask it to be in a state with a given name, and it will be in that state. The only data it maintains is the current state and the previous state. This enables you to toggle into a state, and retain where you were and toggle back when done.
The main use case for input modes is to selectively enable and disable certain bindings. An example of this is when you press F9 for the Debug Menu, it changes the input mode so the camera won’t move while trying to use the mouse to navigate the menus.
See You Next Time Space Cowboy⌗
The InputManager
is not a complicated manager. It provides basic functionality for creating input bindings and sampling and updating their values. Anything more than that should live in a higher layer.
See you next time!