OIS::Keyboard Class Reference

#include <OISKeyboard.h>

Inheritance diagram for OIS::Keyboard:

OIS::Object List of all members.

Public Types

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

Public Member Functions

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

Protected Member Functions

 Keyboard ()

Protected Attributes

unsigned int mModifiers
 Bit field that holds status of Alt, Ctrl, Shift.
KeyListenerlistener
 Used for buffered/actionmapping callback.
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 OIS::Keyboard::TextTranslationMode

TextTranslation Mode.

Enumerator:
Off 
Unicode 
Ascii 

enum OIS::Keyboard::Modifier

Enum of bit position of modifer.

Enumerator:
Shift 
Ctrl 
Alt 


Constructor & Destructor Documentation

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

OIS::Keyboard::Keyboard (  )  [protected]


Member Function Documentation

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

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

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

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

Remarks:
Returns currently set callback.. or 0

virtual void OIS::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

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

Remarks:
Returns current translation mode

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

bool OIS::Keyboard::isModifierDown ( Modifier  mod  ) 

Remarks:
Check modifier status

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

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


Member Data Documentation

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

Bit field that holds status of Alt, Ctrl, Shift.

KeyListener* OIS::Keyboard::listener [protected]

Used for buffered/actionmapping callback.

TextTranslationMode OIS::Keyboard::mTextMode [protected]

The current translation mode.


The documentation for this class was generated from the following file:
Generated on Fri Jul 13 21:21:05 2007 for OIS by  doxygen 1.5.2