Changeset 6004 for code/branches/console/src/orxonox/overlays
- Timestamp:
- Oct 30, 2009, 12:39:51 PM (15 years ago)
- Location:
- code/branches/console/src/orxonox/overlays
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/orxonox/overlays/InGameConsole.cc
r5992 r6004 68 68 */ 69 69 InGameConsole::InGameConsole() 70 : shell_( Shell::getInstance())70 : shell_(new Shell("InGameConsole", true)) 71 71 , consoleOverlay_(0) 72 72 , consoleOverlayContainer_(0) … … 100 100 // destroy the input state previously created (InputBuffer gets destroyed by the Shell) 101 101 InputManager::getInstance().destroyState("console"); 102 103 // destroy the underlaying shell 104 this->shell_->destroy(); 102 105 103 106 Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr(); … … 175 178 // create the corresponding input state 176 179 inputState_ = InputManager::getInstance().createInputState("console", false, false, InputStatePriority::Console); 177 inputState_->setKeyHandler(this->shell_ .getInputBuffer());180 inputState_->setKeyHandler(this->shell_->getInputBuffer()); 178 181 bHidesAllInputChanged(); 179 182 … … 253 256 this->consoleOverlayContainer_->setTop(-1.2 * this->relativeHeight); 254 257 255 this->shell_ .addOutputLevel(true);258 this->shell_->addOutputLevel(true); 256 259 257 260 COUT(4) << "Info: InGameConsole initialized" << std::endl; … … 267 270 void InGameConsole::linesChanged() 268 271 { 269 std::list<std::string>::const_iterator it = this->shell_ .getNewestLineIterator();272 std::list<std::string>::const_iterator it = this->shell_->getNewestLineIterator(); 270 273 int max = 0; 271 274 for (int i = 1; i < LINES; ++i) 272 275 { 273 if (it != this->shell_ .getEndIterator())276 if (it != this->shell_->getEndIterator()) 274 277 { 275 278 ++it; … … 296 299 { 297 300 if (LINES > 1) 298 this->print(*this->shell_ .getNewestLineIterator(), 1);301 this->print(*this->shell_->getNewestLineIterator(), 1); 299 302 } 300 303 … … 315 318 { 316 319 if (LINES > 0) 317 this->print(this->shell_ .getInput(), 0);318 319 if (this->shell_ .getInput() == "" || this->shell_.getInput().size() == 0)320 this->print(this->shell_->getInput(), 0); 321 322 if (this->shell_->getInput() == "" || this->shell_->getInput().size() == 0) 320 323 this->inputWindowStart_ = 0; 321 324 } … … 326 329 void InGameConsole::cursorChanged() 327 330 { 328 unsigned int pos = this->shell_ .getCursorPosition() - inputWindowStart_;331 unsigned int pos = this->shell_->getCursorPosition() - inputWindowStart_; 329 332 if (pos > maxCharsPerLine_) 330 333 pos = maxCharsPerLine_; … … 483 486 if (output.size() > this->maxCharsPerLine_) 484 487 { 485 if (this->shell_ .getInputBuffer()->getCursorPosition() < this->inputWindowStart_)486 this->inputWindowStart_ = this->shell_ .getInputBuffer()->getCursorPosition();487 else if (this->shell_ .getInputBuffer()->getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1))488 this->inputWindowStart_ = this->shell_ .getInputBuffer()->getCursorPosition() - this->maxCharsPerLine_ + 1;488 if (this->shell_->getInputBuffer()->getCursorPosition() < this->inputWindowStart_) 489 this->inputWindowStart_ = this->shell_->getInputBuffer()->getCursorPosition(); 490 else if (this->shell_->getInputBuffer()->getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1)) 491 this->inputWindowStart_ = this->shell_->getInputBuffer()->getCursorPosition() - this->maxCharsPerLine_ + 1; 489 492 490 493 output = output.substr(this->inputWindowStart_, this->maxCharsPerLine_); … … 507 510 this->bActive_ = true; 508 511 InputManager::getInstance().enterState("console"); 509 this->shell_ .registerListener(this);512 this->shell_->registerListener(this); 510 513 511 514 this->windowResized(this->windowW_, this->windowH_); … … 529 532 this->bActive_ = false; 530 533 InputManager::getInstance().leaveState("console"); 531 this->shell_ .unregisterListener(this);534 this->shell_->unregisterListener(this); 532 535 533 536 // scroll up -
code/branches/console/src/orxonox/overlays/InGameConsole.h
r5969 r6004 81 81 82 82 private: // variables 83 Shell &shell_;83 Shell* shell_; 84 84 bool bActive_; 85 85 int windowW_;
Note: See TracChangeset
for help on using the changeset viewer.