Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11588 for code/branches


Ignore:
Timestamp:
Nov 24, 2017, 1:15:12 PM (7 years ago)
Author:
boltn
Message:

nur einmal auszfuehrenden code aus tick in initialize fkt verschoben

Location:
code/branches/CampaignMap_HS17
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw

    r11584 r11588  
    88<?lua
    99  include("stats.oxo")
    10   include("StoryModeHUD2.oxo")
    1110  include("templates/lodInformation.oxt")
    1211  include("templates/StoryMode.oxt")
     
    3231   
    3332
    34  <StoryModePlanet levelName="gaggiplanet1" position="0,0,0" direction="0,0,0">
     33 <StoryModePlanet levelName="plizzanet1" position="0,0,0" direction="0,0,0">
    3534  <attached>
    3635    <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
     
    3837 </StoryModePlanet>
    3938
    40 <StoryModePlanet levelName="gaggiplanet2" position="600,0,0" direction="0,0,0">
     39<StoryModePlanet levelName="plizzanet2" position="600,0,0" direction="0,0,0">
    4140  <attached>
    4241    <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
     
    4443 </StoryModePlanet>
    4544   
    46 <StoryModePlanet levelName="gaggiplanet3" position="1200,0,0" direction="0,0,0">
     45<StoryModePlanet levelName="plizzanet3" position="1200,0,0" direction="0,0,0">
    4746  <attached>
    4847    <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
  • code/branches/CampaignMap_HS17/data/overlays/HUDTemplates3.oxo

    r11560 r11588  
    5555     correctaspect  = false
    5656     font           = "Monofur"
    57      textSize       = 0.05
     57     textSize       = 0.01
    5858     align          = "center"
    5959    />
  • code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo

    r11584 r11588  
    88     correctaspect  = true
    99     font           = "Arial"
    10      textSize       = 0.5
     10     textSize       = 0.01f
    1111    />
    1212
  • code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc

    r11584 r11588  
    9292
    9393       
    94         for(unsigned int i = 0; i < ObjectList<StoryModePlanet>().size(); i++){
     94        int i = 0;
     95        for(StoryModePlanet* planet : ObjectList<StoryModePlanet>()){
     96
    9597
    9698            Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton()
     
    98100
    99101            texts.push_back(text);
    100             //text->setFontName(this->fontName_);
    101             //text->setCharHeight(this->textSize_ * yScale);
    102102            texts[i]->setDimensions(xScale, yScale);
     103
     104            //PROBLEM: function doesn't get called automatically by the xml macro,
     105            //which is why we need to call it manually here. works with storymodeplanet.h...
     106            this->setFont("Monofur");
     107            this->setTextSize(0.05f);
     108
     109            //font name of the text needs to be set here, not in the xml setter function
     110            texts[i]->setFontName(this->fontName_);
     111            texts[i]->setCharHeight(this->textSize_ * yScale);
     112
     113            //set text
     114            texts[i]->setCaption(planet->getLevelName());
    103115
    104116            texts[i]->hide();
    105117       
    106118            this->background_->addChild(texts[i]);
     119            i++;
    107120        }
    108         //this->setFont("Monofur");
    109         //this->setTextSize("0.5f");
    110121    }
    111122
    112     // Set the Font size of the Text.
     123    // Set the Font of this HUD.
    113124    void StoryModeHUD::setFont(const std::string& font)
    114125    {
     
    116127        if (fontPtr.isNull())
    117128        {
    118             orxout(internal_warning) << "StoryModeHUD: Font '" << font << "' not found" << endl;
     129            this->fontName_ = "Monofur";
     130            orxout(internal_warning) << "StoryModeHUD: Font '" << font << "' not found. Font has been set to Monofur." << endl;
    119131            return;
    120132        }
    121133        this->fontName_ = font;
    122         for(Ogre::TextAreaOverlayElement* text : texts)
    123             if(text != nullptr)
    124                 text->setFontName(this->fontName_);
    125134    }
    126135   
    127     // Gets the Font of the Text   
     136    // Gets the Font of this HUD   
    128137    const std::string& StoryModeHUD::getFont() const
    129138    {
     
    136145        if (size <= 0.0f)
    137146        {
    138             orxout(internal_warning) << "StoryModeHUD: Negative font size not allowed" << endl;
     147            this->textSize_ = 0.05f;
     148            orxout(internal_warning) << "StoryModeHUD: Non positive font size not allowed. Font size has been set to 0.05" << endl;
    139149            return;
    140150        }
     
    165175        for(StoryModePlanet* planet : ObjectList<StoryModePlanet>()){
    166176
    167             //display name next to cursor
    168             texts[i]->setCaption(planet->getLevelName());
    169 
    170177            // Transform to screen coordinates
    171178            Vector3 pos = camTransform * planet->getWorldPosition();
  • code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h

    r11584 r11588  
    5454            std::vector<Ogre::TextAreaOverlayElement*> texts;
    5555            void initialize();
    56             void setTextSize(float size);
    57             float getTextSize() const;
     56            virtual void setTextSize(float size);
     57            virtual float getTextSize() const;
    5858
    59             void setFont(const std::string& font);
     59            virtual void setFont(const std::string& font);
    6060            const std::string& getFont() const;
    6161
Note: See TracChangeset for help on using the changeset viewer.