Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11584


Ignore:
Timestamp:
Nov 20, 2017, 5:01:46 PM (6 years ago)
Author:
boltn
Message:

Planeten koennen nun mittels objectlist beschrieben werden. todo: textart und groesse mittels xml einstellbar machen

Location:
code/branches/CampaignMap_HS17
Files:
5 edited

Legend:

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

    r11564 r11584  
    11<LevelInfo
    2  name = "Nikola and Claudio's StoryMode"
     2 name = "NC StoryMode"
    33 description = "A level in which the Campaign Menu is defined, which opens other levels."
    44 tags = "test"
     
    3030
    3131  <SpawnPoint position="000.000, 000.000, 1000.000" spawnclass=SpaceShip orientation="0, 0, 0, -1" pawndesign= spaceshipescort />
     32   
     33
     34 <StoryModePlanet levelName="gaggiplanet1" position="0,0,0" direction="0,0,0">
     35  <attached>
     36    <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
     37  </attached>
     38 </StoryModePlanet>
     39
     40<StoryModePlanet levelName="gaggiplanet2" position="600,0,0" direction="0,0,0">
     41  <attached>
     42    <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
     43  </attached>
     44 </StoryModePlanet>
    3245   
    33 
    34   <StaticEntity position="0,0,0" direction="0,0,0" >
    35     <attached>
    36 
    37     <Model position="600,370,0" mesh="planets/moon.mesh" scale=100 />
    38     <Billboard colour="1,1,0.05" position="600,370,-80"  material="Flares/lensflare" scale=4.5 />
     46<StoryModePlanet levelName="gaggiplanet3" position="1200,0,0" direction="0,0,0">
     47  <attached>
     48    <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
     49  </attached>
     50</StoryModePlanet>
    3951 
    40     <Model position="100,350,-250" mesh="planets/moon.mesh" scale=100  />
    41     <Billboard colour="1,1,0.05" position="100,350,-330"  material="Flares/lensflare" scale=4.5 />
    42 
    43     <Model position="-600,250,-500" mesh="planets/moon.mesh" scale=100 />
    44     <Billboard colour="1,1,0.05" position="-600,250,-580"  material="Flares/lensflare" scale=5 />
    45 
    46     <Model position="-1000,50,-750" mesh="planets/moon.mesh" scale=100 />
    47     <Billboard colour="1,1,0.05" position="-1000,50,-830"  material="Flares/lensflare" scale=5 />
    48 
    49     <Model position="-900,-400,-1000" mesh="planets/moon.mesh" scale=100 />
    50     <Billboard colour="1,1,0.05" position="-900,-400,-1080"  material="Flares/lensflare" scale=5 />
    51 
    52     <Model position="-500,-700,-1250" mesh="planets/moon.mesh" scale=100 />
    53     <Billboard colour="1,1,0.05" position="-500,-700,-1330"  material="Flares/lensflare" scale=5 />
    54 
    55     <Model position="0,-900,-1500" mesh="planets/moon.mesh" scale=100 />
    56     <Billboard colour="1,1,0.05" position="0,-900,-1580" material="Flares/lensflare" scale=5 />
    57 
    58     <Model position="700,-1100,-1750" mesh="planets/moon.mesh" scale=100 />
    59     <Billboard colour="1,1,0.05" position="700,-1100,-1830"  material="Flares/lensflare" scale=5 />
    60 
    61     <Model position="1500,-1300,-2000" mesh="planets/moon.mesh" scale=100 />
    62     <Billboard colour="1,1,0.05" position="1500,-1300,-2080"  material="Flares/lensflare" scale=5 />
    63 
    64     <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
    65    
    66 
    67   </attached>
    68 </StaticEntity>
    69 
    70    
    7152  </Scene>
    7253</Level>
  • code/branches/CampaignMap_HS17/data/levels/emptyLevel.oxw

    r11560 r11584  
    3030  >
    3131
    32   <StoryModePlanet position="0,0,0" direction="0,0,0">
    33   <attached>
    34 
    35     <Model position="600,370,0" mesh="planets/moon.mesh" scale=100 />
    36     <Billboard colour="1,1,0.05" position="600,370,-80"  material="Flares/lensflare" scale=4.5 />
    37  
    38     <Model position="100,350,-250" mesh="planets/moon.mesh" scale=100  />
    39     <Billboard colour="1,1,0.05" position="100,350,-330"  material="Flares/lensflare" scale=4.5 />
    40 
    41     <Model position="-600,250,-500" mesh="planets/moon.mesh" scale=100 />
    42     <Billboard colour="1,1,0.05" position="-600,250,-580"  material="Flares/lensflare" scale=5 />
    43 
    44     <Model position="-1000,50,-750" mesh="planets/moon.mesh" scale=100 />
    45     <Billboard colour="1,1,0.05" position="-1000,50,-830"  material="Flares/lensflare" scale=5 />
    46 
    47     <Model position="-900,-400,-1000" mesh="planets/moon.mesh" scale=100 />
    48     <Billboard colour="1,1,0.05" position="-900,-400,-1080"  material="Flares/lensflare" scale=5 />
    49 
    50     <Model position="-500,-700,-1250" mesh="planets/moon.mesh" scale=100 />
    51     <Billboard colour="1,1,0.05" position="-500,-700,-1330"  material="Flares/lensflare" scale=5 />
    52 
    53     <Model position="0,-900,-1500" mesh="planets/moon.mesh" scale=100 />
    54     <Billboard colour="1,1,0.05" position="0,-900,-1580" material="Flares/lensflare" scale=5 />
    55 
    56     <Model position="700,-1100,-1750" mesh="planets/moon.mesh" scale=100 />
    57     <Billboard colour="1,1,0.05" position="700,-1100,-1830"  material="Flares/lensflare" scale=5 />
    58 
    59     <Model position="1500,-1300,-2000" mesh="planets/moon.mesh" scale=100 />
    60     <Billboard colour="1,1,0.05" position="1500,-1300,-2080"  material="Flares/lensflare" scale=5 />
    61 
    62   </attached>
    63   </StoryModePlanet>
    6432  <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    6533  <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
  • code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo

    r11560 r11584  
    1 <!--
    2 <Template name="defaultHUD">
    3   <OverlayGroup name = "defaultHUD" scale = "1, 1">
    4     <ChatOverlay
    5      name     = "chat"
    6      position = "0.03, 0.5"
    7      font     = "VeraMono"
    8      caption  = ""
    9      textsize = 0.025
    10     />
    11 
    12     <GametypeStatus
    13      name     = "state"
    14      position = "0.5, 0.85"
    15      font     = "VeraMono"
    16      textsize = 0.05
    17      colour   = "1.0, 1.0, 0.0, 0.8"
    18      align    = "center"
    19     />
    20   </OverlayGroup>
    21 </Template>
    22 -->
    23 
    241
    252<Template name="StoryModeHUD2">
    263  <OverlayGroup name = "spaceshiphud" scale = "1, 1">
    27 
    28     <!--
    29     <HUDNavigation
    30      name          = "Navigation"
    31      correctaspect = true
    32      font          = "Arial"
    33      textsize      = 0.03
    34      navMarkerSize = 0.00
    35      aimMarkerSize = 0.00
    36     />
    37   -->
    384
    395    <!-- This is the storymode HUD we implemented, to give names to planet objects, rather than using the HUDnavigation-->
     
    417     name           = "StoryMode"
    428     correctaspect  = true
    43      font           = "Monofur"
    44      textSize       = 0.05
     9     font           = "Arial"
     10     textSize       = 0.5
    4511    />
    4612
  • code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc

    r11564 r11584  
    4444#include <typeinfo>
    4545
    46 #include "util/Math.h"
    4746#include "util/Convert.h"
    4847#include "core/command/ConsoleCommandIncludes.h"
     
    5049#include "core/XMLPort.h"
    5150#include "CameraManager.h"
    52 #include "Scene.h"
    53 #include "Radar.h"
    5451#include "graphics/Camera.h"
    55 #include "controllers/HumanController.h"
    5652#include "worldentities/pawns/Pawn.h"
    5753#include "worldentities/WorldEntity.h"
     
    5955#include "tools/TextureGenerator.h"
    6056
     57#include "worldentities/StoryModePlanet.h"
    6158
    6259namespace orxonox
     
    6865    {
    6966        RegisterObject(StoryModeHUD);
    70 
    71         // Set default values
    72         //this->setFont("Monofur");
    73         //this->setTextSize(0.5f);
    74 
    75         // Scales used for dimensions and text size
    76         float xScale = this->getActualSize().x;
    77         float yScale = this->getActualSize().y;
    78 
    79         // Create text
    80         text_ = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton()
    81                 .createOverlayElement("TextArea", "StoryModeHUD_navText_" + getUniqueNumberString()));
    82         //text->setFontName(this->fontName_);
    83         //text->setCharHeight(this->textSize_ * yScale);
    84         text_->setDimensions(xScale, yScale);
    85 
    86         text_->hide();
    87        
    88         this->background_->addChild(text_);
     67        this->initialize();
    8968    }
    9069
    91     // TODO:
    9270    // Destructor of the StoryMode HUD
    9371    StoryModeHUD::~StoryModeHUD()
    9472    {
    95 
     73        for(Ogre::TextAreaOverlayElement* text : texts)
     74          delete text;
    9675    }
    9776
     
    10786    }
    10887
     88    void StoryModeHUD::initialize(){
     89        // Scales used for dimensions and text size
     90        float xScale = this->getActualSize().x;
     91        float yScale = this->getActualSize().y;
     92
     93       
     94        for(unsigned int i = 0; i < ObjectList<StoryModePlanet>().size(); i++){
     95
     96            Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton()
     97                    .createOverlayElement("TextArea", "StoryModeHUD_navText_" + getUniqueNumberString()));
     98
     99            texts.push_back(text);
     100            //text->setFontName(this->fontName_);
     101            //text->setCharHeight(this->textSize_ * yScale);
     102            texts[i]->setDimensions(xScale, yScale);
     103
     104            texts[i]->hide();
     105       
     106            this->background_->addChild(texts[i]);
     107        }
     108        //this->setFont("Monofur");
     109        //this->setTextSize("0.5f");
     110    }
     111
    109112    // Set the Font size of the Text.
    110113    void StoryModeHUD::setFont(const std::string& font)
     
    117120        }
    118121        this->fontName_ = font;
    119         if(text_ != nullptr)
    120             text_->setFontName(this->fontName_);
     122        for(Ogre::TextAreaOverlayElement* text : texts)
     123            if(text != nullptr)
     124                text->setFontName(this->fontName_);
    121125    }
    122126   
     
    158162        const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix();
    159163
     164        int i = 0;
     165        for(StoryModePlanet* planet : ObjectList<StoryModePlanet>()){
    160166
    161         //display name next to cursor
    162         //TODO: Planet.getName()
    163         text_->setCaption("Hello Muthafuckin' World!");
     167            //display name next to cursor
     168            texts[i]->setCaption(planet->getLevelName());
    164169
    165         // Transform to screen coordinates
    166         Vector3 pos = camTransform * Vector3(0,0,0); // planet->getRVWorldPosition();
     170            // Transform to screen coordinates
     171            Vector3 pos = camTransform * planet->getWorldPosition();
    167172
    168         // If you fly passed the description, it gets out of sight
    169         if (pos.z > 1.0)
    170             return;
    171        
    172         // Position text
    173         text_->setLeft((pos.x+1)/2); // The (0,0) Coordinate is in the upper left corner.
    174         text_->setTop((-pos.y+1)/2);  // With those two calculations we set the desired positions
     173            // If you fly passed the description, it gets out of sight
     174            if (!(pos.z > 1.0)){
     175                   
     176                // Position text
     177                texts[i]->setLeft((pos.x+1)/2); // The (0,0) Coordinate is in the upper left corner.
     178                texts[i]->setTop((-pos.y+1)/2);  // With those two calculations we set the desired positions
    175179
    176         // Make sure the overlays are shown
    177         text_->show();
     180                // Make sure the overlays are shown
     181                texts[i]->show();
     182            }
     183            i++;
    178184
     185        }
    179186    }
    180 
    181     //void StoryModeHUD::addObject()
    182 
    183     /*void StoryModeHUD::removeObject(RadarViewable* viewable)
    184     {
    185         Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.text_);
    186     }*/
    187187}
  • code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h

    r11564 r11584  
    5252
    5353        private:
    54             Ogre::TextAreaOverlayElement* text_;
    55      
     54            std::vector<Ogre::TextAreaOverlayElement*> texts;
     55            void initialize();
    5656            void setTextSize(float size);
    5757            float getTextSize() const;
     
    6060            const std::string& getFont() const;
    6161
    62    
    6362            std::string fontName_;
    6463            float textSize_;
Note: See TracChangeset for help on using the changeset viewer.