Changeset 6417 for code/trunk/src/modules/overlays
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/overlays/GUIOverlay.cc
r5980 r6417 62 62 { 63 63 SUPER(GUIOverlay, changedVisibility); 64 64 65 65 //Setting player now. 66 66 if( this->getOwner() ) … … 69 69 if (this->isVisible()) 70 70 { 71 std::string str; 72 std::stringstream out; 71 std::ostringstream out; 73 72 out << reinterpret_cast<long>(this); 74 str = out.str(); 75 GUIManager::getInstance().executeCode("showCursor()"); 76 InputManager::getInstance().enterState("guiMouseOnly"); 77 GUIManager::getInstance().executeCode("showGUI(\"" + this->guiName_ + "\", " + str + ")"); 73 const std::string& str = out.str(); 74 COUT(1) << "GUIManager ptr: " << str << std::endl; 75 GUIManager::getInstance().showGUIExtra(this->guiName_, str); 78 76 79 77 COUT(3) << "Showing GUI " << this->guiName_ << std::endl; … … 81 79 else 82 80 { 83 GUIManager::getInstance().executeCode("hideGUI(\"" + this->guiName_ + "\")"); 84 GUIManager::getInstance().executeCode("hideCursor()"); 85 InputManager::getInstance().leaveState("guiMouseOnly"); 81 GUIManager::hideGUI(this->guiName_); 86 82 COUT(3) << "Hiding GUI " << this->guiName_ << std::endl; 87 83 } -
code/trunk/src/modules/overlays/OverlayText.cc
r5781 r6417 134 134 void OverlayText::setFont(const std::string& font) 135 135 { 136 if ( font != "")136 if (!font.empty()) 137 137 this->text_->setFontName(font); 138 138 } -
code/trunk/src/modules/overlays/hud/ChatOverlay.cc
r5929 r6417 33 33 34 34 #include "util/Convert.h" 35 #include "util/ UTFStringConversions.h"35 #include "util/DisplayStringConversions.h" 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/ConfigValueIncludes.h" … … 86 86 } 87 87 88 this->messages_.push_back(multi_cast<Ogre:: UTFString>(text));88 this->messages_.push_back(multi_cast<Ogre::DisplayString>(text)); 89 89 COUT(0) << "Chat: " << text << std::endl; 90 90 … … 110 110 this->text_->setCaption(""); 111 111 112 for (std::list<Ogre:: UTFString>::reverse_iterator it = this->messages_.rbegin(); it != this->messages_.rend(); ++it)112 for (std::list<Ogre::DisplayString>::reverse_iterator it = this->messages_.rbegin(); it != this->messages_.rend(); ++it) 113 113 { 114 114 this->text_->setCaption(this->text_->getCaption() + "\n" + (*it)); -
code/trunk/src/modules/overlays/hud/ChatOverlay.h
r5929 r6417 33 33 34 34 #include <list> 35 #include <Ogre UTFString.h>35 #include <OgreOverlayElement.h> 36 36 37 37 #include "network/ChatListener.h" … … 51 51 virtual void incomingChat(const std::string& message, unsigned int senderID); 52 52 53 std::list<Ogre:: UTFString> messages_;53 std::list<Ogre::DisplayString> messages_; 54 54 55 55 private: -
code/trunk/src/modules/overlays/hud/HUDBar.cc
r5929 r6417 67 67 68 68 HUDBar::HUDBar(BaseObject* creator) 69 : OrxonoxOverlay(creator) 69 : OrxonoxOverlay(creator), right2Left_(false), autoColour_(false) 70 70 { 71 71 RegisterObject(HUDBar); 72 72 73 73 // create new material 74 std::stringmaterialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);74 const std::string& materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++); 75 75 Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialname, "General")); 76 76 material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); … … 85 85 86 86 this->value_ = 1.0f; // initielize with 1.0f to trigger a change when calling setValue(0.0f) on the line below 87 this->setAutoColour(true); 87 88 this->setValue(0.0f); // <-- 88 89 this->setRightToLeft(false); 89 this->setAutoColour(true);90 90 this->currentColour_ = ColourValue::White; 91 91 … … 122 122 { 123 123 ColourValue colour1(0, 0, 0, 1); 124 ColourValue colour2 = (*this->colours_.rbegin()).second;124 ColourValue colour2 = this->colours_.rbegin()->second; 125 125 float value1(0); 126 float value2 = (*this->colours_.rbegin()).first;126 float value2 = this->colours_.rbegin()->first; 127 127 for (std::map<float, ColourValue>::reverse_iterator it = this->colours_.rbegin(); it != this->colours_.rend(); ++it) 128 128 { 129 129 colour1 = colour2; 130 130 value1 = value2; 131 colour2 = (*it).second;132 value2 = (*it).first;131 colour2 = it->second; 132 value2 = it->first; 133 133 134 134 if (value2 < this->value_) -
code/trunk/src/modules/overlays/hud/HUDHealthBar.h
r6054 r6417 53 53 54 54 inline void setTextFont(const std::string& font) 55 { if ( font != "") { this->textoverlay_->setFont(font); } }55 { if (!font.empty()) { this->textoverlay_->setFont(font); } } 56 56 inline const std::string& getTextFont() const 57 57 { return this->textoverlay_->getFont(); } -
code/trunk/src/modules/overlays/hud/HUDNavigation.cc
r5929 r6417 30 30 31 31 #include <string> 32 #include <OgreCamera.h> 32 33 #include <OgreOverlayManager.h> 33 34 #include <OgreTextAreaOverlayElement.h> … … 35 36 36 37 #include "util/Math.h" 37 #include "util/StringUtils.h"38 38 #include "util/Convert.h" 39 39 #include "core/CoreIncludes.h" 40 40 #include "core/XMLPort.h" 41 #include "CameraManager.h" 41 42 #include "Scene.h" 42 43 #include "Radar.h" 44 #include "graphics/Camera.h" 45 #include "controllers/HumanController.h" 46 #include "worldentities/pawns/Pawn.h" 43 47 44 48 namespace orxonox … … 60 64 navMarker_->setMaterialName("Orxonox/NavArrows"); 61 65 66 /* 62 67 // create aim marker 63 68 aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() … … 70 75 setNavMarkerSize(0.05f); 71 76 setAimMarkerSize(0.04f); 77 */ 72 78 73 79 background_->addChild(navMarker_); 74 background_->addChild(aimMarker_);80 // background_->addChild(aimMarker_); 75 81 background_->addChild(navText_); 76 82 … … 85 91 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navMarker_); 86 92 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navText_); 87 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_);93 // Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_); 88 94 } 89 95 } … … 96 102 XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode); 97 103 XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode); 98 XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode);104 // XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode); 99 105 } 100 106 101 107 void HUDNavigation::setFont(const std::string& font) 102 108 { 103 if (this->navText_ && font != "")109 if (this->navText_ && !font.empty()) 104 110 this->navText_->setFontName(font); 105 111 } … … 149 155 float textLength = multi_cast<std::string>(dist).size() * navText_->getCharHeight() * 0.3; 150 156 151 /* 152 Ogre::Camera* navCam = SpaceShip::getLocalShip()->getCamera()->cam_;153 Matrix4 transformationMatrix = navCam->getProjectionMatrix() * navCam->getViewMatrix();154 */ 157 orxonox::Camera* cam = CameraManager::getInstance().getActiveCamera(); 158 if (!cam) 159 return; 160 const Matrix4& transform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 155 161 // transform to screen coordinates 156 Vector3 pos = /*transformationMatrix * */radar->getFocus()->getRVWorldPosition();162 Vector3 pos = transform * radar->getFocus()->getRVWorldPosition(); 157 163 158 164 bool outOfView; … … 172 178 { 173 179 // object is not in view 174 aimMarker_->hide();180 // aimMarker_->hide(); 175 181 176 182 if (!wasOutOfView_) … … 227 233 // object is in view 228 234 /* 229 Vector3 aimpos = transform ationMatrix* getPredictedPosition(SpaceShip::getLocalShip()->getPosition(),235 Vector3 aimpos = transform * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(), 230 236 Projectile::getSpeed(), Radar::getInstance().getFocus()->getRVWorldPosition(), Radar::getInstance().getFocus()->getRVOrientedVelocity()); 231 237 */ … … 241 247 navMarker_->setTop((-pos.y + 1.0 - navMarker_->getHeight()) * 0.5); 242 248 249 /* 243 250 aimMarker_->show(); 244 /*245 251 aimMarker_->setLeft((aimpos.x + 1.0 - aimMarker_->getWidth()) * 0.5); 246 252 aimMarker_->setTop((-aimpos.y + 1.0 - aimMarker_->getHeight()) * 0.5); … … 253 259 float HUDNavigation::getDist2Focus() const 254 260 { 255 /* 256 if (Radar::getInstance().getFocus()) 257 return (Radar::getInstance().getFocus()->getRVWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length(); 258 else 259 */ 261 Radar* radar = this->getOwner()->getScene()->getRadar(); 262 if (radar->getFocus() && HumanController::getLocalControllerEntityAsPawn()) 263 return (radar->getFocus()->getRVWorldPosition() - HumanController::getLocalControllerEntityAsPawn()->getWorldPosition()).length(); 264 else 260 265 return 0; 261 266 } … … 267 272 void HUDNavigation::sizeChanged() 268 273 { 269 // use size to compensate for a pspect ratio if enabled.274 // use size to compensate for aspect ratio if enabled. 270 275 float xScale = this->getActualSize().x; 271 276 float yScale = this->getActualSize().y; 272 277 if (this->navMarker_) 273 278 navMarker_->setDimensions(navMarkerSize_ * xScale, navMarkerSize_ * yScale); 279 /* 274 280 if (this->aimMarker_) 275 281 aimMarker_->setDimensions(aimMarkerSize_ * xScale, aimMarkerSize_ * yScale); 282 */ 276 283 if (this->navText_) 277 284 navText_->setCharHeight(navText_->getCharHeight() * yScale); -
code/trunk/src/modules/overlays/hud/HUDNavigation.h
r5781 r6417 56 56 float getNavMarkerSize() const { return this->navMarkerSize_; } 57 57 58 /* 58 59 void setAimMarkerSize(float size) { this->aimMarkerSize_ = size; this->sizeChanged(); } 59 60 float getAimMarkerSize() const { return this->aimMarkerSize_; } 61 */ 60 62 61 63 void setTextSize(float size); … … 71 73 Ogre::PanelOverlayElement* navMarker_; //!< the panel used to show the arrow and the target marker 72 74 float navMarkerSize_; //!< One paramter size of the navigation marker 75 /* 73 76 Ogre::PanelOverlayElement* aimMarker_; //!< Panel used to show the aim Marker 74 77 float aimMarkerSize_; //!< One paramter size of the aim marker 78 */ 75 79 Ogre::TextAreaOverlayElement* navText_; //!< Text overlay to display the target distance 76 80 bool wasOutOfView_; //!< Performance booster variable: setMaterial is not cheap -
code/trunk/src/modules/overlays/hud/HUDRadar.cc
r5781 r6417 126 126 panel = *itRadarDots_; 127 127 ++itRadarDots_; 128 std::stringmaterialName = TextureGenerator::getMaterialName(128 const std::string& materialName = TextureGenerator::getMaterialName( 129 129 shapeMaterials_[object->getRadarObjectShape()], object->getRadarObjectColour()); 130 130 if (materialName != panel->getMaterialName()) -
code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.cc
r5929 r6417 71 71 if (this->owner_) 72 72 { 73 std::string bases1 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ")";74 std::string bases2 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ")";73 const std::string& bases1 = '(' + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ')'; 74 const std::string& bases2 = '(' + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ')'; 75 75 76 std::stringscore1 = multi_cast<std::string>(this->owner_->getTeamPoints(0));77 std::stringscore2 = multi_cast<std::string>(this->owner_->getTeamPoints(1));76 const std::string& score1 = multi_cast<std::string>(this->owner_->getTeamPoints(0)); 77 const std::string& score2 = multi_cast<std::string>(this->owner_->getTeamPoints(1)); 78 78 79 79 std::string output1; … … 99 99 } 100 100 101 std::string output = "";101 std::string output; 102 102 if (this->bShowBases_ || this->bShowScore_) 103 103 { 104 104 if (this->bShowLeftTeam_ && this->bShowRightTeam_) 105 output = output1 + ":"+ output2;105 output = output1 + ':' + output2; 106 106 else if (this->bShowLeftTeam_ || this->bShowRightTeam_) 107 107 output = output1 + output2; -
code/trunk/src/modules/overlays/hud/UnderAttackHealthBar.cc
r6054 r6417 94 94 } 95 95 } 96 96 97 97 void UnderAttackHealthBar::changedOverlayGroup() 98 98 { 99 99 SUPER(UnderAttackHealthBar, changedOverlayGroup); 100 100 101 101 this->getOverlayGroup()->addElement(this->text_.get()); 102 102 } -
code/trunk/src/modules/overlays/stats/CreateLines.cc
r5980 r6417 94 94 this->background_->changedVisibility(); 95 95 } 96 96 97 97 void CreateLines::setOverlayGroup( OverlayGroup* group ) 98 98 {
Note: See TracChangeset
for help on using the changeset viewer.