Keyboard Class Reference

#include <Keyboard.h>

List of all members.

Public Member Functions

bool loadKeyFile (bool loadDefaults=false)
bool saveKeyFile ()
bool init ()
char * getkeyboardbuffer (unsigned int &bufCnt)
unsigned int getKeyboardState ()
KeyboardHistory::HistoryElementgetkeyboardhistory (unsigned int &histCnt)
void processKeyboardEvent (SDL_Event &event)
KeyboardKeygetKey (const char *name)
std::list
< std::string > & 
getKeyList ()
std::list
< KeyboardKey * > & 
getCommandKeys ()
std::map
< std::string,
KeyboardKey * > & 
getKeyMap ()

Static Public Member Functions

static Keyboardinstance ()
static bool & getDvorak ()

Protected Member Functions

void clear ()
bool loadKeyFile (const std::string &fileName, bool masterFile)
void handleUnicodeUTF16 (Uint16 utf16, SDLKey key)
void raiseUnicodeUTF16 (Uint16 utf16, SDLKey key)

Protected Attributes

KeyboardHistory::HistoryElement keybHist_ [MAX_KEYBDHIST]
int keybHistCnt_
Uint16 mHighSurrogate
std::map
< std::string,
KeyboardKey * > 
keyMap_
std::list
< KeyboardKey * > 
commandKeys_
std::list< std::stringkeyList_

Static Protected Attributes

static Keyboardinstance_ = 0
static bool dvorak_ = false

Private Member Functions

 Keyboard ()
virtual ~Keyboard ()


Detailed Description

Definition at line 33 of file Keyboard.h.


Constructor & Destructor Documentation

Keyboard::Keyboard (  )  [private]

Definition at line 39 of file Keyboard.cpp.

Keyboard::~Keyboard (  )  [private, virtual]

Definition at line 44 of file Keyboard.cpp.


Member Function Documentation

Keyboard * Keyboard::instance (  )  [static]

Definition at line 29 of file Keyboard.cpp.

References instance_.

Referenced by ClientWindowSetup::addStateWindows(), ClientMain::clientEventLoop(), createKeysControls(), GLWChannelText::initFromXML(), GLWChannelView::initFromXMLInternal(), initHardware(), ConsoleImpl::keyboardCheck(), GLWTracker::mouseDrag(), GLWDragger::mouseDrag(), DisplayFrame::onKeyButton(), DisplayFrame::onLoadDefaultKeysButton(), DisplayFrame::refreshKeysControls(), GameState::simulate(), MainCamera::simulate(), and DisplayFrame::TransferDataFromWindow().

bool Keyboard::loadKeyFile ( bool  loadDefaults = false  ) 

Definition at line 213 of file Keyboard.cpp.

References clear(), commandKeys_, S3D::dialogMessage(), S3D::fileExists(), S3D::formatStringBuffer(), S3D::getDataFile(), KeyboardKey::getKeys(), KeyboardKey::getName(), KeyboardKey::getNameIsCommand(), S3D::getSettingsFile(), KeyboardKey::KeyEntry::key, KeyboardKey::keyIndex(), keyMap_, KeyboardKey::removeKey(), KeyboardKey::KeyEntry::state, KeyboardKey::translateKeyNameValue(), and KeyboardKey::translateKeyStateValue().

Referenced by DisplayFrame::onLoadDefaultKeysButton().

bool Keyboard::saveKeyFile (  ) 

Definition at line 168 of file Keyboard.cpp.

References XMLNode::addChild(), XMLNode::addParameter(), S3D::formatStringBuffer(), KeyboardKey::getChanged(), KeyboardKey::getDescription(), KeyboardKey::getGroup(), getKey(), KeyboardKey::getKeys(), KeyboardKey::getName(), KeyboardKey::getNameIsCommand(), S3D::getSettingsFile(), KeyboardKey::getTitle(), KeyboardKey::KeyEntry::key, keyList_, KeyboardKey::KeyEntry::state, LangStringUtil::strcmp(), KeyboardKey::translateKeyNameValue(), KeyboardKey::translateKeyStateValue(), XMLNode::writeToFile(), and XMLNode::XMLParameterType.

Referenced by DisplayFrame::TransferDataFromWindow().

bool Keyboard::init (  ) 

Definition at line 49 of file Keyboard.cpp.

char * Keyboard::getkeyboardbuffer ( unsigned int &  bufCnt  ) 

Definition at line 65 of file Keyboard.cpp.

References NULL.

Referenced by GameState::simulate().

unsigned int Keyboard::getKeyboardState (  ) 

Definition at line 56 of file Keyboard.cpp.

Referenced by GLWTracker::mouseDrag(), GLWDragger::mouseDrag(), and GameState::simulate().

KeyboardHistory::HistoryElement * Keyboard::getkeyboardhistory ( unsigned int &  histCnt  ) 

Definition at line 71 of file Keyboard.cpp.

References keybHist_, and keybHistCnt_.

Referenced by GameState::simulate().

void Keyboard::processKeyboardEvent ( SDL_Event &  event  ) 

Definition at line 141 of file Keyboard.cpp.

References handleUnicodeUTF16().

Referenced by ClientMain::clientEventLoop().

bool & Keyboard::getDvorak (  )  [static]

Definition at line 149 of file Keyboard.cpp.

References dvorak_.

KeyboardKey * Keyboard::getKey ( const char *  name  ) 

Definition at line 413 of file Keyboard.cpp.

References S3D::dialogMessage(), S3D::formatStringBuffer(), and keyMap_.

Referenced by ClientWindowSetup::addStateWindows(), createKeysControls(), GLWChannelText::initFromXML(), GLWChannelView::initFromXMLInternal(), DisplayFrame::onKeyButton(), DisplayFrame::refreshKeysControls(), and saveKeyFile().

std::list<std::string>& Keyboard::getKeyList (  )  [inline]

Definition at line 50 of file Keyboard.h.

References keyList_.

Referenced by createKeysControls().

std::list<KeyboardKey *>& Keyboard::getCommandKeys (  )  [inline]

Definition at line 51 of file Keyboard.h.

References commandKeys_.

Referenced by ConsoleImpl::keyboardCheck().

std::map<std::string, KeyboardKey *>& Keyboard::getKeyMap (  )  [inline]

Definition at line 52 of file Keyboard.h.

References keyMap_.

void Keyboard::clear (  )  [protected]

Definition at line 154 of file Keyboard.cpp.

References commandKeys_, keyList_, and keyMap_.

Referenced by loadKeyFile().

bool Keyboard::loadKeyFile ( const std::string fileName,
bool  masterFile 
) [protected]

Definition at line 275 of file Keyboard.cpp.

References KeyboardKey::addKeys(), S3D::dialogMessage(), XMLNode::failChildren(), file, S3D::formatStringBuffer(), XMLNode::getChildren(), XMLNode::getContent(), XMLNode::getName(), XMLNode::getNamedChild(), XMLNode::getNamedParameter(), XMLFile::getParserError(), XMLFile::getRootNode(), keyList_, keyMap_, XMLFile::readFile(), KeyboardKey::setChanged(), and LangStringUtil::strcmp().

void Keyboard::handleUnicodeUTF16 ( Uint16  utf16,
SDLKey  key 
) [protected]

Definition at line 98 of file Keyboard.cpp.

References mHighSurrogate, raiseUnicodeUTF16(), UTF16_IS_HIGH_SURROGATE, UTF16_IS_LOW_SURROGATE, and UTF16_SURROGATE_PAIR_TO_UTF32.

Referenced by processKeyboardEvent().

void Keyboard::raiseUnicodeUTF16 ( Uint16  utf16,
SDLKey  key 
) [protected]

Definition at line 83 of file Keyboard.cpp.

References keybHist_, keybHistCnt_, and MAX_KEYBDHIST.

Referenced by handleUnicodeUTF16().


Member Data Documentation

Keyboard * Keyboard::instance_ = 0 [static, protected]

Definition at line 55 of file Keyboard.h.

Referenced by instance().

bool Keyboard::dvorak_ = false [static, protected]

Definition at line 56 of file Keyboard.h.

Referenced by getDvorak().

KeyboardHistory::HistoryElement Keyboard::keybHist_[MAX_KEYBDHIST] [protected]

Definition at line 57 of file Keyboard.h.

Referenced by getkeyboardhistory(), and raiseUnicodeUTF16().

int Keyboard::keybHistCnt_ [protected]

Definition at line 58 of file Keyboard.h.

Referenced by getkeyboardhistory(), and raiseUnicodeUTF16().

Uint16 Keyboard::mHighSurrogate [protected]

Definition at line 59 of file Keyboard.h.

Referenced by handleUnicodeUTF16().

std::map<std::string, KeyboardKey *> Keyboard::keyMap_ [protected]

Definition at line 66 of file Keyboard.h.

Referenced by clear(), getKey(), getKeyMap(), and loadKeyFile().

std::list<KeyboardKey *> Keyboard::commandKeys_ [protected]

Definition at line 67 of file Keyboard.h.

Referenced by clear(), getCommandKeys(), and loadKeyFile().

std::list<std::string> Keyboard::keyList_ [protected]

Definition at line 68 of file Keyboard.h.

Referenced by clear(), getKeyList(), loadKeyFile(), and saveKeyFile().


The documentation for this class was generated from the following files:
Generated on Mon Feb 16 15:15:03 2009 for Scorched3D by  doxygen 1.5.3