Changeset 7757 in orxonox.OLD for trunk/src/lib/shell
- Timestamp:
- May 21, 2006, 11:07:48 PM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell.cc
r7750 r7757 67 67 EventHandler::getInstance()->subscribe(this, ES_SHELL, SDLK_PAGEUP); 68 68 EventHandler::getInstance()->subscribe(this, ES_SHELL, SDLK_PAGEDOWN); 69 EventHandler::getInstance()->subscribe(this, ES_SHELL, EV_VIDEO_RESIZE); 69 70 70 71 // BUFFER … … 76 77 77 78 // Element2D and generals 79 this->setSizeX2D(GraphicsEngine::getInstance()->getResolutionX()); 78 80 this->setAbsCoor2D(3, -400); 79 81 this->textSize = 15; … … 136 138 (*text)->setText(""); 137 139 } 138 repositionText(); 140 this->updateResolution( GraphicsEngine::getInstance()->getResolutionX()); 141 this->repositionText(); 139 142 } 140 143 … … 226 229 { 227 230 this->backgroundMaterial.setDiffuseMap(fileName); 231 } 232 233 234 /** 235 * @brief updates the Shell's Width 236 * @param width the new Width. 237 */ 238 void Shell::updateResolution(unsigned int width) 239 { 240 if (width == this->getSizeX2D()) 241 return; 242 this->setSizeX2D(width); 243 for (std::list<MultiLineText*>::iterator textIt = this->bufferText.begin(); textIt != this->bufferText.end(); ++textIt) 244 { 245 (*textIt)->setLineWidth(width); 246 } 228 247 } 229 248 … … 402 421 403 422 404 (*textIt)->setRelCoor2D(calculateLinePosition( (linePos++ > 0) ? linePos : 0));423 (*textIt)->setRelCoor2D(calculateLinePosition( (linePos++ > 0) ? linePos : 0)); 405 424 (*textIt)->setText((*it)); 406 425 } … … 446 465 this->moveDisplayBuffer(-this->bufferDisplaySize+1); 447 466 } 467 else if (event.type == EV_VIDEO_RESIZE) 468 { 469 this->updateResolution(event.resize.w); 470 this->repositionText(); 471 } 448 472 } 449 473 } … … 487 511 Vector2D Shell::calculateLinePosition(unsigned int lineNumber) 488 512 { 489 return Vector2D(5 , (int)(this->textSize + this->lineSpacing)*(int)((int)this->bufferDisplaySize - (int)lineNumber - (int)2) + (int)this->textSize);513 return Vector2D(5.0f, (float)(this->textSize + this->lineSpacing)*(float)((int)this->bufferDisplaySize - (int)lineNumber - (int)1)); 490 514 } 491 515 -
trunk/src/lib/shell/shell.h
r7753 r7757 81 81 void testShell() const; 82 82 private: 83 void updateResolution(unsigned int width); 83 84 void repositionText(); 84 85 void applyTextSettings(Text* text);
Note: See TracChangeset
for help on using the changeset viewer.