Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 26, 2008, 7:00:59 PM (17 years ago)
Author:
rgrieder
Message:

some adjustment to the default value setting in the overlay files

File:
1 edited

Legend:

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

    r1625 r1627  
    9696        if (mode == XMLPort::LoadObject)
    9797        {
    98             // set some default values
    99             this->windowAspectRatio_ = 1.0f;
    100             this->bCorrectAspect_    = false;
    101             this->size_              = Vector2(1.0f, 1.0f);
    102             this->sizeCorrection_    = Vector2(1.0f, 1.0f);
    103             this->position_          = Vector2(0.0f, 0.0f);
    104             this->pickPoint_         = Vector2(0.0f, 0.0f);
    105             this->angle_             = Radian(0.0f);
    106 
    10798            // add this overlay to the static map of OrxonoxOverlays
    10899            if (overlays_s.find(this->getName()) != overlays_s.end())
     
    122113            this->overlay_->add2D(this->background_);
    123114
    124             // We'll have to get the aspect ratio for the first. Afterwards windowResized() gets
     115            // We'll have to get the aspect ratio manually for the first time. Afterwards windowResized() gets
    125116            // called automatically by the GraphicsEngine.
    126117            this->windowResized(GraphicsEngine::getSingleton().getWindowWidth(),
    127118                GraphicsEngine::getSingleton().getWindowHeight());
     119
     120            this->changedVisibility();
     121
     122            this->setSize(Vector2(0.5f, 0.5f));
     123            this->setPickPoint(Vector2(0.5f, 0.5f));
     124            this->setPosition(Vector2(0.5f, 0.5f));
     125            this->setRotation(Degree(0.0f));
     126            this->setAspectCorrection(true);
     127            this->setBackgroundMaterial("");
    128128        }
    129129
    130         XMLPortParam(OrxonoxOverlay, "correctAspect", setAspectCorrection, getAspectCorrection, xmlElement, mode);
    131         XMLPortParam(OrxonoxOverlay, "size", setSize, getSize, xmlElement, mode);
    132         XMLPortParam(OrxonoxOverlay, "rotation", setRotation, getRotation, xmlElement, mode);
    133         // see setPickPoint()
    134         XMLPortParam(OrxonoxOverlay, "pickPoint", setPickPoint, getPickPoint, xmlElement, mode);
    135         XMLPortParam(OrxonoxOverlay, "position", setPosition, getPosition, xmlElement, mode);
    136         XMLPortParam(OrxonoxOverlay, "background", setBackgroundMaterial, getBackgroundMaterial, xmlElement, mode);
    137 
    138         if (mode == XMLPort::LoadObject)
    139         {
    140             // call all the virtual 'setters'
    141             this->changedVisibility();
    142             this->angleChanged();
    143             this->sizeCorrectionChanged();
    144             this->sizeChanged();
    145             // probably gets called 4 times (by all the methods), but sizeChanged() could be overwritten.
    146             this->positionChanged();
    147         }
     130        XMLPortParam(OrxonoxOverlay, "size",      setSize,      getSize,      xmlElement, mode)
     131            .defaultValues(Vector2(0.5f, 0.5f));
     132        XMLPortParam(OrxonoxOverlay, "pickPoint", setPickPoint, getPickPoint, xmlElement, mode)
     133            .defaultValues(Vector2(0.0f, 0.0f));
     134        XMLPortParam(OrxonoxOverlay, "position",  setPosition,  getPosition,  xmlElement, mode)
     135            .defaultValues(Vector2(0.0f, 0.0f));
     136        XMLPortParam(OrxonoxOverlay, "rotation",  setRotation,  getRotation,  xmlElement, mode)
     137            .defaultValues(0.0f);
     138        XMLPortParam(OrxonoxOverlay, "correctAspect", setAspectCorrection,   getAspectCorrection,   xmlElement, mode)
     139            .defaultValues(true);
     140        XMLPortParam(OrxonoxOverlay, "background",    setBackgroundMaterial, getBackgroundMaterial, xmlElement, mode)
     141            .defaultValues("");
    148142    }
    149143
Note: See TracChangeset for help on using the changeset viewer.