Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2008, 3:37:48 AM (15 years ago)
Author:
landauf
Message:
  • Added a health bar
  • Some changes in CameraManager to handle the case when no camera exists after removing the last one, but this is still somehow buggy (freezes and later crashes reproducible but inexplicable after a few respawns)
  • Added PawnManager to handle destruction of Pawns without using delete within tick()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/overlays/hud/HUDBar.cc

    r2087 r2369  
    5151        RegisterObject(BarColour);
    5252
    53         setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
    54         setPosition(0.0);
     53        this->setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
     54        this->setPosition(0.0);
    5555    }
    5656
     
    8484        this->bar_->setMaterialName(materialname);
    8585
    86         setValue(0.4567654f);
    87         setRightToLeft(false);
    88         setAutoColour(true);
     86        this->setValue(0.0f);
     87        this->setRightToLeft(false);
     88        this->setAutoColour(true);
     89        this->currentColour_ = ColourValue::White;
    8990
    9091        this->background_->addChild(bar_);
     
    101102        SUPER(HUDBar, XMLPort, xmlElement, mode);
    102103
    103         XMLPortParam(HUDBar, "initialValue", setValue,       getValue,       xmlElement, mode);
    104         XMLPortParam(HUDBar, "rightToLeft",  setRightToLeft, getRightToLeft, xmlElement, mode);
    105         XMLPortParam(HUDBar, "autoColour",   setAutoColour,  getAutoColour,  xmlElement, mode);
     104        XMLPortParam(HUDBar, "initialvalue", setValue,       getValue,       xmlElement, mode);
     105        XMLPortParam(HUDBar, "righttoleft",  setRightToLeft, getRightToLeft, xmlElement, mode);
     106        XMLPortParam(HUDBar, "autocolour",   setAutoColour,  getAutoColour,  xmlElement, mode);
     107        XMLPortParam(HUDBar, "bartexture",   setBarTexture,  getBarTexture, xmlElement, mode);
    106108        XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode);
    107109    }
     
    130132                {
    131133                    this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour2);
     134                    this->currentColour_ = colour2;
    132135                }
    133136                else if (value1 < this->value_)
    134137                {
    135138                    this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour1);
     139                    this->currentColour_ = colour1;
    136140                }
    137141                else
     
    139143                    //float interpolationfactor = (this->value_ - value2) / (value1 - value2);
    140144                    float interpolationfactor = interpolateSmooth((this->value_ - value2) / (value1 - value2), 0.0f, 1.0f);
    141                     this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour1 * interpolationfactor + colour2 * (1 - interpolationfactor));
     145                    this->currentColour_ = colour1 * interpolationfactor + colour2 * (1 - interpolationfactor);
     146                    this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, this->currentColour_);
     147
    142148                }
    143149            }
     
    181187        this->colours_.clear();
    182188    }
     189
     190    void HUDBar::setBarTexture(const std::string& texture)
     191    {
     192        this->textureUnitState_->setTextureName(texture);
     193    }
     194
     195    const std::string& HUDBar::getBarTexture() const
     196    {
     197        return this->textureUnitState_->getTextureName();
     198    }
    183199}
Note: See TracChangeset for help on using the changeset viewer.