Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 28, 2008, 10:55:49 PM (16 years ago)
Author:
rgrieder
Message:

Added minimal test files for a statistics overlay.

File:
1 edited

Legend:

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

    r1755 r2036  
    6060    {
    6161        RegisterObject(OrxonoxOverlay);
     62
     63        // add this overlay to the static map of OrxonoxOverlays
     64        if (overlays_s.find(this->getName()) != overlays_s.end())
     65        {
     66            COUT(1) << "Overlay names should be unique or you cannnot access them via console." << std::endl;
     67        }
     68        overlays_s[this->getName()] = this;
     69
     70        // create the Ogre::Overlay
     71        overlay_ = Ogre::OverlayManager::getSingleton().create("OrxonoxOverlay_overlay_"
     72            + convertToString(hudOverlayCounter_s++));
     73
     74        // create background panel (can be used to show any picture)
     75        this->background_ = static_cast<Ogre::PanelOverlayElement*>(
     76            Ogre::OverlayManager::getSingleton().createOverlayElement("Panel",
     77            "OrxonoxOverlay_background_" + convertToString(hudOverlayCounter_s++)));
     78        this->overlay_->add2D(this->background_);
     79
     80        // We'll have to get the aspect ratio manually for the first time. Afterwards windowResized() gets
     81        // called automatically by the GraphicsEngine.
     82        this->windowResized(GraphicsEngine::getInstance().getWindowWidth(),
     83            GraphicsEngine::getInstance().getWindowHeight());
     84
     85        this->changedVisibility();
    6286    }
    6387
     
    93117    {
    94118        SUPER(OrxonoxOverlay, XMLPort, xmlElement, mode);
    95 
    96         if (mode == XMLPort::LoadObject)
    97         {
    98             // add this overlay to the static map of OrxonoxOverlays
    99             if (overlays_s.find(this->getName()) != overlays_s.end())
    100             {
    101                 COUT(1) << "Overlay names should be unique or you cannnot access them via console." << std::endl;
    102             }
    103             overlays_s[this->getName()] = this;
    104 
    105             // create the Ogre::Overlay
    106             overlay_ = Ogre::OverlayManager::getSingleton().create("OrxonoxOverlay_overlay_"
    107                 + convertToString(hudOverlayCounter_s++));
    108 
    109             // create background panel (can be used to show any picture)
    110             this->background_ = static_cast<Ogre::PanelOverlayElement*>(
    111                 Ogre::OverlayManager::getSingleton().createOverlayElement("Panel",
    112                 "OrxonoxOverlay_background_" + convertToString(hudOverlayCounter_s++)));
    113             this->overlay_->add2D(this->background_);
    114 
    115             // We'll have to get the aspect ratio manually for the first time. Afterwards windowResized() gets
    116             // called automatically by the GraphicsEngine.
    117             this->windowResized(GraphicsEngine::getInstance().getWindowWidth(),
    118                 GraphicsEngine::getInstance().getWindowHeight());
    119 
    120             this->changedVisibility();
    121         }
    122119
    123120        XMLPortParam(OrxonoxOverlay, "size",      setSize,      getSize,      xmlElement, mode)
Note: See TracChangeset for help on using the changeset viewer.