Changeset 5813
- Timestamp:
- Sep 27, 2009, 7:28:09 PM (15 years ago)
- Location:
- code/branches/core5/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/modules/gamestates/GSLevel.cc
r5806 r5813 48 48 49 49 #include "tools/interfaces/Tickable.h" 50 #include "Radar.h"51 50 #include "CameraManager.h" 52 51 #include "LevelManager.h" … … 67 66 , guiMouseOnlyInputState_(0) 68 67 , guiKeysOnlyInputState_(0) 69 , radar_(0)70 68 , cameraManager_(0) 71 69 { … … 104 102 // create the global CameraManager 105 103 this->cameraManager_ = new CameraManager(GraphicsManager::getInstance().getViewport()); 106 107 // Start the Radar108 this->radar_ = new Radar();109 104 } 110 105 … … 186 181 if (GameMode::isMaster()) 187 182 this->unloadLevel(); 188 189 if (this->radar_)190 {191 this->radar_->destroy();192 this->radar_ = 0;193 }194 183 195 184 if (this->cameraManager_) -
code/branches/core5/src/modules/gamestates/GSLevel.h
r5738 r5813 67 67 InputState* guiMouseOnlyInputState_; //!< input state if we only need the mouse to use the GUI 68 68 InputState* guiKeysOnlyInputState_; //!< input state if we only need the keys to use the GUI 69 Radar* radar_; //!< represents the Radar (not the HUD part)70 69 CameraManager* cameraManager_; //!< camera manager for this level 71 70 PlayerManager* playerManager_; //!< player manager for this level -
code/branches/core5/src/modules/overlays/hud/HUDNavigation.cc
r5738 r5813 39 39 #include "core/CoreIncludes.h" 40 40 #include "core/XMLPort.h" 41 #include "Scene.h" 41 42 #include "Radar.h" 42 43 … … 130 131 SUPER(HUDNavigation, tick, dt); 131 132 132 if (!Radar::getInstance().getFocus()) 133 // Get radar 134 Radar* radar = this->getOwner()->getScene()->getRadar(); 135 136 if (!radar->getFocus()) 133 137 { 134 138 this->overlay_->hide(); … … 150 154 */ 151 155 // transform to screen coordinates 152 Vector3 pos = /*transformationMatrix * */ Radar::getInstance().getFocus()->getRVWorldPosition();156 Vector3 pos = /*transformationMatrix * */radar->getFocus()->getRVWorldPosition(); 153 157 154 158 bool outOfView; -
code/branches/core5/src/orxonox/Radar.cc
r5785 r5813 43 43 namespace orxonox 44 44 { 45 SetConsoleCommand(Radar, cycleNavigationFocus, true).accessLevel(AccessLevel::User);46 SetConsoleCommand(Radar, releaseNavigationFocus, true).accessLevel(AccessLevel::User);47 48 Radar* Radar::instance_s = 0;49 45 50 46 Radar::Radar() … … 52 48 , objectTypeCounter_(0) 53 49 { 54 assert(instance_s == 0);55 instance_s = this;56 57 50 // TODO: make this mapping configurable. Maybe there's a possibility with self configured 58 51 // configValues.. … … 79 72 Radar::~Radar() 80 73 { 81 instance_s = 0;82 74 } 83 75 … … 194 186 } 195 187 } 196 197 198 /*static*/ Radar& Radar::getInstance()199 {200 assert(instance_s);201 return *instance_s;202 }203 204 /*static*/ void Radar::cycleNavigationFocus()205 {206 // avoid using getInstance because of the assert().207 // User might call this fuction even if HUDNavigation doesn't exist.208 if (instance_s)209 instance_s->cycleFocus();210 }211 212 /*static*/ void Radar::releaseNavigationFocus()213 {214 // avoid using getInstance because of the assert().215 // User might call this fuction even if HUDNavigation doesn't exist.216 if (instance_s)217 instance_s->releaseFocus();218 }219 188 } -
code/branches/core5/src/orxonox/Radar.h
r5738 r5813 46 46 namespace orxonox 47 47 { 48 /** 49 @brief This class merely ensures that no one can inherit from Radar. 50 */ 51 class _OrxonoxExport RadarBase 52 { 53 private: 54 friend class Radar; 55 RadarBase() { } 56 }; 57 58 class _OrxonoxExport Radar : public Tickable, private virtual RadarBase 48 class _OrxonoxExport Radar : public Tickable 59 49 { 60 50 public: 61 51 Radar(); 62 ~Radar();52 virtual ~Radar(); 63 53 64 54 virtual void tick(float dt); … … 69 59 void listObjects() const; 70 60 71 static Radar& getInstance(); 72 static Radar* getInstancePtr() { return instance_s; } 73 74 static void cycleNavigationFocus(); 75 static void releaseNavigationFocus(); 61 void releaseFocus(); 62 void cycleFocus(); 76 63 77 64 private: 78 65 Radar(Radar& instance); 79 66 80 void releaseFocus();81 67 void updateFocus(); 82 void cycleFocus();83 68 84 69 ObjectListIterator<RadarViewable> itFocus_; … … 86 71 std::map<std::string, RadarViewable::Shape> objectTypes_; 87 72 int objectTypeCounter_; 88 89 static Radar* instance_s;90 73 }; 91 74 } -
code/branches/core5/src/orxonox/Scene.cc
r5805 r5813 44 44 #include "core/XMLPort.h" 45 45 #include "tools/BulletConversions.h" 46 #include "Radar.h" 46 47 #include "worldentities/WorldEntity.h" 47 48 … … 62 63 this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC); 63 64 this->rootSceneNode_ = this->sceneManager_->getRootSceneNode(); 65 66 this->radar_ = new Radar(); 64 67 } 65 68 else … … 68 71 this->sceneManager_ = new Ogre::DefaultSceneManager(""); 69 72 this->rootSceneNode_ = this->sceneManager_->getRootSceneNode(); 73 74 this->radar_ = 0; 70 75 } 71 76 … … 92 97 else 93 98 delete this->sceneManager_; 99 100 if (this->radar_) 101 this->radar_->destroy(); 94 102 95 103 this->setPhysicalWorld(false); -
code/branches/core5/src/orxonox/Scene.h
r5738 r5813 71 71 { return this->bShadows_; } 72 72 73 inline Radar* getRadar() 74 { return this->radar_; } 75 73 76 virtual void tick(float dt); 74 77 … … 91 94 std::list<BaseObject*> objects_; 92 95 bool bShadows_; 96 Radar* radar_; 93 97 94 98 -
code/branches/core5/src/orxonox/controllers/HumanController.cc
r5738 r5813 36 36 #include "infos/PlayerInfo.h" 37 37 #include "overlays/Map.h" 38 #include "Radar.h" 39 #include "Scene.h" 38 40 39 41 namespace orxonox … … 56 58 SetConsoleCommand(HumanController, dropItems, true); 57 59 SetConsoleCommand(HumanController, useItem, true); 60 SetConsoleCommand(HumanController, cycleNavigationFocus, true); 61 SetConsoleCommand(HumanController, releaseNavigationFocus, true); 58 62 59 63 CreateUnloadableFactory(HumanController); … … 200 204 return NULL; 201 205 } 206 207 void HumanController::cycleNavigationFocus() 208 { 209 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 210 HumanController::localController_s->controllableEntity_->getScene()->getRadar()->cycleFocus(); 211 } 212 213 void HumanController::releaseNavigationFocus() 214 { 215 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 216 HumanController::localController_s->controllableEntity_->getScene()->getRadar()->releaseFocus(); 217 } 202 218 } -
code/branches/core5/src/orxonox/controllers/HumanController.h
r5738 r5813 58 58 static void dropItems(); 59 59 static void useItem(); 60 static void cycleNavigationFocus(); 61 static void releaseNavigationFocus(); 60 62 61 63 static void suicide(); -
code/branches/core5/src/orxonox/interfaces/RadarViewable.cc
r5738 r5813 38 38 #include "worldentities/WorldEntity.h" 39 39 #include "Radar.h" 40 #include "Scene.h" 40 41 #include "overlays/Map.h" 41 42 … … 135 136 void RadarViewable::setRadarObjectDescription(const std::string& str) 136 137 { 137 Radar* radar = Radar::getInstancePtr();138 Radar* radar = this->getWorldEntity()->getScene()->getRadar(); 138 139 if (radar) 139 140 this->radarObjectShape_ = radar->addObjectDescription(str);
Note: See TracChangeset
for help on using the changeset viewer.