A Joystick controller which reads key states from a joystick device. More...
#include <controller_joystick.h>
Public Member Functions | |
| JoystickController () | |
| Constructor. | |
| ~JoystickController () | |
| Destructir. | |
| void | setJoystickDevice (SDL_Joystick *jctrl) |
| Sets joystick device descriptor which will be used by this controller. More... | |
| SDL_Joystick * | getJoystickDevice () const |
| Returns current joystick device descriptor. More... | |
| void | updateKey (bool &key, KM_Key &mkey) |
| Takes a state of specified joystick key. More... | |
| void | update () |
| Read states of all control keys of a joystick device. | |
Public Member Functions inherited from Controller | |
| Controller () | |
| Constructor. | |
| virtual | ~Controller () |
| Desctructor. | |
| virtual void | setKeyMap (KeyMap map) |
| Accepts control keys map which will associates physical keys of control device and command code. More... | |
| void | resetControls () |
| Sends "unpressed" control key states map to every registered controllable object. | |
| void | sendControls () |
| Sends current control key states map to every registered controllable object. | |
| void | registerInControl (ControllableObject *obj) |
| Register controllable object to this controller. More... | |
| void | removeFromControl (ControllableObject *obj) |
| Remove controllable object from this controller. More... | |
Static Public Member Functions | |
| static bool | bindJoystickKey (SDL_Joystick *joy, KM_Key &k) |
| Detects a pressed key type and it's from a given joystick device and writes info into a given key description structure. More... | |
Static Public Member Functions inherited from Controller | |
| static controller_keys | noKeys () |
| Initializes a control key states map with unpressed key states. More... | |
Additional Inherited Members | |
Public Types inherited from Controller | |
| enum | commands { key_start =0, key_left, key_right, key_up, key_down, key_run, key_jump, key_altrun, key_altjump, key_drop } |
| Control key command codes. | |
Public Attributes inherited from Controller | |
| controller_keys | keys |
| Current state of control keys. | |
Protected Attributes inherited from Controller | |
| KeyMap | kmap |
| Current control keys map. | |
A Joystick controller which reads key states from a joystick device.
|
static |
Detects a pressed key type and it's from a given joystick device and writes info into a given key description structure.
| joy | Josytick device descriptor |
| k | Joystick key description |
| SDL_Joystick * JoystickController::getJoystickDevice | ( | ) | const |
Returns current joystick device descriptor.
| void JoystickController::setJoystickDevice | ( | SDL_Joystick * | jctrl | ) |
Sets joystick device descriptor which will be used by this controller.
| Joystick | device descriptor |
| void JoystickController::updateKey | ( | bool & | key, |
| KM_Key & | mkey | ||
| ) |
Takes a state of specified joystick key.
| key | Output key state which will be copied from actual joystick key state |
| mkey | Joystick key info |
1.8.7