Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 23, 2009, 8:10:03 PM (15 years ago)
Author:
rgrieder
Message:

Fixed dedicated problem in NHC and a memory leak on windows in the IOConsole.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc

    r6119 r6122  
    5252    NewHumanController* NewHumanController::localController_s = 0;
    5353
    54     NewHumanController::NewHumanController(BaseObject* creator) : HumanController(creator)
     54    NewHumanController::NewHumanController(BaseObject* creator)
     55        : HumanController(creator)
     56        , crossHairOverlay_(NULL)
    5557    {
    5658        RegisterObject(NewHumanController);
     
    5961        controlMode_ = 0;
    6062
    61         crossHairOverlay_ = new OrxonoxOverlay(this);
    62         crossHairOverlay_->setBackgroundMaterial("Orxonox/Crosshair3");
    63         crossHairOverlay_->setSize(Vector2(overlaySize_, overlaySize_));
    64         crossHairOverlay_->show();
     63        if (GameMode::showsGraphics())
     64        {
     65            crossHairOverlay_ = new OrxonoxOverlay(this);
     66            crossHairOverlay_->setBackgroundMaterial("Orxonox/Crosshair3");
     67            crossHairOverlay_->setSize(Vector2(overlaySize_, overlaySize_));
     68            crossHairOverlay_->show();
     69        }
    6570
    6671        // HACK: Define which objects are targetable when considering the creator of an orxonox::Model
     
    7681        if (this->isInitialized())
    7782        {
     83            if (this->crossHairOverlay_)
     84                this->crossHairOverlay_->destroy();
    7885        }
    7986    }
     
    8188    void NewHumanController::tick(float dt)
    8289    {
    83         if( this->controllableEntity_ && !this->controllableEntity_->isInMouseLook() )
    84         {
    85             this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2));
    86             this->crossHairOverlay_->show();
    87         }
    88         else
    89             this->crossHairOverlay_->hide();
    90         // TODO: update aimPosition of Pawn
     90        if (GameMode::showsGraphics())
     91        {
     92            if( this->controllableEntity_ && !this->controllableEntity_->isInMouseLook() )
     93            {
     94                this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2));
     95                this->crossHairOverlay_->show();
     96            }
     97            else
     98                this->crossHairOverlay_->hide();
     99            // TODO: update aimPosition of Pawn
     100        }
    91101
    92102        HumanController::tick(dt);
Note: See TracChangeset for help on using the changeset viewer.