Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8988 for code


Ignore:
Timestamp:
Dec 14, 2011, 4:45:22 PM (13 years ago)
Author:
smerkli
Message:

merged hud branch

Location:
code/branches/presentation2011
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2011

  • code/branches/presentation2011/data/gui/scripts/MiscConfigMenu.lua

    r8977 r8988  
    3636    table.insert(P.commandList, "ChatOverlay displayTime_")
    3737    table.insert(P.commandList, "Core bDevMode_")
     38    table.insert(P.commandList, "HUDNavigation MarkerLimit_")
     39    table.insert(P.commandList, "HUDNavigation showDistance")
    3840
    3941    P.nameList = {}
     
    5658    table.insert(P.nameList, "Chat: display time")
    5759    table.insert(P.nameList, "Developer's Mode")
     60    table.insert(P.nameList, "Marker Limit")
     61    table.insert(P.nameList, "Show Distance next to cursor")
    5862
    5963    P.linesList = {}
  • code/branches/presentation2011/data/levels/underAttack.oxw

    r8977 r8988  
    5656      maxhealth         = 10000
    5757      initialhealth     = 10000
     58      RVName            = "Transporter"
    5859    >
    5960
  • code/branches/presentation2011/data/overlays/HUDTemplates3.oxo

    r8706 r8988  
    7878    </HUDBoostBar>
    7979
     80    <HUDEnemyHealthBar
     81     name              = "EnemyHealthBar"
     82     background        = "Orxonox/HealthBarBackground"
     83     size              = "0.35, 0.0875"
     84     position          = "1.0 , 0.1 "
     85     pickpoint         = "1, 1"
     86     bartexture        = "healthbar_bar.png"
     87     textfont          = "VeraMono"
     88     textusebarcolour  = true
     89     textsize          = 0.039
     90     textoffset        = "0.315, 0.05"
     91     textpickpoint     = "0, 0"
     92     textalign         = "right"
     93     correctaspect     = false
     94     textcorrectaspect = false
     95    >
     96      <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
     97      <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
     98      <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
     99    </HUDEnemyHealthBar>
     100
    80101    <HUDNavigation
    81102     name          = "Navigation"
  • code/branches/presentation2011/src/modules/overlays/hud/CMakeLists.txt

    r8706 r8988  
    77  HUDHealthBar.cc
    88  HUDTimer.cc
     9  HUDEnemyHealthBar.cc
    910  ChatOverlay.cc
    1011  AnnounceMessage.cc
  • code/branches/presentation2011/src/modules/overlays/hud/HUDHealthBar.h

    r7401 r8988  
    110110                { return this->textoverlay_->getSpaceWidth(); }
    111111
     112            inline void setOverlayText(SmartPtr<OverlayText> textoverlay)
     113                { this->textoverlay_ = textoverlay; }
     114            inline SmartPtr<OverlayText> getOverlayText() const
     115                {return this->textoverlay_; }
     116
    112117        private:
    113118            WeakPtr<Pawn> owner_;
  • code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.cc

    r8891 r8988  
    2525 *      Reto Grieder
    2626 *      Oliver Scheuss
     27 *      Matthias Spalinger
    2728 *
    2829 */
     
    6364{
    6465  SetConfigValue(markerLimit_, 3);
    65 
     66  SetConfigValue(showDistance, false);
    6667}
    6768
     
    7879    setTextSize ( 0.05f );
    7980    setNavMarkerSize ( 0.05f );
    80     setDetectionLimit( 10000.0f );
    8181}
    8282
     
    9797    SUPER ( HUDNavigation, XMLPort, xmlelement, mode );
    9898
    99     XMLPortParam ( HUDNavigation, "font",           setFont,           getFont,           xmlelement, mode );
    100     XMLPortParam ( HUDNavigation, "textSize",       setTextSize,       getTextSize,       xmlelement, mode );
    101     XMLPortParam ( HUDNavigation, "navMarkerSize",  setNavMarkerSize,  getNavMarkerSize,  xmlelement, mode );
    102     XMLPortParam ( HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode );
     99    XMLPortParam ( HUDNavigation, "font",          setFont,          getFont,          xmlelement, mode );
     100    XMLPortParam ( HUDNavigation, "textSize",      setTextSize,      getTextSize,      xmlelement, mode );
     101    XMLPortParam ( HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode );
    103102}
    104103
     
    144143}
    145144
    146 
     145float HUDNavigation::getArrowSizeX(int dist)
     146{   
     147    if (dist < 600)
     148        dist = 600;
     149    return this->getActualSize().x * 900 * navMarkerSize_ / dist;
     150}
     151
     152float HUDNavigation::getArrowSizeY(int dist)
     153{   
     154    if (dist < 600)
     155        dist = 600;   
     156    return this->getActualSize().y * 900 * navMarkerSize_ / dist;
     157}
    147158
    148159void HUDNavigation::tick ( float dt )
     
    164175
    165176    unsigned int markerCount_ = 0;
    166     bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player
     177
    167178//         for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it)
    168179    for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++markerCount_, ++listIt )
    169180    {
    170181        ObjectMap::iterator it = activeObjectList_.find ( listIt->first );
    171         closeEnough_ = listIt->second < detectionLimit_ ;
    172         if ( markerCount_ < markerLimit_ && (closeEnough_ ||  detectionLimit_ < 0) ) // display on HUD if the statement is true
     182
     183        if ( markerCount_ < markerLimit_ )
    173184        {
    174185
     
    176187            // Get Distance to HumanController and save it in the TextAreaOverlayElement.
    177188            int dist = listIt->second;
     189            float textLength = 0.0f;
     190
     191            //display distance next to cursor
     192            if (showDistance){
    178193            it->second.text_->setCaption ( multi_cast<std::string> ( dist ) );
    179             float textLength = multi_cast<std::string> ( dist ).size() * it->second.text_->getCharHeight() * 0.3f;
     194            textLength = multi_cast<std::string> ( dist ).size() * it->second.text_->getCharHeight() * 0.3f;
     195            }
     196
     197            //display name next to cursor
     198            else{
     199            it->second.text_->setCaption(it->first->getRVName());
     200            textLength = it->first->getRVName().size() * it->second.text_->getCharHeight() * 0.3f;
     201            }
    180202
    181203            // Transform to screen coordinates
     
    194216            else
    195217                outOfView = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0;
    196             // Get Distance to HumanController and save it in the TextAreaOverlayElement.
    197             it->second.text_->setCaption ( multi_cast<std::string> ( dist ) );
    198218
    199219            if ( outOfView )
     
    207227                    it->second.wasOutOfView_ = true;
    208228                }
     229
     230                //float xDistScale = this->getActualSize().x * 1000.0f * navMarkerSize_ / dist;
     231                //float yDistScale = this->getActualSize().y * 1000.0f * navMarkerSize_ / dist;
     232
     233                // Adjust Arrowsize according to distance
     234                it->second.panel_->setDimensions(getArrowSizeX(dist),getArrowSizeY(dist));
    209235
    210236                // Switch between top, bottom, left and right position of the arrow at the screen border
     
    263289                  //it->second.panel_->setMaterialName ( "Orxonox/NavTDC" );
    264290                    it->second.panel_->setMaterialName( TextureGenerator::getMaterialName( "tdc.png", it->first->getRadarObjectColour()) );
     291                    it->second.panel_->setDimensions ( navMarkerSize_ * this->getActualSize().x, navMarkerSize_ * this->getActualSize().y );
    265292                    it->second.wasOutOfView_ = false;
    266293                }
     
    280307            it->second.text_->show();
    281308        }
    282         else // do not display on HUD
     309        else
    283310        {
    284311            it->second.panel_->hide();
     
    312339void HUDNavigation::addObject ( RadarViewable* object )
    313340{
    314     if( showObject(object) == false )
     341    if( showObject(object)==false )
    315342        return;
    316343
     
    399426        return false;
    400427    assert( rv->getWorldEntity() );
    401     if ( rv->getWorldEntity()->isVisible() == false || rv->getRadarVisibility() == false )
     428    if ( rv->getWorldEntity()->isVisible()==false || rv->getRadarVisibility()==false )
    402429        return false;
    403430    return true;
  • code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.h

    r8891 r8988  
    2424 *   Co-authors:
    2525 *      Reto Grieder
     26 *      Matthias Spalinger
    2627 *
    2728 */
     
    5455    virtual void tick ( float dt );
    5556
     57    // RadarListener interface
    5658    virtual void addObject ( RadarViewable* object );
    5759    virtual void removeObject ( RadarViewable* viewable );
     
    6668    inline float getRadarSensitivity() const
    6769    { return 1.0f; }
     70
     71    unsigned int getMarkerLimit() { return this->markerLimit_; }
    6872
    6973private:
     
    8589    { return navMarkerSize_; }
    8690
    87     void setDetectionLimit( float limit )
    88     { this->detectionLimit_ = limit; }
    89     float getDetectionLimit() const
    90     { return this->detectionLimit_; }
    9191
    9292    void setTextSize ( float size );
     
    102102    sortedList sortedObjectList_;
    103103
     104    float getArrowSizeX(int dist);   
     105    float getArrowSizeY(int dist);
    104106
    105107    float navMarkerSize_;
    106108    std::string fontName_;
    107109    float textSize_;
     110    bool showDistance;
    108111
    109     unsigned int markerLimit_; //TODO: is it possible to set this over the console and/or the IG-Setting
    110     float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value.
    111                            //!< In order to bypass this behaviour, set a negative detectionLimit_. Then the detection range is "infinite".
     112    unsigned int markerLimit_;;
     113
     114
    112115};
    113116}
  • code/branches/presentation2011/src/orxonox/controllers/NewHumanController.h

    r7859 r8988  
    6969            virtual void doResumeControl();
    7070
     71            float getCurrentYaw(){ return this->currentYaw_; }
     72            float getCurrentPitch(){ return this->currentPitch_; }
     73
    7174
    7275        protected:
  • code/branches/presentation2011/src/orxonox/infos/PlayerInfo.cc

    r8891 r8988  
    3636#include "worldentities/ControllableEntity.h"
    3737#include "controllers/Controller.h"
     38#include "worldentities/pawns/SpaceShip.h"
    3839
    3940namespace orxonox
     
    170171
    171172        this->changedControllableEntity();
     173                SpaceShip* spaceship = dynamic_cast<SpaceShip*>(entity);
     174        if (spaceship != NULL)
     175        {
     176            spaceship->setRVName(this->getName());
     177        }
    172178    }
    173179
  • code/branches/presentation2011/src/orxonox/interfaces/RadarViewable.cc

    r8858 r8988  
    5151        , radarObjectDescription_("staticObject")
    5252        , scale_(1.0f)
     53                , RVName("")
    5354    {
    5455        RegisterRootObject(RadarViewable);
  • code/branches/presentation2011/src/orxonox/interfaces/RadarViewable.h

    r8738 r8988  
    6060        RadarViewable(BaseObject* creator, const WorldEntity* wePtr);
    6161        virtual ~RadarViewable();
     62
     63                virtual void setRVName(std::string name)
     64                        {
     65                                if (this->RVName != name)
     66                                {
     67                                        this->RVName = name;
     68                                        this->settingsChanged();
     69                                }
     70                        }
     71                std::string getRVName() const
     72                        { return this->RVName; }
    6273
    6374        inline void setRadarObjectCamouflage(float camouflage)
     
    152163        ColourValue radarObjectColour_;
    153164        float scale_;
     165                std::string RVName;
    154166    };
    155167}
  • code/branches/presentation2011/src/orxonox/worldentities/pawns/Pawn.cc

    r8980 r8988  
    129129        XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
    130130        XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
    131 
    132 
     131   
     132        XMLPortParam ( RadarViewable, "RVName", setRVName, getRVName, xmlelement, mode );
    133133    }
    134134
Note: See TracChangeset for help on using the changeset viewer.