Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8027


Ignore:
Timestamp:
Mar 6, 2011, 1:16:56 AM (14 years ago)
Author:
landauf
Message:

added translator map to InputBuffer for numpad keys - now they can also be used to type text into the ingame console

Location:
code/branches/usability/src/libraries/core/input
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/src/libraries/core/input/InputBuffer.cc

    r6417 r8027  
    4747                               \\\"(){}[]<>.:,;_-+*/=!?|$&%^~#";
    4848
     49        this->keyTranslator_[KeyCode::Numpad0]      = '0';
     50        this->keyTranslator_[KeyCode::Numpad1]      = '1';
     51        this->keyTranslator_[KeyCode::Numpad2]      = '2';
     52        this->keyTranslator_[KeyCode::Numpad3]      = '3';
     53        this->keyTranslator_[KeyCode::Numpad4]      = '4';
     54        this->keyTranslator_[KeyCode::Numpad5]      = '5';
     55        this->keyTranslator_[KeyCode::Numpad6]      = '6';
     56        this->keyTranslator_[KeyCode::Numpad7]      = '7';
     57        this->keyTranslator_[KeyCode::Numpad8]      = '8';
     58        this->keyTranslator_[KeyCode::Numpad9]      = '9';
     59        this->keyTranslator_[KeyCode::NumpadPeriod] = '.';
     60        this->keyTranslator_[KeyCode::Divide]       = '/';
     61        this->keyTranslator_[KeyCode::NumpadEnter]  = '\n';
     62
    4963        this->lastKey_ = KeyCode::Unassigned;
    5064        this->timeSinceKeyPressed_ = 0.0f;
     
    228242        }
    229243
    230         this->insert(static_cast<char>(evt.getText()));
     244        std::map<KeyCode::ByEnum, char>::iterator it = this->keyTranslator_.find(evt.getKeyCode());
     245        if (it != this->keyTranslator_.end())
     246            this->insert(it->second);
     247        else
     248            this->insert(static_cast<char>(evt.getText()));
    231249    }
    232250
  • code/branches/usability/src/libraries/core/input/InputBuffer.h

    r6417 r8027  
    178178            std::list<BaseInputBufferListenerTuple*> listeners_;
    179179            std::string allowedChars_;
     180            std::map<KeyCode::ByEnum, char> keyTranslator_;
    180181            unsigned int maxLength_;
    181182            unsigned int cursor_;
Note: See TracChangeset for help on using the changeset viewer.