Version 8 (modified by rgrieder, 16 years ago) (diff) |
---|
Input Management
This page describes how various user input (keyboard, mouse or joy stick) is being processed. Our goal was to develop a generic implementation that allows to use the input in many different and independent ways. As an example it should not matter to a program whether a mouse button or a key has been pressed.
In order to capture input in the first place, we decided not to reinvent the wheel and use a cross platform library instead: OIS. It provides all the features we need to steear a 3D game.
Classes involved
Name | Description |
InputHandler | Actual input processor base classes |
InputManager | Input preprocessing and distribution to states |
InputState | Redistribution to InputHandlers |
KeyBinder | Maps keys to commands |
OIS? | Object Oriented input library |
InputBuffer | Stores text input stream like |
Capturing and distributing the input
We get input events from the OIS library in the form a function callback realised with inheritance. The class (and object at the same time) responsible for this task is the InputManager. It initialises the OIS components and input devices and takes care of the so called InputStates. These again, act like input managers themselves in a way, just a lot smaller in implementation.
The general idea behind this concept is the fact that input distribution is heavily dependent on what is currently running. Simple examples are the console (only captures text), a GUI menu or the orxonox level itself.
These InputStates can then hold Handlers that are thought to be fixed when everything is set up. These Handlers do the actual job. For instance the KeyBinder gets an input event and then maps it to an executable command in the form of a string. That command is then passed to the CommandExecutor.
So much about the overall concept. Read more in the corresponding sections, mostly classes though.
Attachments (1)
- Distribution.png (28.1 KB) - added by rgrieder 16 years ago.
Download all attachments as: .zip