Changeset 1601 for code/branches/hud/src/orxonox
- Timestamp:
- Jun 14, 2008, 6:37:12 PM (16 years ago)
- Location:
- code/branches/hud/src/orxonox
- Files:
-
- 12 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud/src/orxonox/CMakeLists.txt
r1590 r1601 5 5 Settings.cc 6 6 7 console/InGameConsole.cc 8 hud/HUD.cc 9 hud/BarOverlayElement.cc 10 hud/RadarOverlayElement.cc 11 hud/RadarObject.cc 12 hud/Navigation.cc 7 overlays/OrxonoxOverlay.cc 8 overlays/OverlayGroup.cc 9 10 overlays/console/InGameConsole.cc 11 12 overlays/hud/HUDBar.cc 13 overlays/hud/HUDFPSText.cc 14 overlays/hud/HUDNavigation.cc 15 overlays/hud/HUDRTRText.cc 16 overlays/hud/HUDSpeedBar.cc 17 overlays/hud/HUDText.cc 18 overlays/hud/RadarObject.cc 19 overlays/hud/RadarOverlayElement.cc 20 13 21 tolua/tolua_bind.cc 14 22 -
code/branches/hud/src/orxonox/GraphicsEngine.cc
r1590 r1601 51 51 #include "core/ConsoleCommand.h" 52 52 53 #include " console/InGameConsole.h"54 #include " hud/HUD.h"53 #include "overlays/console/InGameConsole.h" 54 #include "overlays/OverlayGroup.h" 55 55 #include "tools/ParticleInterface.h" 56 56 #include "Settings.h" -
code/branches/hud/src/orxonox/Orxonox.cc
r1588 r1601 69 69 70 70 // objects and tools 71 #include " hud/HUD.h"72 #include " console/InGameConsole.h"71 #include "overlays/OverlayGroup.h" 72 #include "overlays/console/InGameConsole.h" 73 73 #include "objects/Tickable.h" 74 74 #include "tools/ParticleInterface.h" … … 335 335 COUT(3) << "Orxonox: Loading HUD" << std::endl; 336 336 337 Level* hud = new Level( "hud/hud.oxh");337 Level* hud = new Level(Settings::getDataPath() + "overlay/hud.oxo"); 338 338 Loader::load(hud); 339 339 … … 451 451 frameTime += evt.timeSinceLastFrame; 452 452 453 // show the current time in the HUD 454 // HUD::getSingleton().setTime(now); 453 // OverlayGroup::getHUD().setTime(now); 455 454 if (mode_ != DEDICATED && frameTime > 0.4f) 456 455 { -
code/branches/hud/src/orxonox/Orxonox.h
r1588 r1601 97 97 // TODO: make this a config-value by creating a config class for orxonox 98 98 float frameSmoothingTime_; 99 //HUD* orxonoxHUD_;100 99 bool bAbort_; //!< aborts the render loop if true 101 100 float timefactor_; //!< A factor to change the gamespeed -
code/branches/hud/src/orxonox/OrxonoxPrereqs.h
r1564 r1601 115 115 class BarOverlayElement; 116 116 class BarOverlayElementFactory; 117 class HUD; 118 class Navigation; 117 class OverlayGroup; 118 class OrxonoxOverlay; 119 class HUDNavigation; 119 120 class RadarObject; 120 121 class RadarOverlayElement; -
code/branches/hud/src/orxonox/objects/SpaceShip.cc
r1590 r1601 49 49 #include "core/ConsoleCommand.h" 50 50 #include "network/Client.h" 51 #include " hud/HUD.h"51 #include "overlays/OverlayGroup.h" 52 52 53 53 namespace orxonox … … 152 152 153 153 if (!this->myShip_) 154 HUD::getSingleton().removeRadarObject(this);154 OverlayGroup::getHUD().removeRadarObject(this); 155 155 } 156 156 } … … 161 161 myShip_=true; 162 162 else 163 HUD::getSingleton().addRadarObject(this, this->getProjectileColour());163 OverlayGroup::getHUD().addRadarObject(this, this->getProjectileColour()); 164 164 } 165 165 if(Model::create()) -
code/branches/hud/src/orxonox/overlays/OrxonoxOverlay.cc
r1600 r1601 28 28 29 29 #include "OrxonoxStableHeaders.h" 30 #include " HUDOverlay.h"30 #include "OrxonoxOverlay.h" 31 31 32 32 #include <OgreOverlayManager.h> … … 37 37 namespace orxonox 38 38 { 39 unsigned int HUDOverlay::hudOverlayCounter_s = 0;39 unsigned int OrxonoxOverlay::hudOverlayCounter_s = 0; 40 40 41 HUDOverlay::HUDOverlay()41 OrxonoxOverlay::OrxonoxOverlay() 42 42 : overlay_(0) 43 43 , windowAspectRatio_(1.0f) … … 47 47 , angle_(0.0f) 48 48 , position_(0.0f, 0.0f) 49 , origin_(0. 5f, 0.5f)49 , origin_(0.0f, 0.0f) 50 50 { 51 RegisterObject( HUDOverlay);51 RegisterObject(OrxonoxOverlay); 52 52 } 53 53 54 void HUDOverlay::XMLPort(Element& xmlElement, XMLPort::Mode mode)54 void OrxonoxOverlay::XMLPort(Element& xmlElement, XMLPort::Mode mode) 55 55 { 56 56 BaseObject::XMLPort(xmlElement, mode); … … 58 58 if (mode == XMLPort::LoadObject) 59 59 { 60 overlay_ = Ogre::OverlayManager::getSingleton().create(" HUDOverlay"60 overlay_ = Ogre::OverlayManager::getSingleton().create("OrxonoxOverlay" 61 61 + convertToString(hudOverlayCounter_s++) + "_" + this->getName()); 62 62 … … 65 65 } 66 66 67 XMLPortParam( HUDOverlay, "correctAspect", setAspectCorrection, getAspectCorrection, xmlElement, mode);68 XMLPortParam( HUDOverlay, "size", setSize, getSize, xmlElement, mode);69 XMLPortParam( HUDOverlay, "rotation", setRotation, getRotation, xmlElement, mode);70 XMLPortParam( HUDOverlay, "origin", setOrigin, getOrigin, xmlElement, mode);71 XMLPortParam( HUDOverlay, "position", setPosition, getPosition, xmlElement, mode);67 XMLPortParam(OrxonoxOverlay, "correctAspect", setAspectCorrection, getAspectCorrection, xmlElement, mode); 68 XMLPortParam(OrxonoxOverlay, "size", setSize, getSize, xmlElement, mode); 69 XMLPortParam(OrxonoxOverlay, "rotation", setRotation, getRotation, xmlElement, mode); 70 XMLPortParam(OrxonoxOverlay, "origin", setOrigin, getOrigin, xmlElement, mode); 71 XMLPortParam(OrxonoxOverlay, "position", setPosition, getPosition, xmlElement, mode); 72 72 73 73 if (mode == XMLPort::LoadObject) … … 81 81 } 82 82 83 HUDOverlay::~HUDOverlay()83 OrxonoxOverlay::~OrxonoxOverlay() 84 84 { 85 85 } 86 86 87 void HUDOverlay::changedVisibility()87 void OrxonoxOverlay::changedVisibility() 88 88 { 89 89 if (this->overlay_) … … 96 96 } 97 97 98 void HUDOverlay::windowResized(int newWidth, int newHeight)98 void OrxonoxOverlay::windowResized(int newWidth, int newHeight) 99 99 { 100 100 this->windowAspectRatio_ = newWidth/(float)newHeight; … … 103 103 } 104 104 105 void HUDOverlay::setAspectCorrection(bool val)105 void OrxonoxOverlay::setAspectCorrection(bool val) 106 106 { 107 107 if (val) … … 126 126 This function can be overriden by any derivative. 127 127 */ 128 void HUDOverlay::sizeChanged()128 void OrxonoxOverlay::sizeChanged() 129 129 { 130 130 this->overlay_->setScale(size_.x * sizeCorrection_.x, size_.y * sizeCorrection_.y); … … 135 135 This function can be overriden by any derivative. 136 136 */ 137 void HUDOverlay::angleChanged()137 void OrxonoxOverlay::angleChanged() 138 138 { 139 139 this->overlay_->setRotate(this->angle_); … … 144 144 This function can be overriden by any derivative. 145 145 */ 146 void HUDOverlay::positionChanged()146 void OrxonoxOverlay::positionChanged() 147 147 { 148 148 Vector2 scroll = (position_ - 0.5 - size_ * (origin_ - 0.5)) * 2.0; -
code/branches/hud/src/orxonox/overlays/OrxonoxOverlay.h
r1600 r1601 27 27 */ 28 28 29 #ifndef _ HUDOverlay_H__30 #define _ HUDOverlay_H__29 #ifndef _OrxonoxOverlay_H__ 30 #define _OrxonoxOverlay_H__ 31 31 32 32 #include "OrxonoxPrereqs.h" … … 39 39 namespace orxonox 40 40 { 41 class _OrxonoxExport HUDOverlay : public BaseObject, public WindowEventListener41 class _OrxonoxExport OrxonoxOverlay : public BaseObject, public WindowEventListener 42 42 { 43 43 public: 44 HUDOverlay();45 virtual ~ HUDOverlay();44 OrxonoxOverlay(); 45 virtual ~OrxonoxOverlay(); 46 46 47 47 virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); … … 113 113 } 114 114 115 #endif /* _ HUDOverlay_H__ */115 #endif /* _OrxonoxOverlay_H__ */ -
code/branches/hud/src/orxonox/overlays/OverlayGroup.cc
r1600 r1601 28 28 29 29 #include "OrxonoxStableHeaders.h" 30 #include " HUD.h"30 #include "OverlayGroup.h" 31 31 32 32 #include <string> … … 44 44 #include "objects/WorldEntity.h" 45 45 #include "GraphicsEngine.h" 46 #include " HUDBar.h"47 #include " RadarObject.h"48 #include " RadarOverlayElement.h"49 #include " Navigation.h"46 #include "hud/HUDBar.h" 47 #include "hud/RadarObject.h" 48 #include "hud/RadarOverlayElement.h" 49 #include "hud/HUDNavigation.h" 50 50 51 51 namespace orxonox 52 52 { 53 CreateFactory( HUD);54 55 SetConsoleCommandShortcut( HUD, cycleNavigationFocus).setAccessLevel(AccessLevel::User);56 SetConsoleCommandShortcut( HUD, releaseNavigationFocus).setAccessLevel(AccessLevel::User);57 SetConsoleCommand( HUD, toggleVisibility, false).setAccessLevel(AccessLevel::User);58 59 HUD* HUD::instance_s = 0;53 CreateFactory(OverlayGroup); 54 55 SetConsoleCommandShortcut(OverlayGroup, cycleNavigationFocus).setAccessLevel(AccessLevel::User); 56 SetConsoleCommandShortcut(OverlayGroup, releaseNavigationFocus).setAccessLevel(AccessLevel::User); 57 SetConsoleCommand(OverlayGroup, toggleVisibility, false).setAccessLevel(AccessLevel::User); 58 59 OverlayGroup* OverlayGroup::hudInstance_s = 0; 60 60 61 61 using namespace Ogre; 62 62 63 HUD::HUD()64 { 65 assert( instance_s == 0);66 instance_s = this;67 RegisterObject( HUD);63 OverlayGroup::OverlayGroup() 64 { 65 assert(hudInstance_s == 0); 66 hudInstance_s = this; 67 RegisterObject(OverlayGroup); 68 68 69 69 // Singleton like in Ogre. Constructor and destructor are public, … … 82 82 } 83 83 84 HUD::~HUD()84 OverlayGroup::~OverlayGroup() 85 85 { 86 86 if (this->isInitialized()) … … 109 109 } 110 110 111 instance_s = 0;112 } 113 114 void HUD::XMLPort(Element& xmlElement, XMLPort::Mode mode)111 hudInstance_s = 0; 112 } 113 114 void OverlayGroup::XMLPort(Element& xmlElement, XMLPort::Mode mode) 115 115 { 116 116 BaseObject::XMLPort(xmlElement, mode); … … 119 119 showRenderTime_ = true; 120 120 121 XMLPortObject( HUD, HUDOverlay, "", addHUDElement, getHUDElement, xmlElement, mode, false, true);121 XMLPortObject(OverlayGroup, OrxonoxOverlay, "", addElement, getElement, xmlElement, mode, false, true); 122 122 123 123 // create Factories … … 156 156 } 157 157 158 void HUD::addHUDElement(HUDOverlay* element)158 void OverlayGroup::addElement(OrxonoxOverlay* element) 159 159 { 160 160 if (hudElements_.find(element->getName()) != hudElements_.end()) … … 166 166 } 167 167 168 HUDOverlay* HUD::getHUDElement(unsigned int index)168 OrxonoxOverlay* OverlayGroup::getElement(unsigned int index) 169 169 { 170 170 if (index < this->hudElements_.size()) 171 171 { 172 std::map<std::string, HUDOverlay*>::const_iterator it = hudElements_.begin();172 std::map<std::string, OrxonoxOverlay*>::const_iterator it = hudElements_.begin(); 173 173 for (unsigned int i = 0; i != index; ++it, ++i) 174 174 ; … … 179 179 } 180 180 181 void HUD::tick(float dt)181 void OverlayGroup::tick(float dt) 182 182 { 183 183 radar_->update(); 184 184 } 185 185 186 void HUD::windowResized(int newWidth, int newHeight)186 void OverlayGroup::windowResized(int newWidth, int newHeight) 187 187 { 188 188 this->radar_->resize(); 189 189 } 190 190 191 void HUD::addRadarObject(WorldEntity* object, const ColourValue& colour){191 void OverlayGroup::addRadarObject(WorldEntity* object, const ColourValue& colour){ 192 192 RadarObject* obj = new RadarObject(container_, object, colour); 193 193 roSet_.insert(roSet_.end(), obj); … … 203 203 } 204 204 205 void HUD::removeRadarObject(WorldEntity* object){205 void OverlayGroup::removeRadarObject(WorldEntity* object){ 206 206 for(std::list<RadarObject*>::iterator it=roSet_.begin(); it!=roSet_.end(); ++it){ 207 207 if ((*it)->getObject() == object) … … 217 217 } 218 218 219 /*static*/ HUD& HUD::getSingleton()220 { 221 assert( instance_s);222 return * instance_s;223 } 224 225 /*static*/ void HUD::toggleVisibility(const std::string& name)226 { 227 if ( HUD::getSingleton().hudElements_.find(name) != HUD::getSingleton().hudElements_.end())228 { 229 HUD::getSingleton().hudElements_[name]->setVisibility(!HUD::getSingleton().hudElements_[name]->isVisible());230 } 231 } 232 233 /*static*/ void HUD::setEnergy(float value){234 HUD::getSingleton().energyBar_->setValue(value);235 } 236 237 /*static*/ void HUD::cycleNavigationFocus()238 { 239 if ( HUD::getSingleton().hudElements_.find("Navigation") != HUD::getSingleton().hudElements_.end())240 { 241 Navigation* navi = dynamic_cast<Navigation*>(HUD::getSingleton().hudElements_["Navigation"]);219 /*static*/ OverlayGroup& OverlayGroup::getHUD() 220 { 221 assert(hudInstance_s); 222 return *hudInstance_s; 223 } 224 225 /*static*/ void OverlayGroup::toggleVisibility(const std::string& name) 226 { 227 if (OverlayGroup::getHUD().hudElements_.find(name) != OverlayGroup::getHUD().hudElements_.end()) 228 { 229 OverlayGroup::getHUD().hudElements_[name]->setVisibility(!OverlayGroup::getHUD().hudElements_[name]->isVisible()); 230 } 231 } 232 233 /*static*/ void OverlayGroup::setEnergy(float value){ 234 OverlayGroup::getHUD().energyBar_->setValue(value); 235 } 236 237 /*static*/ void OverlayGroup::cycleNavigationFocus() 238 { 239 if (OverlayGroup::getHUD().hudElements_.find("Navigation") != OverlayGroup::getHUD().hudElements_.end()) 240 { 241 HUDNavigation* navi = dynamic_cast<HUDNavigation*>(OverlayGroup::getHUD().hudElements_["Navigation"]); 242 242 navi->cycleFocus(); 243 243 } 244 244 } 245 245 246 /*static*/ void HUD::releaseNavigationFocus(){247 // HUD::getSingleton().nav_->releaseFocus();246 /*static*/ void OverlayGroup::releaseNavigationFocus(){ 247 //OverlayGroup::getHUD().nav_->releaseFocus(); 248 248 } 249 249 } -
code/branches/hud/src/orxonox/overlays/OverlayGroup.h
r1600 r1601 28 28 29 29 30 #ifndef _ HUD_H__31 #define _ HUD_H__30 #ifndef _OverlayGroup_H__ 31 #define _OverlayGroup_H__ 32 32 33 33 #include "OrxonoxPrereqs.h" … … 38 38 #include "objects/Tickable.h" 39 39 #include "util/Math.h" 40 #include " OverlayElementFactories.h"40 #include "hud/OverlayElementFactories.h" 41 41 #include "tools/WindowEventListener.h" 42 42 … … 44 44 { 45 45 class HUDBar; 46 class HUDOverlay;46 class OrxonoxOverlay; 47 47 48 class _OrxonoxExport HUD: public BaseObject, public TickableReal, public WindowEventListener48 class _OrxonoxExport OverlayGroup : public BaseObject, public TickableReal, public WindowEventListener 49 49 { 50 50 public: 51 HUD();52 ~ HUD();51 OverlayGroup(); 52 ~OverlayGroup(); 53 53 54 54 virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); … … 64 64 { return this->roSet_; } 65 65 66 static HUD& getSingleton();66 static OverlayGroup& getHUD(); 67 67 68 68 static void setEnergy(float value); … … 72 72 73 73 private: 74 HUD(const HUD& instance);74 OverlayGroup(const OverlayGroup& instance); 75 75 76 void add HUDElement(HUDOverlay* element);77 HUDOverlay* getHUDElement(unsigned int index);76 void addElement(OrxonoxOverlay* element); 77 OrxonoxOverlay* getElement(unsigned int index); 78 78 79 79 void windowResized(int newWidth, int newHeight); 80 80 81 std::map<std::string, HUDOverlay*> hudElements_;81 std::map<std::string, OrxonoxOverlay*> hudElements_; 82 82 83 83 std::list<RadarObject*> roSet_; … … 92 92 BarOverlayElement* speedoBar_; 93 93 RadarOverlayElement* radar_; 94 Navigation* nav_;94 HUDNavigation* nav_; 95 95 96 96 bool showFPS_; 97 97 bool showRenderTime_; 98 98 99 static HUD* instance_s;99 static OverlayGroup* hudInstance_s; 100 100 }; 101 101 } 102 102 103 #endif /* _ HUD_H__ */103 #endif /* _OverlayGroup_H__ */ -
code/branches/hud/src/orxonox/overlays/console/InGameConsole.cc
r1599 r1601 378 378 this->consoleOverlayNoise_->setWidth((int) this->windowW_ * this->relativeWidth - 10); 379 379 this->consoleOverlayNoise_->setHeight((int) this->windowH_ * this->relativeHeight - 5); 380 this->consoleOverlayNoise_->setTiling(consoleOverlayNoise_->getWidth() / 80.0f * this->noiseSize_, consoleOverlayNoise_->getHeight() / 80.0f * this->noiseSize_);380 this->consoleOverlayNoise_->setTiling(consoleOverlayNoise_->getWidth() / (50.0f * this->noiseSize_), consoleOverlayNoise_->getHeight() / (50.0f * this->noiseSize_)); 381 381 382 382 // now adjust the text lines... -
code/branches/hud/src/orxonox/overlays/hud/HUDBar.cc
r1599 r1601 73 73 void HUDBar::XMLPort(Element& xmlElement, XMLPort::Mode mode) 74 74 { 75 HUDOverlay::XMLPort(xmlElement, mode);75 OrxonoxOverlay::XMLPort(xmlElement, mode); 76 76 77 77 if (mode == XMLPort::LoadObject) -
code/branches/hud/src/orxonox/overlays/hud/HUDBar.h
r1599 r1601 38 38 39 39 #include "util/Math.h" 40 #include " HUDOverlay.h"40 #include "overlays/OrxonoxOverlay.h" 41 41 42 42 namespace orxonox 43 43 { 44 class _OrxonoxExport HUDBar : public HUDOverlay44 class _OrxonoxExport HUDBar : public OrxonoxOverlay 45 45 { 46 46 public: -
code/branches/hud/src/orxonox/overlays/hud/HUDNavigation.cc
r1599 r1601 28 28 29 29 #include "OrxonoxStableHeaders.h" 30 #include " Navigation.h"30 #include "HUDNavigation.h" 31 31 32 32 #include <OgreOverlayManager.h> … … 38 38 #include "objects/Projectile.h" 39 39 #include "objects/CameraHandler.h" 40 #include " HUD.h"40 #include "overlays/OverlayGroup.h" 41 41 #include "RadarObject.h" 42 42 #include "RadarOverlayElement.h" … … 46 46 namespace orxonox 47 47 { 48 CreateFactory( Navigation);48 CreateFactory(HUDNavigation); 49 49 50 50 using namespace Ogre; 51 51 52 Navigation::Navigation()52 HUDNavigation::HUDNavigation() 53 53 : container_(0) 54 54 , navMarker_(0) … … 57 57 , focus_(0) 58 58 { 59 RegisterObject( Navigation);60 } 61 62 Navigation::~Navigation()59 RegisterObject(HUDNavigation); 60 } 61 62 HUDNavigation::~HUDNavigation() 63 63 { 64 64 if (this->isInitialized()) … … 75 75 } 76 76 77 void Navigation::XMLPort(Element& xmlElement, XMLPort::Mode mode)78 { 79 HUDOverlay::XMLPort(xmlElement, mode);77 void HUDNavigation::XMLPort(Element& xmlElement, XMLPort::Mode mode) 78 { 79 OrxonoxOverlay::XMLPort(xmlElement, mode); 80 80 81 81 if (mode == XMLPort::LoadObject) … … 118 118 } 119 119 120 XMLPortParam( Navigation, "font", setFont, getFont, xmlElement, mode);121 XMLPortParam( Navigation, "textsize", setTextSize, getTextSize, xmlElement, mode);122 XMLPortParam( Navigation, "navmarkersize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode);123 XMLPortParam( Navigation, "aimmarkersize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode);120 XMLPortParam(HUDNavigation, "font", setFont, getFont, xmlElement, mode); 121 XMLPortParam(HUDNavigation, "textsize", setTextSize, getTextSize, xmlElement, mode); 122 XMLPortParam(HUDNavigation, "navmarkersize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode); 123 XMLPortParam(HUDNavigation, "aimmarkersize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode); 124 124 125 125 if (mode == XMLPort::LoadObject) … … 129 129 } 130 130 131 void Navigation::setNavMarkerSize(float size)131 void HUDNavigation::setNavMarkerSize(float size) 132 132 { 133 133 this->navMarkerSize_ = size; 134 134 } 135 135 136 float Navigation::getNavMarkerSize() const136 float HUDNavigation::getNavMarkerSize() const 137 137 { 138 138 return this->navMarkerSize_; 139 139 } 140 140 141 void Navigation::setAimMarkerSize(float size)141 void HUDNavigation::setAimMarkerSize(float size) 142 142 { 143 143 this->aimMarkerSize_ = size; 144 144 } 145 145 146 float Navigation::getAimMarkerSize() const146 float HUDNavigation::getAimMarkerSize() const 147 147 { 148 148 return this->aimMarkerSize_; 149 149 } 150 150 151 void Navigation::setFont(const std::string& font)151 void HUDNavigation::setFont(const std::string& font) 152 152 { 153 153 if (this->navText_ && font != "") … … 155 155 } 156 156 157 std::string Navigation::getFont() const157 std::string HUDNavigation::getFont() const 158 158 { 159 159 if (this->navText_) … … 163 163 } 164 164 165 void Navigation::setTextSize(float size)165 void HUDNavigation::setTextSize(float size) 166 166 { 167 167 if (this->navText_ && size >= 0.0f) … … 169 169 } 170 170 171 float Navigation::getTextSize() const171 float HUDNavigation::getTextSize() const 172 172 { 173 173 if (this->navText_) … … 177 177 } 178 178 179 void Navigation::tick(float dt)179 void HUDNavigation::tick(float dt) 180 180 { 181 181 if (!focus_) … … 185 185 } 186 186 187 void Navigation::updateMarker()187 void HUDNavigation::updateMarker() 188 188 { 189 189 // set text … … 291 291 } 292 292 293 void Navigation::cycleFocus()293 void HUDNavigation::cycleFocus() 294 294 { 295 295 if (!focus_) … … 298 298 float distance = (unsigned int) -1; 299 299 Vector3 shipPos = SpaceShip::getLocalShip()->getPosition(); 300 it_ = HUD::getSingleton().getRadarObjects().begin();301 302 for (std::list<RadarObject*>::iterator it = HUD::getSingleton().getRadarObjects().begin(); it != HUD::getSingleton().getRadarObjects().end(); ++it)300 it_ = OverlayGroup::getHUD().getRadarObjects().begin(); 301 302 for (std::list<RadarObject*>::iterator it = OverlayGroup::getHUD().getRadarObjects().begin(); it != OverlayGroup::getHUD().getRadarObjects().end(); ++it) 303 303 { 304 304 float newdist = (*it)->getPosition().squaredDistance(shipPos); … … 310 310 } 311 311 312 if (it_ != HUD::getSingleton().getRadarObjects().end())312 if (it_ != OverlayGroup::getHUD().getRadarObjects().end()) 313 313 { 314 314 focus_ = *it_; 315 315 316 316 // move the focused object to the begin of the list, so we will iterate through all other objects when cycling 317 HUD::getSingleton().getRadarObjects().erase(it_);318 HUD::getSingleton().getRadarObjects().insert(HUD::getSingleton().getRadarObjects().begin(), focus_);319 it_ = HUD::getSingleton().getRadarObjects().begin();320 } 321 } 322 else if (it_ != HUD::getSingleton().getRadarObjects().end())317 OverlayGroup::getHUD().getRadarObjects().erase(it_); 318 OverlayGroup::getHUD().getRadarObjects().insert(OverlayGroup::getHUD().getRadarObjects().begin(), focus_); 319 it_ = OverlayGroup::getHUD().getRadarObjects().begin(); 320 } 321 } 322 else if (it_ != OverlayGroup::getHUD().getRadarObjects().end()) 323 323 { 324 324 focus_->resetMaterial(); 325 325 ++it_; 326 if (it_ != HUD::getSingleton().getRadarObjects().end())326 if (it_ != OverlayGroup::getHUD().getRadarObjects().end()) 327 327 focus_ = *it_; 328 328 else … … 336 336 } 337 337 338 void Navigation::updateFocus()338 void HUDNavigation::updateFocus() 339 339 { 340 340 if (focus_) … … 349 349 } 350 350 351 void Navigation::releaseFocus()351 void HUDNavigation::releaseFocus() 352 352 { 353 353 this->focus_ = 0; … … 355 355 } 356 356 357 float Navigation::getDist2Focus() const357 float HUDNavigation::getDist2Focus() const 358 358 { 359 359 if (focus_) … … 363 363 } 364 364 365 void Navigation::sizeChanged()365 void HUDNavigation::sizeChanged() 366 366 { 367 367 float xScale = this->getActualSize().x; -
code/branches/hud/src/orxonox/overlays/hud/HUDNavigation.h
r1599 r1601 27 27 */ 28 28 29 #ifndef _ Navigation_H__30 #define _ Navigation_H__29 #ifndef _HUDNavigation_H__ 30 #define _HUDNavigation_H__ 31 31 32 32 #include "OrxonoxPrereqs.h" … … 35 35 #include <OgreTextAreaOverlayElement.h> 36 36 #include <OgrePanelOverlayElement.h> 37 #include " HUDOverlay.h"37 #include "overlays/OrxonoxOverlay.h" 38 38 #include "util/Math.h" 39 39 40 40 namespace orxonox 41 41 { 42 class _OrxonoxExport Navigation : public HUDOverlay, public Tickable42 class _OrxonoxExport HUDNavigation : public OrxonoxOverlay, public Tickable 43 43 { 44 44 public: 45 Navigation();46 virtual ~ Navigation();45 HUDNavigation(); 46 virtual ~HUDNavigation(); 47 47 48 48 virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); … … 88 88 } 89 89 90 #endif /* _ Navigation_H__ */90 #endif /* _HUDNavigation_H__ */ -
code/branches/hud/src/orxonox/overlays/hud/HUDText.cc
r1599 r1601 60 60 void HUDText::XMLPort(Element& xmlElement, XMLPort::Mode mode) 61 61 { 62 HUDOverlay::XMLPort(xmlElement, mode);62 OrxonoxOverlay::XMLPort(xmlElement, mode); 63 63 64 64 if (mode == XMLPort::LoadObject) -
code/branches/hud/src/orxonox/overlays/hud/HUDText.h
r1599 r1601 37 37 38 38 #include "util/Math.h" 39 #include " HUDOverlay.h"39 #include "overlays/OrxonoxOverlay.h" 40 40 41 41 namespace orxonox 42 42 { 43 class _OrxonoxExport HUDText : public HUDOverlay43 class _OrxonoxExport HUDText : public OrxonoxOverlay 44 44 { 45 45 public: -
code/branches/hud/src/orxonox/overlays/hud/RadarOverlayElement.cc
r1599 r1601 41 41 #include "GraphicsEngine.h" 42 42 #include "RadarObject.h" 43 #include " HUD.h"43 #include "overlays/OverlayGroup.h" 44 44 45 45 namespace orxonox … … 77 77 void RadarOverlayElement::update() { 78 78 // iterate through all RadarObjects 79 for(std::list<RadarObject*>::iterator it= HUD::getSingleton().getRadarObjects().begin(); it!=HUD::getSingleton().getRadarObjects().end(); it++)79 for(std::list<RadarObject*>::iterator it=OverlayGroup::getHUD().getRadarObjects().begin(); it!=OverlayGroup::getHUD().getRadarObjects().end(); it++) 80 80 { 81 81 // calc position on radar... … … 101 101 COUT(3) << "List of RadarObjects:\n"; 102 102 // iterate through all Radar Objects 103 for(std::list<RadarObject*>::const_iterator it= HUD::getSingleton().getRadarObjects().begin(); it!=HUD::getSingleton().getRadarObjects().end(); ++it){103 for(std::list<RadarObject*>::const_iterator it=OverlayGroup::getHUD().getRadarObjects().begin(); it!=OverlayGroup::getHUD().getRadarObjects().end(); ++it){ 104 104 COUT(3) << i++ << ": " << (*it)->getPosition() << std::endl; 105 105 }
Note: See TracChangeset
for help on using the changeset viewer.