Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5107 in orxonox.OLD


Ignore:
Timestamp:
Aug 23, 2005, 9:36:27 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: shell is now properly moving through the bufferlines

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r5091 r5107  
    712712  {
    713713    tIterator<Element2D>* iterator = this->children->getIterator();
    714       //PNode* pn = this->children->enumerate ();
    715714    Element2D* pn = iterator->nextElement();
    716715    while( pn != NULL)
  • trunk/src/util/shell.cc

    r5106 r5107  
    4343
    4444  this->shellHeight = 400;
     45  this->bActive = false;
    4546  this->buffer = new tList<char>;
    4647
     
    107108void Shell::activate()
    108109{
     110  if (this->bActive == true)
     111    PRINTF(3)("The shell is already active\n");
     112  this->bActive = true;
     113
    109114  EventHandler::getInstance()->setState(ES_SHELL);
    110115  this->setRelCoorSoft2D(0, 0, 1, 5);
     
    113118void Shell::deactivate()
    114119{
     120  if (this->bActive == false)
     121    PRINTF(3)("The shell is already inactive\n");
     122  this->bActive = false;
     123
    115124  EventHandler::getInstance()->setState(ES_GAME);
    116125  this->setRelCoorSoft2D(0, -400, 1, 5);
     
    158167    this->bufferText[i] = TextEngine::getInstance()->createText("fonts/Aniron_Bold.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
    159168    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));
    161170    this->bufferText[i]->setText(NULL);
    162171    this->bufferText[i]->setParent2D(this);
     
    240249   }
    241250
    242    if (likely(bufferText != NULL))
     251   if (this->bActive && likely(bufferText != NULL))
    243252   {
    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++)
    246260     {
    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;
    248266     }
    249      this->bufferText[0] = moveText;
     267     lastText->setRelCoor2D(firstCoord);
     268     this->bufferText[0] = lastText;
     269
     270     this->bufferText[0]->setText(newLine);
    250271   }
    251    this->bufferText[0]->setText(newLine);
    252272}
    253273
  • trunk/src/util/shell.h

    r5106 r5107  
    101101    unsigned int           lineSpacing;            //!< The Spacing between lines.
    102102    unsigned int           shellHeight;            //!< The hight of the Shell in Pixels
     103    bool                   bActive;                //!< if the shell is active;
    103104
    104105    char                   bufferArray[10000];     //!< a BUFFER for fast writing
Note: See TracChangeset for help on using the changeset viewer.