Changeset 5107 in orxonox.OLD for trunk/src/util
- Timestamp:
- Aug 23, 2005, 9:36:27 PM (19 years ago)
- Location:
- trunk/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/shell.cc
r5106 r5107 43 43 44 44 this->shellHeight = 400; 45 this->bActive = false; 45 46 this->buffer = new tList<char>; 46 47 … … 107 108 void Shell::activate() 108 109 { 110 if (this->bActive == true) 111 PRINTF(3)("The shell is already active\n"); 112 this->bActive = true; 113 109 114 EventHandler::getInstance()->setState(ES_SHELL); 110 115 this->setRelCoorSoft2D(0, 0, 1, 5); … … 113 118 void Shell::deactivate() 114 119 { 120 if (this->bActive == false) 121 PRINTF(3)("The shell is already inactive\n"); 122 this->bActive = false; 123 115 124 EventHandler::getInstance()->setState(ES_GAME); 116 125 this->setRelCoorSoft2D(0, -400, 1, 5); … … 158 167 this->bufferText[i] = TextEngine::getInstance()->createText("fonts/Aniron_Bold.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0); 159 168 this->bufferText[i]->setAlignment(TEXT_ALIGN_LEFT); 160 this->bufferText[i]->setRelCoor2D(5, (this->textSize + this->lineSpacing)* i);169 this->bufferText[i]->setRelCoor2D(5, (this->textSize + this->lineSpacing)*(bufferDisplaySize - i -1)); 161 170 this->bufferText[i]->setText(NULL); 162 171 this->bufferText[i]->setParent2D(this); … … 240 249 } 241 250 242 if ( likely(bufferText != NULL))251 if (this->bActive && likely(bufferText != NULL)) 243 252 { 244 Text* moveText = this->bufferText[this->bufferDisplaySize-1]; 245 for (int i = this->bufferDisplaySize-1; i > 0; i--) 253 Text* lastText = this->bufferText[this->bufferDisplaySize-1]; 254 Vector firstCoord = this->bufferText[0]->getRelCoor2D(); 255 256 Text* swapText; 257 Text* moveText = this->bufferText[0]; 258 this->bufferText[0]->setRelCoor2D(this->bufferText[1]->getRelCoor2D()); 259 for (unsigned int i = 1; i < this->bufferDisplaySize; i++) 246 260 { 247 this->bufferText[i] = this->bufferText[i-1]; 261 if ( i < this->bufferDisplaySize-1) 262 this->bufferText[i]->setRelCoor2D(this->bufferText[i+1]->getRelCoor2D()); 263 swapText = this->bufferText[i]; 264 this->bufferText[i] = moveText; 265 moveText = swapText; 248 266 } 249 this->bufferText[0] = moveText; 267 lastText->setRelCoor2D(firstCoord); 268 this->bufferText[0] = lastText; 269 270 this->bufferText[0]->setText(newLine); 250 271 } 251 this->bufferText[0]->setText(newLine);252 272 } 253 273 -
trunk/src/util/shell.h
r5106 r5107 101 101 unsigned int lineSpacing; //!< The Spacing between lines. 102 102 unsigned int shellHeight; //!< The hight of the Shell in Pixels 103 bool bActive; //!< if the shell is active; 103 104 104 105 char bufferArray[10000]; //!< a BUFFER for fast writing
Note: See TracChangeset
for help on using the changeset viewer.