Changeset 5981 for code/branches/steering
- Timestamp:
- Oct 21, 2009, 5:17:05 PM (15 years ago)
- Location:
- code/branches/steering/src/orxonox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/steering/src/orxonox/controllers/Controller.h
r5781 r5981 57 57 { return this->controllableEntity_; } 58 58 virtual void changedControllableEntity() {} 59 virtual void startControl() {} 60 virtual void stopControl() {} 59 61 60 62 protected: -
code/branches/steering/src/orxonox/controllers/NewHumanController.cc
r5979 r5981 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Michael Wirth 24 24 * Co-authors: 25 25 * ... … … 28 28 29 29 #include "NewHumanController.h" 30 31 #include "core/input/InputManager.h" 32 #include "core/input/InputState.h" 30 33 31 34 #include "core/CoreIncludes.h" … … 72 75 73 76 NewHumanController::localController_s = this; 77 78 gameInputState_ = InputManager::getInstance().createInputState("humansteering", true, true); 79 gameInputState_->setMouseHandler(this); 80 gameInputState_->setMouseMode(MouseMode::Exclusive); 74 81 } 75 82 … … 77 84 { 78 85 NewHumanController::localController_s = 0; 86 87 if( this->isInitialized() ) 88 { 89 gameInputState_->setHandler(0); 90 InputManager::getInstance().destroyState("humansteering"); 91 } 79 92 } 80 93 … … 95 108 } 96 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) 124 { 125 std::cout << "X: " << static_cast<float>(abs.x) << " Y: " << static_cast<float>(abs.y) << endl; 126 } 127 97 128 } -
code/branches/steering/src/orxonox/controllers/NewHumanController.h
r5979 r5981 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Michael Wirth 24 24 * Co-authors: 25 25 * ... … … 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include "tools/interfaces/Tickable.h"34 //#include "tools/interfaces/Tickable.h" 35 35 #include "HumanController.h" 36 #include "core/input/InputHandler.h" 37 #include "core/input/InputState.h" 36 38 37 39 namespace orxonox 38 40 { 39 class _OrxonoxExport NewHumanController : public HumanController 41 class _OrxonoxExport NewHumanController : public HumanController, public InputHandler 40 42 { 41 43 public: … … 45 47 virtual void tick(float dt); 46 48 49 void startControl(); 50 void stopControl(); 51 47 52 private: 48 53 static NewHumanController* localController_s; 54 InputState* gameInputState_; 55 56 //mouse handler functions 57 void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize); 49 58 }; 50 59 } -
code/branches/steering/src/orxonox/infos/PlayerInfo.cc
r5929 r5981 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 } 162 164 163 165 this->changedControllableEntity(); … … 174 176 this->controllableEntityID_ = OBJECTID_UNKNOWN; 175 177 176 if (this->controller_) 178 if (this->controller_) { 177 179 this->controller_->setControllableEntity(0); 180 this->controller_->stopControl(); 181 } 178 182 179 183 entity->removePlayer();
Note: See TracChangeset
for help on using the changeset viewer.