Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1623


Ignore:
Timestamp:
Jun 26, 2008, 1:23:48 PM (16 years ago)
Author:
rgrieder
Message:

added documentation to OverlayGroup
ready for merge

Location:
code/branches/hud/src/orxonox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud/src/orxonox/Orxonox.cc

    r1621 r1623  
    441441    unsigned long frameCount = 0;
    442442   
    443     const unsigned long refreshTime = 3000000;
     443    // TODO: this would very well fit into a configValue
     444    const unsigned long refreshTime = 200000;
    444445    unsigned long refreshStartTime = 0;
    445446    unsigned long tickTime = 0;
  • code/branches/hud/src/orxonox/overlays/OrxonoxOverlay.cc

    r1622 r1623  
    291291    @param name
    292292        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).
    294294    */
    295295    /*static*/ void OrxonoxOverlay::scaleOverlay(const std::string& name, float scale)
     
    305305    @param name
    306306        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).
    308308    */
    309309    /*static*/ void OrxonoxOverlay::scrollOverlay(const std::string& name, const Vector2& scroll)
     
    319319    @param name
    320320        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).
    322322    */
    323323    /*static*/ void OrxonoxOverlay::rotateOverlay(const std::string& name, const Degree& angle)
  • code/branches/hud/src/orxonox/overlays/OverlayGroup.cc

    r1616 r1623  
    2727 */
    2828
     29/**
     30@file
     31@brief Definition of the OverlayGroup class.
     32*/
     33
    2934#include "OrxonoxStableHeaders.h"
    3035#include "OverlayGroup.h"
     
    4550
    4651    OverlayGroup::OverlayGroup()
    47         : scale_(1.0, 1.0)
    4852    {
    4953        RegisterObject(OverlayGroup);
    5054    }
    5155
    52     OverlayGroup::~OverlayGroup()
    53     {
    54     }
    55 
     56    /**
     57    @brief
     58        Loads the group and all its children OrxonoxOverlays.
     59    @copydoc
     60        BaseObject::XMLPort()
     61    */
    5662    void OverlayGroup::XMLPort(Element& xmlElement, XMLPort::Mode mode)
    5763    {
    5864        BaseObject::XMLPort(xmlElement, mode);
    5965
     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
    6073        XMLPortParam(OverlayGroup, "scale", setScale, getScale, xmlElement, mode);
    6174        XMLPortParam(OverlayGroup, "scroll", setScroll, getScroll, xmlElement, mode);
     75        // loads all the child elements
    6276        XMLPortObject(OverlayGroup, OrxonoxOverlay, "", addElement, getElement, xmlElement, mode, false, true);
    6377    }
    6478
     79    //! Scales every element in the map.
    6580    void OverlayGroup::setScale(const Vector2& scale)
    6681    {
     
    7085    }
    7186
     87    //! Scrolls every element in the map.
    7288    void OverlayGroup::setScroll(const Vector2& scroll)
    7389    {
     
    7793    }
    7894
     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    */
    79101    void OverlayGroup::addElement(OrxonoxOverlay* element)
    80102    {
     
    87109    }
    88110
     111    //! Returns a different element as long as index < hudElements_.size().
    89112    OrxonoxOverlay* OverlayGroup::getElement(unsigned int index)
    90113    {
     
    101124
    102125
     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    */
    103135    /*static*/ void OverlayGroup::toggleVisibility(const std::string& name)
    104136    {
     
    110142    }
    111143
     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    */
    112151    /*static*/ void OverlayGroup::scaleGroup(const std::string& name, float scale)
    113152    {
     
    119158    }
    120159
     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    */
    121167    /*static*/ void OverlayGroup::scrollGroup(const std::string& name, const Vector2& scroll)
    122168    {
  • code/branches/hud/src/orxonox/overlays/OverlayGroup.h

    r1615 r1623  
    2727 */
    2828
     29/**
     30@file
     31@brief Declaration of the OverlayGroup class.
     32*/
     33
    2934#ifndef _OverlayGroup_H__
    3035#define _OverlayGroup_H__
     
    3944namespace orxonox
    4045{
     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    */
    4153    class _OrxonoxExport OverlayGroup : public BaseObject
    4254    {
    4355    public:
    4456        OverlayGroup();
    45         ~OverlayGroup();
     57        //! Empty destructor.
     58        ~OverlayGroup() { }
    4659
    4760        void XMLPort(Element& xmlElement, XMLPort::Mode mode);
     
    5063        static void scaleGroup(const std::string& name, float scale);
    5164        static void scrollGroup(const std::string& name, const Vector2& scroll);
    52         static void rotateGroup(const std::string& name, Radian angle);
    5365
    5466    private:
     67        //! Scales each OrxonoxOverlay individually by scale.
    5568        void scale(const Vector2& scale) { this->setScale(scale * this->scale_); }
    5669        void setScale(const Vector2& scale);
     70        //! Returns the current size of the group.
    5771        Vector2 getScale() const { return this->scale_; }
    5872
     73        //! Scrolls each OrxonoxOverlay individually by scroll.
    5974        void scroll(const Vector2& scroll) { this->setScroll(scroll + this->scroll_); }
    6075        void setScroll(const Vector2& scroll);
     76        //! Returns the current scrolling offset of the group.
    6177        Vector2 getScroll() const { return this->scale_; }
    6278
     
    6480        OrxonoxOverlay* getElement(unsigned int index);
    6581
    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.
    6985    };
    7086}
Note: See TracChangeset for help on using the changeset viewer.