Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 21, 2009, 5:17:05 PM (15 years ago)
Author:
wirthmi
Message:

Made NewHumanController an InputHandler so we can control the crosshair.

File:
1 edited

Legend:

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

    r5979 r5981  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Michael Wirth
    2424 *   Co-authors:
    2525 *      ...
     
    2828
    2929#include "NewHumanController.h"
     30
     31#include "core/input/InputManager.h"
     32#include "core/input/InputState.h"
    3033
    3134#include "core/CoreIncludes.h"
     
    7275
    7376        NewHumanController::localController_s = this;
     77
     78        gameInputState_ = InputManager::getInstance().createInputState("humansteering", true, true);
     79        gameInputState_->setMouseHandler(this);
     80        gameInputState_->setMouseMode(MouseMode::Exclusive);
    7481    }
    7582
     
    7784    {
    7885        NewHumanController::localController_s = 0;
     86
     87        if( this->isInitialized() )
     88        {
     89            gameInputState_->setHandler(0);
     90            InputManager::getInstance().destroyState("humansteering");
     91        }
    7992    }
    8093
     
    95108    }
    96109
     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)
     124    {
     125        std::cout << "X: " << static_cast<float>(abs.x) << " Y: " << static_cast<float>(abs.y) << endl;
     126    }
     127
    97128}
Note: See TracChangeset for help on using the changeset viewer.