Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2222


Ignore:
Timestamp:
Nov 19, 2008, 3:29:24 PM (16 years ago)
Author:
bhildebr
Message:

Created class CreateLines to display several text lines on the scoreboard

Location:
code/branches/overlay/src/orxonox/overlays/stats
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/overlay/src/orxonox/overlays/stats/CreateLines.cc

    r2200 r2222  
    6060    }
    6161
    62     void createTextArea(unsigned int lineIndex) {
     62    /**
     63        @brief Ensures that the number of OverlayElements is equal to numberOfColumns.
     64    */
     65    void setNumberOfColumns(unsigned int numberOfColumns) {
    6366
    64         this->statsOverlayTextAreas_ = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "StatsLineTextArea" + getName() + convertToString(lineIndex)));
    65         this->overlay_->add2D(this->statsOverlayTextAreas_);
     67        Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
    6668
    67         // this->textColumns_.push_back();    pointer to be added
     69        while (textColumns_.getSize() < numberOfColumns) {
     70
     71            tempTextArea* = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "StatsLineTextArea" + getName() + convertToString(lineIndex)));
     72            textColumns_->add2D(tempTextArea);
     73            textColumns_.push_back(tempTextArea);
     74
     75        }
     76
     77        while (textColumns_.getSize() > numberOfColumns) {
     78
     79            ovMan->destroy(textColumns_.back());
     80            textColumns_.pop_back();
     81
     82        }
     83
     84    }
     85
     86    void alignColumn(int columnIndex, float leftOffset) {
     87
     88        this->textColumns_[columnIndex]->setPosition(leftOffset,0);
     89
     90    }
     91
     92    void setColumnText(int columnIndex, string columnText) {
     93
     94        this->textColumns_[columnIndex]->setCaption(columnText);
    6895
    6996    }
  • code/branches/overlay/src/orxonox/overlays/stats/CreateLines.h

    r2200 r2222  
    5050
    5151    private: // functions
    52         void createTextArea();
     52        void setNumberOfColumns();
     53        void alignColumn();
     54        void setColumnText();
    5355
    5456    private: // variables
Note: See TracChangeset for help on using the changeset viewer.