Orxonox: OIS::LinuxKeyboard Class Reference

# OIS::LinuxKeyboard Class Reference

`#include <src/ois/linux/LinuxKeyboard.h>`

Inheritance diagram for OIS::LinuxKeyboard:

List of all members.

## Public Member Functions

virtual void | _initialize ()
virtual void | capture ()
virtual void | copyKeyStates (char keys[256]) const
virtual const std::string & | getAsString (KeyCode kc)
virtual bool | isKeyDown (KeyCode key) const
| LinuxKeyboard (InputManager *creator, bool buffered, bool grab, bool useXRepeat)
virtual Interface * | queryInterface (Interface::IType)
virtual void | setBuffered (bool buffered)
virtual | ~LinuxKeyboard ()

## Protected Types

typedef std::map< KeySym, KeyCode > | XtoOIS_KeyMap
| 1:1 Conversion Map between X Key Events and OIS KeyCodes

## Protected Member Functions

bool | _injectKeyDown (KeySym key, int text)
bool | _injectKeyUp (KeySym key)

## Protected Attributes

Display * | display
bool | grabKeyboard
char | KeyBuffer [256]
| Depressed Key List.
XtoOIS_KeyMap | keyConversion
bool | keyFocusLost
std::string | mGetString
bool | oldXAutoRepeat
Window | window
| X11 Stuff.
bool | xAutoRepeat

## Detailed Description

Linux implementation of Keyboard object - uses x11

## Member Typedef Documentation

typedef std::map<KeySym, KeyCode> OIS::LinuxKeyboard::XtoOIS_KeyMap`[protected]`

1:1 Conversion Map between X Key Events and OIS KeyCodes

## Constructor & Destructor Documentation

LinuxKeyboard::LinuxKeyboard | ( | InputManager * | creator,
|  | bool | buffered,
|  | bool | grab,
|  | bool | useXRepeat |
| ) |  |  |

References display, grabKeyboard, OIS::KC_0, OIS::KC_1, OIS::KC_2, OIS::KC_3, OIS::KC_4, OIS::KC_5, OIS::KC_6, OIS::KC_7, OIS::KC_8, OIS::KC_9, OIS::KC_A, OIS::KC_ADD, OIS::KC_APOSTROPHE, OIS::KC_APPS, OIS::KC_B, OIS::KC_BACK, OIS::KC_BACKSLASH, OIS::KC_C, OIS::KC_CAPITAL, OIS::KC_COLON, OIS::KC_COMMA, OIS::KC_D, OIS::KC_DECIMAL, OIS::KC_DELETE, OIS::KC_DIVIDE, OIS::KC_DOWN, OIS::KC_E, OIS::KC_END, OIS::KC_EQUALS, OIS::KC_ESCAPE, OIS::KC_F, OIS::KC_F1, OIS::KC_F10, OIS::KC_F11, OIS::KC_F12, OIS::KC_F13, OIS::KC_F14, OIS::KC_F15, OIS::KC_F2, OIS::KC_F3, OIS::KC_F4, OIS::KC_F5, OIS::KC_F6, OIS::KC_F7, OIS::KC_F8, OIS::KC_F9, OIS::KC_G, OIS::KC_GRAVE, OIS::KC_H, OIS::KC_HOME, OIS::KC_I, OIS::KC_INSERT, OIS::KC_J, OIS::KC_K, OIS::KC_L, OIS::KC_LBRACKET, OIS::KC_LCONTROL, OIS::KC_LEFT, OIS::KC_LMENU, OIS::KC_LSHIFT, OIS::KC_LWIN, OIS::KC_M, OIS::KC_MINUS, OIS::KC_MULTIPLY, OIS::KC_N, OIS::KC_NUMLOCK, OIS::KC_NUMPAD0, OIS::KC_NUMPAD1, OIS::KC_NUMPAD2, OIS::KC_NUMPAD3, OIS::KC_NUMPAD4, OIS::KC_NUMPAD5, OIS::KC_NUMPAD6, OIS::KC_NUMPAD7, OIS::KC_NUMPAD8, OIS::KC_NUMPAD9, OIS::KC_NUMPADENTER, OIS::KC_NUMPADEQUALS, OIS::KC_O, OIS::KC_P, OIS::KC_PAUSE, OIS::KC_PERIOD, OIS::KC_PGDOWN, OIS::KC_PGUP, OIS::KC_Q, OIS::KC_R, OIS::KC_RBRACKET, OIS::KC_RCONTROL, OIS::KC_RETURN, OIS::KC_RIGHT, OIS::KC_RMENU, OIS::KC_RSHIFT, OIS::KC_RWIN, OIS::KC_S, OIS::KC_SCROLL, OIS::KC_SEMICOLON, OIS::KC_SLASH, OIS::KC_SPACE, OIS::KC_SUBTRACT, OIS::KC_SYSRQ, OIS::KC_T, OIS::KC_TAB, OIS::KC_U, OIS::KC_UP, OIS::KC_V, OIS::KC_W, OIS::KC_X, OIS::KC_Y, OIS::KC_Z, keyConversion, keyFocusLost, OIS::Object::mCreator, oldXAutoRepeat, window, and xAutoRepeat.

LinuxKeyboard::~LinuxKeyboard | ( |  | ) | `[virtual]`

References display, grabKeyboard, OIS::Object::mCreator, and oldXAutoRepeat.

## Member Function Documentation

void LinuxKeyboard::_initialize | ( |  | ) | `[virtual]`

Remarks:
  Internal... Do not call this directly.

Implements OIS::Object.

References display, OIS::E_General, grabKeyboard, KeyBuffer, keyFocusLost, OIS::Object::mCreator, OIS::Keyboard::mModifiers, OIS_EXCEPT, oldXAutoRepeat, window, and xAutoRepeat.

bool LinuxKeyboard::_injectKeyDown | ( | KeySym | key,
|  | int | text |
| ) |  |  | `[protected]`

References OIS::Keyboard::Alt, OIS::Keyboard::Ctrl, OIS::KC_LCONTROL, OIS::KC_LMENU, OIS::KC_LSHIFT, OIS::KC_RCONTROL, OIS::KC_RMENU, OIS::KC_RSHIFT, KeyBuffer, keyConversion, OIS::KeyListener::keyPressed(), OIS::Object::mBuffered, OIS::Keyboard::mListener, OIS::Keyboard::mModifiers, and OIS::Keyboard::Shift.

Referenced by capture().

bool LinuxKeyboard::_injectKeyUp | ( | KeySym | key | ) | `[protected]`

References OIS::Keyboard::Alt, OIS::Keyboard::Ctrl, OIS::KC_LCONTROL, OIS::KC_LMENU, OIS::KC_LSHIFT, OIS::KC_RCONTROL, OIS::KC_RMENU, OIS::KC_RSHIFT, KeyBuffer, keyConversion, OIS::KeyListener::keyReleased(), OIS::Object::mBuffered, OIS::Keyboard::mListener, OIS::Keyboard::mModifiers, and OIS::Keyboard::Shift.

Referenced by capture().

void LinuxKeyboard::capture | ( |  | ) | `[virtual]`

Remarks:
  Used for updating call once per frame before checking state or to update events

Implements OIS::Object.

References OIS::LinuxInputManager::_getGrabState(), _injectKeyDown(), _injectKeyUp(), OIS::LinuxInputManager::_setGrabState(), OIS::Keyboard::Ascii, display, grabKeyboard, keyFocusLost, OIS::Object::mCreator, OIS::Keyboard::mTextMode, OIS::Keyboard::Off, OIS::Keyboard::Unicode, UTF8ToUTF32(), and window.

void LinuxKeyboard::copyKeyStates | ( | char | keys[256] | ) | const`[virtual]`

Remarks:
  Copies the state of the keys into the sent buffer (in the form of 1 is down and 0 is up)

Implements OIS::Keyboard.

References KeyBuffer.

const std::string & LinuxKeyboard::getAsString | ( | KeyCode | kc | ) | `[virtual]`

Remarks:
  Translates KeyCode to string representation. For example, KC_ENTER will be "Enter" - Locale specific of course.

Parameters:

  | kc | KeyCode to convert

Returns:
  The string as determined from the current locale

Implements OIS::Keyboard.

References keyConversion, and mGetString.

bool LinuxKeyboard::isKeyDown | ( | KeyCode | key | ) | const`[virtual]`

Remarks:
  Returns true if key is donwn

Parameters:

  | key | A KeyCode to check

Implements OIS::Keyboard.

References KeyBuffer.

virtual Interface* OIS::LinuxKeyboard::queryInterface | ( | Interface::IType |  | ) | `[inline, virtual]`

Remarks:
  If available, get an interface to write to some devices. Examples include, turning on and off LEDs, ForceFeedback, etc

Parameters:

  | type | The type of interface you are looking for

Implements OIS::Object.

void LinuxKeyboard::setBuffered | ( | bool | buffered | ) | `[virtual]`

Remarks:
  Sets buffered mode

Implements OIS::Object.

References OIS::Object::mBuffered.

## Member Data Documentation

Display* OIS::LinuxKeyboard::display`[protected]`

Referenced by _initialize(), capture(), LinuxKeyboard(), and ~LinuxKeyboard().

bool OIS::LinuxKeyboard::grabKeyboard`[protected]`

Referenced by _initialize(), capture(), LinuxKeyboard(), and ~LinuxKeyboard().

char OIS::LinuxKeyboard::KeyBuffer[256]`[protected]`

Depressed Key List.

Referenced by _initialize(), _injectKeyDown(), _injectKeyUp(), copyKeyStates(), and isKeyDown().

XtoOIS_KeyMap OIS::LinuxKeyboard::keyConversion`[protected]`

Referenced by _injectKeyDown(), _injectKeyUp(), getAsString(), and LinuxKeyboard().

bool OIS::LinuxKeyboard::keyFocusLost`[protected]`

Referenced by _initialize(), capture(), and LinuxKeyboard().

std::string OIS::LinuxKeyboard::mGetString`[protected]`

Referenced by getAsString().

bool OIS::LinuxKeyboard::oldXAutoRepeat`[protected]`

Referenced by _initialize(), LinuxKeyboard(), and ~LinuxKeyboard().

Window OIS::LinuxKeyboard::window`[protected]`

X11 Stuff.

Referenced by _initialize(), capture(), and LinuxKeyboard().

bool OIS::LinuxKeyboard::xAutoRepeat`[protected]`

Referenced by _initialize(), and LinuxKeyboard().

The documentation for this class was generated from the following files:

- src/ois/linux/LinuxKeyboard.h
- src/ois/linux/LinuxKeyboard.cpp