Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 26, 2009, 11:01:39 PM (15 years ago)
Author:
scheusso
Message:

Changed input of NewHumanController from InputListener to normal console command (yaw and pitch virtually inherited from HumanPlayer)
removed some unneccessary stuff

Location:
code/branches/steering/src/orxonox/controllers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/steering/src/orxonox/controllers/Controller.h

    r5981 r5993  
    5757                { return this->controllableEntity_; }
    5858            virtual void changedControllableEntity() {}
    59             virtual void startControl() {}
    60             virtual void stopControl() {}
    6159
    6260        protected:
  • code/branches/steering/src/orxonox/controllers/HumanController.cc

    r5929 r5993  
    113113    }
    114114
    115     void HumanController::rotateYaw(const Vector2& value)
     115    void HumanController::yaw(const Vector2& value)
    116116    {
    117117        //Hack to enable mouselook in map
     
    125125    }
    126126
    127     void HumanController::rotatePitch(const Vector2& value)
     127    void HumanController::pitch(const Vector2& value)
    128128    {
    129129        //Hack to enable mouselook in map
  • code/branches/steering/src/orxonox/controllers/HumanController.h

    r5929 r5993  
    4949            static void moveUpDown(const Vector2& value);
    5050
    51             static void rotateYaw(const Vector2& value);
    52             static void rotatePitch(const Vector2& value);
     51            static void rotateYaw(const Vector2& value){ HumanController::localController_s->yaw(value); }
     52            static void rotatePitch(const Vector2& value){ HumanController::localController_s->pitch(value); }
    5353            static void rotateRoll(const Vector2& value);
     54           
     55            virtual void yaw(const Vector2& value);
     56            virtual void pitch(const Vector2& value);
    5457
    5558            static void fire(unsigned int firemode);
  • code/branches/steering/src/orxonox/controllers/NewHumanController.cc

    r5981 r5993  
    4646namespace orxonox
    4747{
    48     SetConsoleCommand(NewHumanController, moveFrontBack, true).setAsInputCommand();
    49     SetConsoleCommand(NewHumanController, moveRightLeft, true).setAsInputCommand();
    50     SetConsoleCommand(NewHumanController, moveUpDown,    true).setAsInputCommand();
    51     SetConsoleCommand(NewHumanController, rotateYaw,     true).setAsInputCommand();
    52     SetConsoleCommand(NewHumanController, rotatePitch,   true).setAsInputCommand();
    53     SetConsoleCommand(NewHumanController, rotateRoll,    true).setAsInputCommand();
    54     SetConsoleCommand(NewHumanController, fire,          true).keybindMode(KeybindMode::OnHold);
    55     SetConsoleCommand(NewHumanController, reload,        true);
    56     SetConsoleCommand(NewHumanController, boost,         true).keybindMode(KeybindMode::OnHold);
    57     SetConsoleCommand(NewHumanController, greet,         true);
    58     SetConsoleCommand(NewHumanController, switchCamera,  true);
    59     SetConsoleCommand(NewHumanController, mouseLook,     true);
    60     SetConsoleCommand(NewHumanController, suicide,       true);
    61     SetConsoleCommand(NewHumanController, addBots,       true).defaultValues(1);
    62     SetConsoleCommand(NewHumanController, killBots,      true).defaultValues(0);
    63     SetConsoleCommand(NewHumanController, dropItems,     true);
    64     SetConsoleCommand(NewHumanController, useItem,       true);
    65     SetConsoleCommand(NewHumanController, cycleNavigationFocus,   true);
    66     SetConsoleCommand(NewHumanController, releaseNavigationFocus, true);
    6748
    6849    CreateUnloadableFactory(NewHumanController);
    69 
    70     NewHumanController* NewHumanController::localController_s = 0;
    7150
    7251    NewHumanController::NewHumanController(BaseObject* creator) : HumanController(creator)
    7352    {
    7453        RegisterObject(NewHumanController);
    75 
    76         NewHumanController::localController_s = this;
    77 
    78         gameInputState_ = InputManager::getInstance().createInputState("humansteering", true, true);
    79         gameInputState_->setMouseHandler(this);
    80         gameInputState_->setMouseMode(MouseMode::Exclusive);
    8154    }
    8255
    8356    NewHumanController::~NewHumanController()
    8457    {
    85         NewHumanController::localController_s = 0;
    86 
    8758        if( this->isInitialized() )
    8859        {
    89             gameInputState_->setHandler(0);
    90             InputManager::getInstance().destroyState("humansteering");
    9160        }
    9261    }
    9362
    94     void NewHumanController::tick(float dt)
     63    /*void NewHumanController::tick(float dt)
    9564    {
    9665        if (GameMode::playsSound() && NewHumanController::localController_s && NewHumanController::localController_s->controllableEntity_)
     
    10675                COUT(3) << "NewHumanController, Warning: Using a ControllableEntity without Camera" << std::endl;
    10776        }
     77    }*/
     78   
     79    void NewHumanController::yaw(const Vector2& value)
     80    {
     81//         SUPER(NewHumanController, yaw, value);
     82        HumanController::yaw(value);
     83       
     84        this->currentYaw_ = value.x;
     85        std::cout << "X: " << static_cast<float>(this->currentPitch_) << " Y: " << static_cast<float>(this->currentYaw_) << endl;
    10886    }
    109 
    110     void NewHumanController::startControl() {
    111         //gameInputState_->setHandler(KeyBinderManager::getInstance().getDefaultAsHandler());
    112         //KeyBinderManager::getInstance().setToDefault();
    113 
    114         InputManager::getInstance().enterState("humansteering");
    115         std::cout << "started control" << endl;
    116     }
    117 
    118     void NewHumanController::stopControl() {
    119         InputManager::getInstance().leaveState("humansteering");
    120         std::cout << "stopped control" << endl;
    121     }
    122 
    123     void NewHumanController::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
     87    void NewHumanController::pitch(const Vector2& value)
    12488    {
    125         std::cout << "X: " << static_cast<float>(abs.x) << " Y: " << static_cast<float>(abs.y) << endl;
     89//         SUPER(NewHumanController, pitch, value);
     90        HumanController::pitch(value);
     91       
     92        this->currentPitch_ = value.x;
     93        std::cout << "X: " << static_cast<float>(this->currentPitch_) << " Y: " << static_cast<float>(this->currentYaw_) << endl;
    12694    }
    12795
  • code/branches/steering/src/orxonox/controllers/NewHumanController.h

    r5981 r5993  
    3232#include "OrxonoxPrereqs.h"
    3333
    34 //#include "tools/interfaces/Tickable.h"
    3534#include "HumanController.h"
    36 #include "core/input/InputHandler.h"
    37 #include "core/input/InputState.h"
    3835
    3936namespace orxonox
    4037{
    41     class _OrxonoxExport NewHumanController : public HumanController, public InputHandler
     38    class _OrxonoxExport NewHumanController : public HumanController
    4239    {
    4340        public:
     
    4542            virtual ~NewHumanController();
    4643
    47             virtual void tick(float dt);
    48 
    49             void startControl();
    50             void stopControl();
     44//             virtual void tick(float dt);
     45           
     46            virtual void yaw(const Vector2& value);
     47            virtual void pitch(const Vector2& value);
    5148
    5249        private:
    53             static NewHumanController* localController_s;
    54             InputState* gameInputState_;
    55 
    56             //mouse handler functions
    57             void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
     50            float                       currentYaw_;
     51            float                       currentPitch_;
    5852    };
    5953}
Note: See TracChangeset for help on using the changeset viewer.