Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7426 in orxonox.OLD for trunk/src/lib/shell


Ignore:
Timestamp:
Apr 28, 2006, 10:27:28 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: ShellFont can be changed in threads :)

Location:
trunk/src/lib/shell
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell.cc

    r7422 r7426  
    8585    // Element2D and generals
    8686    this->setAbsCoor2D(3, -400);
    87     this->textSize = 20;
     87    this->textSize = 15;
    8888    this->lineSpacing = 0;
    8989    this->bActive = true;
     
    250250  void Shell::resetValues()
    251251  {
    252     this->shellInput.setFont(this->fontFile, this->textSize);
    253     this->shellInput.setColor(this->textColor[0], this->textColor[1], this->textColor[2]);
    254     this->shellInput.setBlending(this->textColor[3]);
    255     this->shellInput.setRelCoor2D(5, (this->textSize + this->lineSpacing)*(this->bufferDisplaySize));
    256     this->shellInput.setLayer(this->getLayer());
    257     if (shellInput.getParent2D() != this)
    258       this->shellInput.setParent2D(this);
     252    this->resetText(&this->shellInput, 0);
     253    this->shellInput.setRelCoor2D(15, (this->textSize + this->lineSpacing)*(this->bufferDisplaySize));
    259254
    260255    unsigned int i = 0;
    261     for (std::list<Text*>::iterator text = this->bufferText.begin(); text != this->bufferText.end(); ++text, ++i)
    262     {
    263       (*text)->setFont(this->fontFile, this->textSize);
    264       (*text)->setColor(this->textColor[0], this->textColor[1], this->textColor[2]);
    265       (*text)->setBlending(this->textColor[3]);
     256    /* Here we create a Copy of the Buffer, so that we do not f**k up the List when some
     257     * output is routed from Some other Thread or by Changing any Values.
     258     */
     259    std::list<Text*> bufferTextCopy = this->bufferText;
     260    for (std::list<Text*>::iterator text = bufferTextCopy.begin(); text != bufferTextCopy.end(); ++text, ++i)
     261    {
     262      this->resetText(*text, i);
    266263      (*text)->setRelCoor2D( calculateLinePosition(i) );
    267       (*text)->setLayer(this->getLayer());
    268       if ((*text)->getParent2D() != this)
    269         (*text)->setParent2D(this);
    270264    }
    271265    this->shellHeight = (this->textSize + this->lineSpacing) * (bufferDisplaySize+1);
     266  }
     267
     268  void Shell::resetText(Text* text, unsigned int position)
     269  {
     270    text->setFont(this->fontFile, this->textSize);
     271    text->setColor(this->textColor[0], this->textColor[1], this->textColor[2]);
     272    text->setBlending(this->textColor[3]);
     273    text->setLayer(this->getLayer());
     274    if (text->getParent2D() != this)
     275      text->setParent2D(this);
    272276  }
    273277
  • trunk/src/lib/shell/shell.h

    r7377 r7426  
    6262    void setBackgroundImage(const std::string& fileName);
    6363
    64     void resetValues();
    65 
    6664    // BUFFERS
    6765    void setBufferDisplaySize(unsigned int bufferDisplaySize);
     
    8179
    8280  private:
     81    void resetValues();
     82    void resetText(Text* text, unsigned int position);
    8383    // helpers //
    8484    Vector2D calculateLinePosition(unsigned int lineNumber);
Note: See TracChangeset for help on using the changeset viewer.