OIS::Keyboard Class Reference

#include <src/ois/OISKeyboard.h>

Inheritance diagram for OIS::Keyboard:

OIS::Object OIS::LinuxKeyboard OIS::MacKeyboard OIS::Win32Keyboard

List of all members.

Public Types

enum  Modifier { Shift = 0x0000001, Ctrl = 0x0000010, Alt = 0x0000100 }
 Enum of bit position of modifer. More...
enum  TextTranslationMode { Off, Unicode, Ascii }
 TextTranslation Mode. More...

Public Member Functions

virtual void copyKeyStates (char keys[256]) const =0
virtual const std::stringgetAsString (KeyCode kc)=0
KeyListenergetEventCallback () const
TextTranslationMode getTextTranslation () const
virtual bool isKeyDown (KeyCode key) const =0
bool isModifierDown (Modifier mod) const
virtual void setEventCallback (KeyListener *keyListener)
virtual void setTextTranslation (TextTranslationMode mode)
virtual ~Keyboard ()

Protected Member Functions

 Keyboard (const std::string &vendor, bool buffered, int devID, InputManager *creator)

Protected Attributes

KeyListenermListener
 Used for buffered/actionmapping callback.
unsigned int mModifiers
 Bit field that holds status of Alt, Ctrl, Shift.
TextTranslationMode mTextMode
 The current translation mode.


Detailed Description

Keyboard base class. To be implemented by specific system (ie. DirectX Keyboard) This class is useful as you remain OS independent using this common interface.

Member Enumeration Documentation

Enum of bit position of modifer.

Enumerator:
Shift 
Ctrl 
Alt 

TextTranslation Mode.

Enumerator:
Off 
Unicode 
Ascii 


Constructor & Destructor Documentation

virtual OIS::Keyboard::~Keyboard (  )  [inline, virtual]

OIS::Keyboard::Keyboard ( const std::string vendor,
bool  buffered,
int  devID,
InputManager creator 
) [inline, protected]


Member Function Documentation

virtual void OIS::Keyboard::copyKeyStates ( char  keys[256]  )  const [pure virtual]

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

Implemented in OIS::LinuxKeyboard, OIS::MacKeyboard, and OIS::Win32Keyboard.

virtual const std::string& OIS::Keyboard::getAsString ( KeyCode  kc  )  [pure 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

Implemented in OIS::LinuxKeyboard, OIS::MacKeyboard, and OIS::Win32Keyboard.

KeyListener* OIS::Keyboard::getEventCallback (  )  const [inline]

Remarks:
Returns currently set callback.. or 0

TextTranslationMode OIS::Keyboard::getTextTranslation (  )  const [inline]

Remarks:
Returns current translation mode

virtual bool OIS::Keyboard::isKeyDown ( KeyCode  key  )  const [pure virtual]

Remarks:
Returns true if key is donwn
Parameters:
key A KeyCode to check

Implemented in OIS::LinuxKeyboard, OIS::MacKeyboard, and OIS::Win32Keyboard.

bool Keyboard::isModifierDown ( Modifier  mod  )  const

Remarks:
Check modifier status

References mModifiers.

virtual void OIS::Keyboard::setEventCallback ( KeyListener keyListener  )  [inline, virtual]

Remarks:
Register/unregister a Keyboard Listener - Only one allowed for simplicity. If broadcasting is neccessary, just broadcast from the callback you registered.
Parameters:
keyListener Send a pointer to a class derived from KeyListener or 0 to clear the callback

Referenced by orxonox::InputManager::_initialiseKeyboard().

void Keyboard::setTextTranslation ( TextTranslationMode  mode  )  [virtual]

Remarks:
Enable extra processing to translate KC_*** to an actual text character based off of locale. Different managers may implement none or all. Check the translation mode after setting to be sure
Parameters:
mode Off, Unicode, Ascii

References mTextMode.


Member Data Documentation

unsigned int OIS::Keyboard::mModifiers [protected]


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

Generated on Tue Jul 28 16:22:17 2009 for Orxonox by  doxygen 1.5.6