Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6001


Ignore:
Timestamp:
Oct 28, 2009, 2:38:10 PM (15 years ago)
Author:
wirthmi
Message:

Added a crosshair overlay.

Location:
code/branches/steering/src/orxonox
Files:
3 edited

Legend:

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

    r5993 r6001  
    5252    {
    5353        RegisterObject(NewHumanController);
     54
     55        CrossHairOverlay = new OrxonoxOverlay(this);
     56        CrossHairOverlay->setBackgroundMaterial("Orxonox/Crosshair3");
     57        CrossHairOverlay->setSize(Vector2(0.08,0.08));
     58        CrossHairOverlay->show();
    5459    }
    5560
     
    5964        {
    6065        }
     66    }
     67
     68    void NewHumanController::tick(float dt) {
     69        CrossHairOverlay->setPosition(Vector2(static_cast<float>(this->currentYaw_), static_cast<float>(this->currentPitch_)));
     70
     71        HumanController::tick(dt);
    6172    }
    6273
     
    8394       
    8495        this->currentYaw_ = value.x;
    85         std::cout << "X: " << static_cast<float>(this->currentPitch_) << " Y: " << static_cast<float>(this->currentYaw_) << endl;
     96        std::cout << "Y: " << static_cast<float>(this->currentPitch_) << " X: " << static_cast<float>(this->currentYaw_) << endl;
    8697    }
    8798    void NewHumanController::pitch(const Vector2& value)
     
    91102       
    92103        this->currentPitch_ = value.x;
    93         std::cout << "X: " << static_cast<float>(this->currentPitch_) << " Y: " << static_cast<float>(this->currentYaw_) << endl;
     104        std::cout << "Y: " << static_cast<float>(this->currentPitch_) << " X: " << static_cast<float>(this->currentYaw_) << endl;
    94105    }
    95106
  • code/branches/steering/src/orxonox/controllers/NewHumanController.h

    r5993 r6001  
    3333
    3434#include "HumanController.h"
     35#include "overlays/OrxonoxOverlay.h"
    3536
    3637namespace orxonox
     
    4243            virtual ~NewHumanController();
    4344
    44 //             virtual void tick(float dt);
     45            virtual void tick(float dt);
    4546           
    4647            virtual void yaw(const Vector2& value);
     
    5051            float                       currentYaw_;
    5152            float                       currentPitch_;
     53            OrxonoxOverlay              *CrossHairOverlay;
    5254    };
    5355}
  • code/branches/steering/src/orxonox/overlays/OrxonoxOverlay.h

    r5929 r6001  
    155155        static void rotateOverlay(const std::string& name, const Degree& angle);
    156156
     157        void setBackgroundMaterial(const std::string& material);
     158        const std::string& getBackgroundMaterial() const;
     159
    157160        virtual void changedVisibility();
    158161
     
    187190        virtual void positionChanged();
    188191
    189         void setBackgroundMaterial(const std::string& material);
    190         const std::string& getBackgroundMaterial() const;
    191 
    192192        Ogre::Overlay* overlay_;                   //!< The overlay the entire class is about.
    193193        Ogre::PanelOverlayElement* background_;    //!< Background image (blank per default).
Note: See TracChangeset for help on using the changeset viewer.