yake::input

NB: It's necessary to call an InputSystem instance's update() method in regular intervals. Devices, ActionMaps etc may have their own update() methods which are not automatically called. Take care!

Devices

InputDevice is the base class for all input devices.

The following devices are currently implemented: KeyboardDevice, MouseDevice, JoystickDevice. Each device supports specialized functionality to control their behaviour and/or access various information.

Devices are created by an instance of InputSystem. They have to be activated before they can be used.

Device Event Generators

A device dependant event generator generates common events for certain devices. For example, a KeyboardEventGenerator provides “key up” and “key down” events in the form of signals. A MouseEventGenerator on the other hand may provide signals for mouse cursor and mouse wheel movement as well as mouse button presses.

Device dependant event generators inherit from DeviceEventGenerator. Devices can be attached and detached from an event genreator at runtime. A generator has to be updated in regular intervals using its update() method.

The following device event generators have been implemented: KeyboardEventGenerator, MouseEventGenerator. The JoystickEventGenerator is WIP.

Action Ids, Conditions and Maps

Action Id

An ActionId uniquely identifies an action, for example, ACTIONID_FORWARD for moving an object… well, forward. Of course, while some of these ids are quite common, more often these kind of ids depend on the application.

Action Condition

An action condition is met when its bool operator() returns true.

Several commonly used input device dependent conditions are implemented in yake::input:

  • KeyboardActionCondition: Condition is met when a key is pressed or, optionally, is kept being pressed (“continous”).
  • MouseButtonActionCondition: Condition is met when a mouse button is pressed or, optionally, is kept being pressed (“continous”).

The ActionConditionFactory can be used for quickly creating various default conditions.

Action Map

An ActionMap maps action conditions to action ids. When a condition is met, the action id for that condition triggers an event. Clients can subscribe to these events. See yake::input::ActionMap in the API docs for more details.

 
component/yakeinput.txt · Last modified: 2008/02/21 21:54 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki