Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 16, 2009, 2:11:14 AM (15 years ago)
Author:
landauf
Message:
  • Moved default-hud (chat, gamestate info) from Controller to HumanPlayer
  • Added support for a Gametype-HUD to Gametype and PlayerInfo
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/miniprojects/src/orxonox/objects/infos/HumanPlayer.cc

    r2662 r2789  
    5353        this->defaultController_ = Class(HumanController);
    5454
     55        this->humanHud_ = 0;
     56
    5557        this->setConfigValues();
    5658        this->registerVariables();
     
    5961    HumanPlayer::~HumanPlayer()
    6062    {
     63        if (this->isInitialized() && this->humanHud_)
     64            delete this->humanHud_;
    6165    }
    6266
     
    8993    void HumanPlayer::configvaluecallback_changedHUDTemplate()
    9094    {
    91         this->changedController();
     95        this->setHumanHUDTemplate(this->hudtemplate_);
    9296    }
    9397
     
    146150    }
    147151
    148     void HumanPlayer::changedController()
     152    void HumanPlayer::changedControllableEntity()
    149153    {
    150         if (this->getController())
     154        PlayerInfo::changedControllableEntity();
     155
     156        if (this->humanHud_)
     157            this->humanHud_->setOwner(this->getControllableEntity());
     158    }
     159
     160    void HumanPlayer::updateHumanHUD()
     161    {
     162        if (this->humanHud_)
    151163        {
    152             this->getController()->setHUDTemplate(this->hudtemplate_);
     164            delete this->humanHud_;
     165            this->humanHud_ = 0;
     166        }
    153167
    154             if (this->getController() && this->getController()->getHUD())
    155                 this->getController()->getHUD()->setOwner(this->getControllableEntity());
     168        if (this->humanHudTemplate_ != "")
     169        {
     170            this->humanHud_ = new OverlayGroup(this);
     171            this->humanHud_->addTemplate(this->humanHudTemplate_);
     172            this->humanHud_->setOwner(this->getControllableEntity());
    156173        }
    157174    }
Note: See TracChangeset for help on using the changeset viewer.