- Timestamp:
- Jun 26, 2008, 1:23:48 PM (16 years ago)
- Location:
- code/branches/hud/src/orxonox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud/src/orxonox/Orxonox.cc
r1621 r1623 441 441 unsigned long frameCount = 0; 442 442 443 const unsigned long refreshTime = 3000000; 443 // TODO: this would very well fit into a configValue 444 const unsigned long refreshTime = 200000; 444 445 unsigned long refreshStartTime = 0; 445 446 unsigned long tickTime = 0; -
code/branches/hud/src/orxonox/overlays/OrxonoxOverlay.cc
r1622 r1623 291 291 @param name 292 292 The name of the overlay defined BaseObject::setName() (usually done with the "name" 293 attribute in the xml file .293 attribute in the xml file). 294 294 */ 295 295 /*static*/ void OrxonoxOverlay::scaleOverlay(const std::string& name, float scale) … … 305 305 @param name 306 306 The name of the overlay defined BaseObject::setName() (usually done with the "name" 307 attribute in the xml file .307 attribute in the xml file). 308 308 */ 309 309 /*static*/ void OrxonoxOverlay::scrollOverlay(const std::string& name, const Vector2& scroll) … … 319 319 @param name 320 320 The name of the overlay defined BaseObject::setName() (usually done with the "name" 321 attribute in the xml file .321 attribute in the xml file). 322 322 */ 323 323 /*static*/ void OrxonoxOverlay::rotateOverlay(const std::string& name, const Degree& angle) -
code/branches/hud/src/orxonox/overlays/OverlayGroup.cc
r1616 r1623 27 27 */ 28 28 29 /** 30 @file 31 @brief Definition of the OverlayGroup class. 32 */ 33 29 34 #include "OrxonoxStableHeaders.h" 30 35 #include "OverlayGroup.h" … … 45 50 46 51 OverlayGroup::OverlayGroup() 47 : scale_(1.0, 1.0)48 52 { 49 53 RegisterObject(OverlayGroup); 50 54 } 51 55 52 OverlayGroup::~OverlayGroup() 53 { 54 } 55 56 /** 57 @brief 58 Loads the group and all its children OrxonoxOverlays. 59 @copydoc 60 BaseObject::XMLPort() 61 */ 56 62 void OverlayGroup::XMLPort(Element& xmlElement, XMLPort::Mode mode) 57 63 { 58 64 BaseObject::XMLPort(xmlElement, mode); 59 65 66 if (mode == XMLPort::LoadObject) 67 { 68 // set default values 69 this->scale_ = Vector2(1.0, 1.0); 70 this->scroll_ = Vector2(0.0, 0.0); 71 } 72 60 73 XMLPortParam(OverlayGroup, "scale", setScale, getScale, xmlElement, mode); 61 74 XMLPortParam(OverlayGroup, "scroll", setScroll, getScroll, xmlElement, mode); 75 // loads all the child elements 62 76 XMLPortObject(OverlayGroup, OrxonoxOverlay, "", addElement, getElement, xmlElement, mode, false, true); 63 77 } 64 78 79 //! Scales every element in the map. 65 80 void OverlayGroup::setScale(const Vector2& scale) 66 81 { … … 70 85 } 71 86 87 //! Scrolls every element in the map. 72 88 void OverlayGroup::setScroll(const Vector2& scroll) 73 89 { … … 77 93 } 78 94 95 /** 96 @brief 97 Adds an element to the map (used when loading with XMLPort). 98 @remarks 99 The names of the OrxonoxOverlays have to be unique! 100 */ 79 101 void OverlayGroup::addElement(OrxonoxOverlay* element) 80 102 { … … 87 109 } 88 110 111 //! Returns a different element as long as index < hudElements_.size(). 89 112 OrxonoxOverlay* OverlayGroup::getElement(unsigned int index) 90 113 { … … 101 124 102 125 126 //########### Console commands ############ 127 128 /** 129 @brief 130 Hides/shows an overlay group by its name. 131 @param name 132 The name of the group defined BaseObject::setName() (usually done with the "name" 133 attribute in the xml file). 134 */ 103 135 /*static*/ void OverlayGroup::toggleVisibility(const std::string& name) 104 136 { … … 110 142 } 111 143 144 /** 145 @brief 146 Scales an overlay group by its name. 147 @param name 148 The name of the group defined BaseObject::setName() (usually done with the "name" 149 attribute in the xml file). 150 */ 112 151 /*static*/ void OverlayGroup::scaleGroup(const std::string& name, float scale) 113 152 { … … 119 158 } 120 159 160 /** 161 @brief 162 Scrolls an overlay group by its name. 163 @param name 164 The name of the group defined BaseObject::setName() (usually done with the "name" 165 attribute in the xml file). 166 */ 121 167 /*static*/ void OverlayGroup::scrollGroup(const std::string& name, const Vector2& scroll) 122 168 { -
code/branches/hud/src/orxonox/overlays/OverlayGroup.h
r1615 r1623 27 27 */ 28 28 29 /** 30 @file 31 @brief Declaration of the OverlayGroup class. 32 */ 33 29 34 #ifndef _OverlayGroup_H__ 30 35 #define _OverlayGroup_H__ … … 39 44 namespace orxonox 40 45 { 46 /** 47 @brief 48 OverlayGroup does almost exactly what it says: It groups OrxonoxOverlays together. 49 You can scroll the entire group by a certain amount. Scale however works differently 50 than expected: Each OrxonoxOverlay scales individually. That's quite useful when you 51 create your HUD with an OverlayGroup and then want to alter its size. 52 */ 41 53 class _OrxonoxExport OverlayGroup : public BaseObject 42 54 { 43 55 public: 44 56 OverlayGroup(); 45 ~OverlayGroup(); 57 //! Empty destructor. 58 ~OverlayGroup() { } 46 59 47 60 void XMLPort(Element& xmlElement, XMLPort::Mode mode); … … 50 63 static void scaleGroup(const std::string& name, float scale); 51 64 static void scrollGroup(const std::string& name, const Vector2& scroll); 52 static void rotateGroup(const std::string& name, Radian angle);53 65 54 66 private: 67 //! Scales each OrxonoxOverlay individually by scale. 55 68 void scale(const Vector2& scale) { this->setScale(scale * this->scale_); } 56 69 void setScale(const Vector2& scale); 70 //! Returns the current size of the group. 57 71 Vector2 getScale() const { return this->scale_; } 58 72 73 //! Scrolls each OrxonoxOverlay individually by scroll. 59 74 void scroll(const Vector2& scroll) { this->setScroll(scroll + this->scroll_); } 60 75 void setScroll(const Vector2& scroll); 76 //! Returns the current scrolling offset of the group. 61 77 Vector2 getScroll() const { return this->scale_; } 62 78 … … 64 80 OrxonoxOverlay* getElement(unsigned int index); 65 81 66 std::map<std::string, OrxonoxOverlay*> hudElements_; 67 Vector2 scale_; 68 Vector2 scroll_; 82 std::map<std::string, OrxonoxOverlay*> hudElements_; //!< Contains all the OrxonoxOverlays of the this group. 83 Vector2 scale_; //!< Current scale (independant of the elements). 84 Vector2 scroll_; //!< Current scrolling offset. 69 85 }; 70 86 }
Note: See TracChangeset
for help on using the changeset viewer.