Changeset 1312 for code/branches/console/src/core/InputBuffer.cc
- Timestamp:
- May 16, 2008, 6:03:46 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/InputBuffer.cc
r1269 r1312 38 38 InputBuffer::InputBuffer() 39 39 { 40 //this->bActivated_ = false; 41 this->allowedChars_ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜ0123456789 \\\"(){}[]<>.:,;_-+*/=!?|$&%^~#"; 40 this->allowedChars_ = "abcdefghijklmnopqrstuvwxyz \ 41 ABCDEFGHIJKLMNOPQRSTUVWXYZ \ 42 äëïöüÄËÏÖÜáâàéêèíîìóôòúûù \ 43 0123456789 \ 44 \\\"(){}[]<>.:,;_-+*/=!?|$&%^~#"; 42 45 this->keyboard_ = InputManager::getSingleton().getKeyboard(); 43 46 this->buffer_ = ""; 44 45 //this->keyboard_->setEventCallback(this);46 47 } 47 48 48 49 InputBuffer::InputBuffer(const std::string allowedChars) 49 50 { 50 //this->bActivated_ = false;51 51 this->allowedChars_ = allowedChars; 52 52 this->keyboard_ = InputManager::getSingleton().getKeyboard(); 53 53 this->buffer_ = ""; 54 54 } 55 /*56 void InputBuffer::registerListener(InputBufferListener* listener, void (InputBufferListener::*function)(), bool bOnlySingleInput)57 {58 struct InputBufferListenerTuple newListener = {listener, function, true, bOnlySingleInput, ' '};59 this->listeners_.insert(this->listeners_.end(), newListener);60 }61 55 62 void InputBuffer::registerListener(InputBufferListener* listener, void (InputBufferListener::*function)(), char char_, bool bOnlySingleInput)63 {64 struct InputBufferListenerTuple newListener = {listener, function, false, bOnlySingleInput, char_};65 this->listeners_.insert(this->listeners_.end(), newListener);66 }67 */68 56 void InputBuffer::set(const std::string& input) 69 57 { … … 117 105 for (std::list<InputBufferListenerTuple>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it) 118 106 { 119 if (( (*it).bListenToAllChanges_ || ((*it).char_ == update)) && (!(*it).bOnlySingleInput_ || bSingleInput))107 if ((!(*it).trueKeyFalseChar_) && ((*it).bListenToAllChanges_ || ((*it).char_ == update)) && (!(*it).bOnlySingleInput_ || bSingleInput)) 120 108 (*(*it).listener_.*(*it).function_)(); 121 109 } 122 110 } 123 124 /*void InputBuffer::activityChanged() const125 {126 }*/127 111 128 112 bool InputBuffer::charIsAllowed(const char& input) … … 136 120 bool InputBuffer::keyPressed(const OIS::KeyEvent &e) 137 121 { 138 /*if (e.key == OIS::KC_NUMPADENTER)122 for (std::list<InputBufferListenerTuple>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it) 139 123 { 140 this->setActivated(!this->isActivated()); 141 this->clear(); 142 return true; 143 }*/ 124 if ((*it).trueKeyFalseChar_ && ((*it).key_ == e.key)) 125 (*(*it).listener_.*(*it).function_)(); 126 } 144 127 145 128 if (this->keyboard_->isModifierDown(OIS::Keyboard::Ctrl)) … … 177 160 } 178 161 179 //std::cout << this->keyboard_->getAsString(e.key) << " / " << (char)e.text << std::endl;180 181 std::string input = this->keyboard_->getAsString(e.key);182 /*if (input.size() >= 1)183 this->append(input[0]);*/184 185 162 this->append((char)e.text); 186 163 return true;
Note: See TracChangeset
for help on using the changeset viewer.