Changeset 5969 for code/branches/console/src/orxonox
- Timestamp:
- Oct 20, 2009, 6:47:40 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
r5929 r5969 68 68 */ 69 69 InGameConsole::InGameConsole() 70 : consoleOverlay_(0) 70 : shell_(Shell::getInstance()) 71 , consoleOverlay_(0) 71 72 , consoleOverlayContainer_(0) 72 73 , consoleOverlayNoise_(0) … … 174 175 // create the corresponding input state 175 176 inputState_ = InputManager::getInstance().createInputState("console", false, false, InputStatePriority::Console); 176 inputState_->setKeyHandler( Shell::getInstance().getInputBuffer());177 inputState_->setKeyHandler(this->shell_.getInputBuffer()); 177 178 bHidesAllInputChanged(); 178 179 … … 252 253 this->consoleOverlayContainer_->setTop(-1.2 * this->relativeHeight); 253 254 254 Shell::getInstance().addOutputLevel(true);255 this->shell_.addOutputLevel(true); 255 256 256 257 COUT(4) << "Info: InGameConsole initialized" << std::endl; … … 266 267 void InGameConsole::linesChanged() 267 268 { 268 std::list<std::string>::const_iterator it = Shell::getInstance().getNewestLineIterator();269 std::list<std::string>::const_iterator it = this->shell_.getNewestLineIterator(); 269 270 int max = 0; 270 271 for (int i = 1; i < LINES; ++i) 271 272 { 272 if (it != Shell::getInstance().getEndIterator())273 if (it != this->shell_.getEndIterator()) 273 274 { 274 275 ++it; … … 295 296 { 296 297 if (LINES > 1) 297 this->print(* Shell::getInstance().getNewestLineIterator(), 1);298 this->print(*this->shell_.getNewestLineIterator(), 1); 298 299 } 299 300 … … 314 315 { 315 316 if (LINES > 0) 316 this->print( Shell::getInstance().getInput(), 0);317 318 if ( Shell::getInstance().getInput() == "" || Shell::getInstance().getInput().size() == 0)317 this->print(this->shell_.getInput(), 0); 318 319 if (this->shell_.getInput() == "" || this->shell_.getInput().size() == 0) 319 320 this->inputWindowStart_ = 0; 320 321 } … … 325 326 void InGameConsole::cursorChanged() 326 327 { 327 unsigned int pos = Shell::getInstance().getCursorPosition() - inputWindowStart_;328 unsigned int pos = this->shell_.getCursorPosition() - inputWindowStart_; 328 329 if (pos > maxCharsPerLine_) 329 330 pos = maxCharsPerLine_; … … 482 483 if (output.size() > this->maxCharsPerLine_) 483 484 { 484 if ( Shell::getInstance().getInputBuffer()->getCursorPosition() < this->inputWindowStart_)485 this->inputWindowStart_ = Shell::getInstance().getInputBuffer()->getCursorPosition();486 else if ( Shell::getInstance().getInputBuffer()->getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1))487 this->inputWindowStart_ = Shell::getInstance().getInputBuffer()->getCursorPosition() - this->maxCharsPerLine_ + 1;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 489 489 490 output = output.substr(this->inputWindowStart_, this->maxCharsPerLine_); … … 506 507 this->bActive_ = true; 507 508 InputManager::getInstance().enterState("console"); 508 Shell::getInstance().registerListener(this);509 this->shell_.registerListener(this); 509 510 510 511 this->windowResized(this->windowW_, this->windowH_); … … 528 529 this->bActive_ = false; 529 530 InputManager::getInstance().leaveState("console"); 530 Shell::getInstance().unregisterListener(this);531 this->shell_.unregisterListener(this); 531 532 532 533 // scroll up -
code/branches/console/src/orxonox/overlays/InGameConsole.h
r5929 r5969 81 81 82 82 private: // variables 83 Shell& shell_; 83 84 bool bActive_; 84 85 int windowW_;
Note: See TracChangeset
for help on using the changeset viewer.