Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 25, 2009, 1:18:03 PM (15 years ago)
Author:
dafrick
Message:

Merged presentation2 branch into pickup2 branch.

Location:
code/branches/pickup2
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup2

  • code/branches/pickup2/src/modules/overlays/hud/ChatOverlay.cc

    r5929 r6412  
    3333
    3434#include "util/Convert.h"
    35 #include "util/UTFStringConversions.h"
     35#include "util/DisplayStringConversions.h"
    3636#include "core/CoreIncludes.h"
    3737#include "core/ConfigValueIncludes.h"
     
    8686        }
    8787
    88         this->messages_.push_back(multi_cast<Ogre::UTFString>(text));
     88        this->messages_.push_back(multi_cast<Ogre::DisplayString>(text));
    8989        COUT(0) << "Chat: " << text << std::endl;
    9090
     
    110110        this->text_->setCaption("");
    111111
    112         for (std::list<Ogre::UTFString>::reverse_iterator it = this->messages_.rbegin(); it != this->messages_.rend(); ++it)
     112        for (std::list<Ogre::DisplayString>::reverse_iterator it = this->messages_.rbegin(); it != this->messages_.rend(); ++it)
    113113        {
    114114            this->text_->setCaption(this->text_->getCaption() + "\n" + (*it));
  • code/branches/pickup2/src/modules/overlays/hud/ChatOverlay.h

    r5929 r6412  
    3333
    3434#include <list>
    35 #include <OgreUTFString.h>
     35#include <OgreOverlayElement.h>
    3636
    3737#include "network/ChatListener.h"
     
    5151            virtual void incomingChat(const std::string& message, unsigned int senderID);
    5252
    53             std::list<Ogre::UTFString> messages_;
     53            std::list<Ogre::DisplayString> messages_;
    5454
    5555        private:
  • code/branches/pickup2/src/modules/overlays/hud/HUDBar.cc

    r5929 r6412  
    6767
    6868    HUDBar::HUDBar(BaseObject* creator)
    69         : OrxonoxOverlay(creator)
     69        : OrxonoxOverlay(creator), right2Left_(false), autoColour_(false)
    7070    {
    7171        RegisterObject(HUDBar);
    7272
    7373        // create new material
    74         std::string materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);
     74        const std::string& materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);
    7575        Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialname, "General"));
    7676        material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
     
    8585
    8686        this->value_ = 1.0f;  // initielize with 1.0f to trigger a change when calling setValue(0.0f) on the line below
     87        this->setAutoColour(true);
    8788        this->setValue(0.0f); // <--
    8889        this->setRightToLeft(false);
    89         this->setAutoColour(true);
    9090        this->currentColour_ = ColourValue::White;
    9191
     
    122122            {
    123123                ColourValue colour1(0, 0, 0, 1);
    124                 ColourValue colour2 = (*this->colours_.rbegin()).second;
     124                ColourValue colour2 = this->colours_.rbegin()->second;
    125125                float value1(0);
    126                 float value2 = (*this->colours_.rbegin()).first;
     126                float value2 = this->colours_.rbegin()->first;
    127127                for (std::map<float, ColourValue>::reverse_iterator it = this->colours_.rbegin(); it != this->colours_.rend(); ++it)
    128128                {
    129129                    colour1 = colour2;
    130130                    value1 = value2;
    131                     colour2 = (*it).second;
    132                     value2 = (*it).first;
     131                    colour2 = it->second;
     132                    value2 = it->first;
    133133
    134134                    if (value2 < this->value_)
  • code/branches/pickup2/src/modules/overlays/hud/HUDHealthBar.cc

    r5929 r6412  
    4848        this->textoverlay_ = new OverlayText(this);
    4949
    50         assert(this->textoverlay_);
     50        assert(this->textoverlay_.get());
    5151
    5252        this->textoverlay_->setCaption("");
     
    5656    {
    5757        if (this->isInitialized())
     58        {
    5859            this->textoverlay_->destroy();
     60            this->textoverlay_ = 0;
     61        }
    5962    }
    6063
     
    106109        SUPER(HUDHealthBar, changedOverlayGroup);
    107110
    108         this->getOverlayGroup()->addElement(this->textoverlay_);
     111        this->getOverlayGroup()->addElement(this->textoverlay_.get());
    109112    }
    110113
  • code/branches/pickup2/src/modules/overlays/hud/HUDHealthBar.h

    r5929 r6412  
    5353
    5454            inline void setTextFont(const std::string& font)
    55                 { if (font != "") { this->textoverlay_->setFont(font); } }
     55                { if (!font.empty()) { this->textoverlay_->setFont(font); } }
    5656            inline const std::string& getTextFont() const
    5757                { return this->textoverlay_->getFont(); }
     
    112112        private:
    113113            WeakPtr<Pawn> owner_;
    114             OverlayText* textoverlay_;
     114            SmartPtr<OverlayText> textoverlay_;
    115115            bool bUseBarColour_;
    116116            ColourValue textColour_;
  • code/branches/pickup2/src/modules/overlays/hud/HUDNavigation.cc

    r5929 r6412  
    3030
    3131#include <string>
     32#include <OgreCamera.h>
    3233#include <OgreOverlayManager.h>
    3334#include <OgreTextAreaOverlayElement.h>
     
    3536
    3637#include "util/Math.h"
    37 #include "util/StringUtils.h"
    3838#include "util/Convert.h"
    3939#include "core/CoreIncludes.h"
    4040#include "core/XMLPort.h"
     41#include "CameraManager.h"
    4142#include "Scene.h"
    4243#include "Radar.h"
     44#include "graphics/Camera.h"
     45#include "controllers/HumanController.h"
     46#include "worldentities/pawns/Pawn.h"
    4347
    4448namespace orxonox
     
    6064        navMarker_->setMaterialName("Orxonox/NavArrows");
    6165
     66/*
    6267        // create aim marker
    6368        aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
     
    7075        setNavMarkerSize(0.05f);
    7176        setAimMarkerSize(0.04f);
     77*/
    7278
    7379        background_->addChild(navMarker_);
    74         background_->addChild(aimMarker_);
     80//        background_->addChild(aimMarker_);
    7581        background_->addChild(navText_);
    7682
     
    8591            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navMarker_);
    8692            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navText_);
    87             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_);
     93//            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_);
    8894        }
    8995    }
     
    96102        XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode);
    97103        XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode);
    98         XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode);
     104//        XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode);
    99105    }
    100106
    101107    void HUDNavigation::setFont(const std::string& font)
    102108    {
    103         if (this->navText_ && font != "")
     109        if (this->navText_ && !font.empty())
    104110            this->navText_->setFontName(font);
    105111    }
     
    149155        float textLength = multi_cast<std::string>(dist).size() * navText_->getCharHeight() * 0.3;
    150156
    151 /*
    152         Ogre::Camera* navCam = SpaceShip::getLocalShip()->getCamera()->cam_;
    153         Matrix4 transformationMatrix = navCam->getProjectionMatrix() * navCam->getViewMatrix();
    154 */
     157        orxonox::Camera* cam = CameraManager::getInstance().getActiveCamera();
     158        if (!cam)
     159            return;
     160        const Matrix4& transform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix();
    155161        // transform to screen coordinates
    156         Vector3 pos = /*transformationMatrix * */radar->getFocus()->getRVWorldPosition();
     162        Vector3 pos = transform * radar->getFocus()->getRVWorldPosition();
    157163
    158164        bool outOfView;
     
    172178        {
    173179            // object is not in view
    174             aimMarker_->hide();
     180//            aimMarker_->hide();
    175181
    176182            if (!wasOutOfView_)
     
    227233            // object is in view
    228234/*
    229             Vector3 aimpos = transformationMatrix * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(),
     235            Vector3 aimpos = transform * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(),
    230236                    Projectile::getSpeed(), Radar::getInstance().getFocus()->getRVWorldPosition(), Radar::getInstance().getFocus()->getRVOrientedVelocity());
    231237*/
     
    241247            navMarker_->setTop((-pos.y + 1.0 - navMarker_->getHeight()) * 0.5);
    242248
     249/*
    243250            aimMarker_->show();
    244 /*
    245251            aimMarker_->setLeft((aimpos.x + 1.0 - aimMarker_->getWidth()) * 0.5);
    246252            aimMarker_->setTop((-aimpos.y + 1.0 - aimMarker_->getHeight()) * 0.5);
     
    253259    float HUDNavigation::getDist2Focus() const
    254260    {
    255 /*
    256         if (Radar::getInstance().getFocus())
    257             return (Radar::getInstance().getFocus()->getRVWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length();
    258         else
    259 */
     261        Radar* radar = this->getOwner()->getScene()->getRadar();
     262        if (radar->getFocus() && HumanController::getLocalControllerEntityAsPawn())
     263            return (radar->getFocus()->getRVWorldPosition() - HumanController::getLocalControllerEntityAsPawn()->getWorldPosition()).length();
     264        else
    260265            return 0;
    261266    }
     
    267272    void HUDNavigation::sizeChanged()
    268273    {
    269         // use size to compensate for apspect ratio if enabled.
     274        // use size to compensate for aspect ratio if enabled.
    270275        float xScale = this->getActualSize().x;
    271276        float yScale = this->getActualSize().y;
    272277        if (this->navMarker_)
    273278            navMarker_->setDimensions(navMarkerSize_ * xScale, navMarkerSize_ * yScale);
     279/*
    274280        if (this->aimMarker_)
    275281            aimMarker_->setDimensions(aimMarkerSize_ * xScale, aimMarkerSize_ * yScale);
     282*/
    276283        if (this->navText_)
    277284            navText_->setCharHeight(navText_->getCharHeight() * yScale);
  • code/branches/pickup2/src/modules/overlays/hud/HUDNavigation.h

    r5781 r6412  
    5656        float getNavMarkerSize() const    { return this->navMarkerSize_; }
    5757
     58/*
    5859        void setAimMarkerSize(float size) { this->aimMarkerSize_ = size; this->sizeChanged(); }
    5960        float getAimMarkerSize() const    { return this->aimMarkerSize_; }
     61*/
    6062
    6163        void setTextSize(float size);
     
    7173        Ogre::PanelOverlayElement* navMarker_;      //!< the panel used to show the arrow and the target marker
    7274        float navMarkerSize_;                       //!< One paramter size of the navigation marker
     75/*
    7376        Ogre::PanelOverlayElement* aimMarker_;      //!< Panel used to show the aim Marker
    7477        float aimMarkerSize_;                       //!< One paramter size of the aim marker
     78*/
    7579        Ogre::TextAreaOverlayElement* navText_;     //!< Text overlay to display the target distance
    7680        bool wasOutOfView_;                         //!< Performance booster variable: setMaterial is not cheap
  • code/branches/pickup2/src/modules/overlays/hud/HUDRadar.cc

    r5781 r6412  
    126126            panel = *itRadarDots_;
    127127            ++itRadarDots_;
    128             std::string materialName = TextureGenerator::getMaterialName(
     128            const std::string& materialName = TextureGenerator::getMaterialName(
    129129                shapeMaterials_[object->getRadarObjectShape()], object->getRadarObjectColour());
    130130            if (materialName != panel->getMaterialName())
  • code/branches/pickup2/src/modules/overlays/hud/TeamBaseMatchScore.cc

    r5929 r6412  
    7171        if (this->owner_)
    7272        {
    73             std::string bases1 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ")";
    74             std::string bases2 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ")";
     73            const std::string& bases1 = '(' + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ')';
     74            const std::string& bases2 = '(' + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ')';
    7575
    76             std::string score1 = multi_cast<std::string>(this->owner_->getTeamPoints(0));
    77             std::string score2 = multi_cast<std::string>(this->owner_->getTeamPoints(1));
     76            const std::string& score1 = multi_cast<std::string>(this->owner_->getTeamPoints(0));
     77            const std::string& score2 = multi_cast<std::string>(this->owner_->getTeamPoints(1));
    7878
    7979            std::string output1;
     
    9999            }
    100100
    101             std::string output = "";
     101            std::string output;
    102102            if (this->bShowBases_ || this->bShowScore_)
    103103            {
    104104                if (this->bShowLeftTeam_ && this->bShowRightTeam_)
    105                     output = output1 + ":" + output2;
     105                    output = output1 + ':' + output2;
    106106                else if (this->bShowLeftTeam_ || this->bShowRightTeam_)
    107107                    output = output1 + output2;
  • code/branches/pickup2/src/modules/overlays/hud/UnderAttackHealthBar.cc

    r5929 r6412  
    3434#include "gametypes/UnderAttack.h"
    3535#include "worldentities/pawns/Destroyer.h"
     36#include "overlays/OverlayGroup.h"
    3637
    3738namespace orxonox
     
    5859    {
    5960        if (this->isInitialized())
     61        {
    6062            this->text_->destroy();
     63            this->text_ = 0;
     64        }
    6165    }
    6266
     
    9195    }
    9296
     97    void UnderAttackHealthBar::changedOverlayGroup()
     98    {
     99        SUPER(UnderAttackHealthBar, changedOverlayGroup);
     100
     101        this->getOverlayGroup()->addElement(this->text_.get());
     102    }
     103
    93104    void UnderAttackHealthBar::init()
    94105    {
  • code/branches/pickup2/src/modules/overlays/hud/UnderAttackHealthBar.h

    r5929 r6412  
    4646            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4747            virtual void changedOwner();
     48            virtual void changedOverlayGroup();
    4849
    4950            inline void setDescriptionPickPoint(const Vector2& pickpoint)
     
    6162
    6263            PlayerInfo* owner_;
    63             OverlayText* text_;
     64            SmartPtr<OverlayText> text_;
    6465            Timer inittimer_;
    6566    };
Note: See TracChangeset for help on using the changeset viewer.