Changeset 5993
- Timestamp:
- Oct 26, 2009, 11:01:39 PM (15 years ago)
- Location:
- code/branches/steering/src/orxonox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/steering/src/orxonox/controllers/Controller.h
r5981 r5993 57 57 { return this->controllableEntity_; } 58 58 virtual void changedControllableEntity() {} 59 virtual void startControl() {}60 virtual void stopControl() {}61 59 62 60 protected: -
code/branches/steering/src/orxonox/controllers/HumanController.cc
r5929 r5993 113 113 } 114 114 115 void HumanController:: rotateYaw(const Vector2& value)115 void HumanController::yaw(const Vector2& value) 116 116 { 117 117 //Hack to enable mouselook in map … … 125 125 } 126 126 127 void HumanController:: rotatePitch(const Vector2& value)127 void HumanController::pitch(const Vector2& value) 128 128 { 129 129 //Hack to enable mouselook in map -
code/branches/steering/src/orxonox/controllers/HumanController.h
r5929 r5993 49 49 static void moveUpDown(const Vector2& value); 50 50 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); } 53 53 static void rotateRoll(const Vector2& value); 54 55 virtual void yaw(const Vector2& value); 56 virtual void pitch(const Vector2& value); 54 57 55 58 static void fire(unsigned int firemode); -
code/branches/steering/src/orxonox/controllers/NewHumanController.cc
r5981 r5993 46 46 namespace orxonox 47 47 { 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);67 48 68 49 CreateUnloadableFactory(NewHumanController); 69 70 NewHumanController* NewHumanController::localController_s = 0;71 50 72 51 NewHumanController::NewHumanController(BaseObject* creator) : HumanController(creator) 73 52 { 74 53 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);81 54 } 82 55 83 56 NewHumanController::~NewHumanController() 84 57 { 85 NewHumanController::localController_s = 0;86 87 58 if( this->isInitialized() ) 88 59 { 89 gameInputState_->setHandler(0);90 InputManager::getInstance().destroyState("humansteering");91 60 } 92 61 } 93 62 94 void NewHumanController::tick(float dt)63 /*void NewHumanController::tick(float dt) 95 64 { 96 65 if (GameMode::playsSound() && NewHumanController::localController_s && NewHumanController::localController_s->controllableEntity_) … … 106 75 COUT(3) << "NewHumanController, Warning: Using a ControllableEntity without Camera" << std::endl; 107 76 } 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; 108 86 } 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) 124 88 { 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; 126 94 } 127 95 -
code/branches/steering/src/orxonox/controllers/NewHumanController.h
r5981 r5993 32 32 #include "OrxonoxPrereqs.h" 33 33 34 //#include "tools/interfaces/Tickable.h"35 34 #include "HumanController.h" 36 #include "core/input/InputHandler.h"37 #include "core/input/InputState.h"38 35 39 36 namespace orxonox 40 37 { 41 class _OrxonoxExport NewHumanController : public HumanController , public InputHandler38 class _OrxonoxExport NewHumanController : public HumanController 42 39 { 43 40 public: … … 45 42 virtual ~NewHumanController(); 46 43 47 virtual void tick(float dt);48 49 v oid startControl();50 v oid stopControl();44 // virtual void tick(float dt); 45 46 virtual void yaw(const Vector2& value); 47 virtual void pitch(const Vector2& value); 51 48 52 49 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_; 58 52 }; 59 53 } -
code/branches/steering/src/orxonox/infos/PlayerInfo.cc
r5981 r5993 158 158 this->bReadyToSpawn_ &= (!this->bSetUnreadyAfterSpawn_); 159 159 160 if (this->controller_) {160 if (this->controller_) 161 161 this->controller_->setControllableEntity(entity); 162 this->controller_->startControl();163 }164 162 165 163 this->changedControllableEntity(); … … 176 174 this->controllableEntityID_ = OBJECTID_UNKNOWN; 177 175 178 if (this->controller_) {176 if (this->controller_) 179 177 this->controller_->setControllableEntity(0); 180 this->controller_->stopControl();181 }182 178 183 179 entity->removePlayer();
Note: See TracChangeset
for help on using the changeset viewer.