Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 16, 2008, 6:03:46 PM (17 years ago)
Author:
landauf
Message:

changed InputBuffer, added OutputBuffer and made a first sketch of Shell.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/core/InputBuffer.cc

    r1269 r1312  
    3838    InputBuffer::InputBuffer()
    3939    {
    40         //this->bActivated_ = false;
    41         this->allowedChars_ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜ0123456789 \\\"(){}[]<>.:,;_-+*/=!?|$&%^~#";
     40        this->allowedChars_ = "abcdefghijklmnopqrstuvwxyz \
     41                               ABCDEFGHIJKLMNOPQRSTUVWXYZ \
     42                               äëïöüÄËÏÖÜáâàéêèíîìóôòúûù \
     43                               0123456789 \
     44                               \\\"(){}[]<>.:,;_-+*/=!?|$&%^~#";
    4245        this->keyboard_ = InputManager::getSingleton().getKeyboard();
    4346        this->buffer_ = "";
    44 
    45         //this->keyboard_->setEventCallback(this);
    4647    }
    4748
    4849    InputBuffer::InputBuffer(const std::string allowedChars)
    4950    {
    50         //this->bActivated_ = false;
    5151        this->allowedChars_ = allowedChars;
    5252        this->keyboard_ = InputManager::getSingleton().getKeyboard();
    5353        this->buffer_ = "";
    5454    }
    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     }
    6155
    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 */
    6856    void InputBuffer::set(const std::string& input)
    6957    {
     
    117105        for (std::list<InputBufferListenerTuple>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    118106        {
    119             if (((*it).bListenToAllChanges_ || ((*it).char_ == update)) && (!(*it).bOnlySingleInput_ || bSingleInput))
     107            if ((!(*it).trueKeyFalseChar_) && ((*it).bListenToAllChanges_ || ((*it).char_ == update)) && (!(*it).bOnlySingleInput_ || bSingleInput))
    120108                (*(*it).listener_.*(*it).function_)();
    121109        }
    122110    }
    123 
    124     /*void InputBuffer::activityChanged() const
    125     {
    126     }*/
    127111
    128112    bool InputBuffer::charIsAllowed(const char& input)
     
    136120    bool InputBuffer::keyPressed(const OIS::KeyEvent &e)
    137121    {
    138         /*if (e.key == OIS::KC_NUMPADENTER)
     122        for (std::list<InputBufferListenerTuple>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    139123        {
    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        }
    144127
    145128        if (this->keyboard_->isModifierDown(OIS::Keyboard::Ctrl))
     
    177160        }
    178161
    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 
    185162        this->append((char)e.text);
    186163        return true;
Note: See TracChangeset for help on using the changeset viewer.