Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 12, 2008, 12:57:45 AM (16 years ago)
Author:
rgrieder
Message:

svn save, just in case our house burns down over night…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud/src/orxonox/hud/HUDOverlay.cc

    r1588 r1590  
    3333#include "util/Convert.h"
    3434#include "core/CoreIncludes.h"
     35#include "GraphicsEngine.h"
    3536
    3637namespace orxonox
    3738{
    38   CreateFactory(HUDOverlay);
    3939  unsigned int HUDOverlay::hudOverlayCounter_s = 0;
    4040
     
    4949    BaseObject::XMLPort(xmlElement, mode);
    5050
    51     overlay_ = Ogre::OverlayManager::getSingleton().create("HUDOverlay"
    52           + convertToString(hudOverlayCounter_s++) + "_" + this->getName());
     51    if (mode == XMLPort::LoadObject)
     52    {
     53      overlay_ = Ogre::OverlayManager::getSingleton().create("HUDOverlay"
     54            + convertToString(hudOverlayCounter_s++) + "_" + this->getName());
     55
     56      this->windowWidth_ = GraphicsEngine::getSingleton().getWindowWidth();
     57      this->windowHeight_ = GraphicsEngine::getSingleton().getWindowHeight();
     58      this->windowAspectRatio_ = windowWidth_/(float)windowHeight_;
     59    }
    5360
    5461    XMLPortParam(HUDOverlay, "scale", setScale, getScale, xmlElement, mode);
     
    5663    XMLPortParam(HUDOverlay, "rotation", setRotation, getRotation, xmlElement, mode);
    5764
    58     this->overlay_->show();
    59     if (!this->isVisible())
    60         this->overlay_->hide();
     65    if (mode == XMLPort::LoadObject)
     66    {
     67      this->overlay_->show();
     68      if (!this->isVisible())
     69          this->overlay_->hide();
     70    }
    6171  }
    6272
     
    7686  }
    7787
     88  void HUDOverlay::windowResized(int newWidth, int newHeight)
     89  {
     90    this->windowWidth_ = newWidth;
     91    this->windowHeight_ = newHeight;
     92    this->windowAspectRatio_ = windowWidth_/(float)windowHeight_;
     93  }
     94
    7895}
Note: See TracChangeset for help on using the changeset viewer.