Changeset 11584 for code/branches
- Timestamp:
- Nov 20, 2017, 5:01:46 PM (7 years ago)
- Location:
- code/branches/CampaignMap_HS17
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw
r11564 r11584 1 1 <LevelInfo 2 name = "N ikola and Claudio'sStoryMode"2 name = "NC StoryMode" 3 3 description = "A level in which the Campaign Menu is defined, which opens other levels." 4 4 tags = "test" … … 30 30 31 31 <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> 32 45 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> 39 51 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 71 52 </Scene> 72 53 </Level> -
code/branches/CampaignMap_HS17/data/levels/emptyLevel.oxw
r11560 r11584 30 30 > 31 31 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>64 32 <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"/> 65 33 <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 <ChatOverlay5 name = "chat"6 position = "0.03, 0.5"7 font = "VeraMono"8 caption = ""9 textsize = 0.02510 />11 12 <GametypeStatus13 name = "state"14 position = "0.5, 0.85"15 font = "VeraMono"16 textsize = 0.0517 colour = "1.0, 1.0, 0.0, 0.8"18 align = "center"19 />20 </OverlayGroup>21 </Template>22 -->23 24 1 25 2 <Template name="StoryModeHUD2"> 26 3 <OverlayGroup name = "spaceshiphud" scale = "1, 1"> 27 28 <!--29 <HUDNavigation30 name = "Navigation"31 correctaspect = true32 font = "Arial"33 textsize = 0.0334 navMarkerSize = 0.0035 aimMarkerSize = 0.0036 />37 -->38 4 39 5 <!-- This is the storymode HUD we implemented, to give names to planet objects, rather than using the HUDnavigation--> … … 41 7 name = "StoryMode" 42 8 correctaspect = true 43 font = " Monofur"44 textSize = 0. 059 font = "Arial" 10 textSize = 0.5 45 11 /> 46 12 -
code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc
r11564 r11584 44 44 #include <typeinfo> 45 45 46 #include "util/Math.h"47 46 #include "util/Convert.h" 48 47 #include "core/command/ConsoleCommandIncludes.h" … … 50 49 #include "core/XMLPort.h" 51 50 #include "CameraManager.h" 52 #include "Scene.h"53 #include "Radar.h"54 51 #include "graphics/Camera.h" 55 #include "controllers/HumanController.h"56 52 #include "worldentities/pawns/Pawn.h" 57 53 #include "worldentities/WorldEntity.h" … … 59 55 #include "tools/TextureGenerator.h" 60 56 57 #include "worldentities/StoryModePlanet.h" 61 58 62 59 namespace orxonox … … 68 65 { 69 66 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(); 89 68 } 90 69 91 // TODO:92 70 // Destructor of the StoryMode HUD 93 71 StoryModeHUD::~StoryModeHUD() 94 72 { 95 73 for(Ogre::TextAreaOverlayElement* text : texts) 74 delete text; 96 75 } 97 76 … … 107 86 } 108 87 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 109 112 // Set the Font size of the Text. 110 113 void StoryModeHUD::setFont(const std::string& font) … … 117 120 } 118 121 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_); 121 125 } 122 126 … … 158 162 const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 159 163 164 int i = 0; 165 for(StoryModePlanet* planet : ObjectList<StoryModePlanet>()){ 160 166 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()); 164 169 165 // Transform to screen coordinates166 Vector3 pos = camTransform * Vector3(0,0,0); // planet->getRVWorldPosition();170 // Transform to screen coordinates 171 Vector3 pos = camTransform * planet->getWorldPosition(); 167 172 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 175 179 176 // Make sure the overlays are shown 177 text_->show(); 180 // Make sure the overlays are shown 181 texts[i]->show(); 182 } 183 i++; 178 184 185 } 179 186 } 180 181 //void StoryModeHUD::addObject()182 183 /*void StoryModeHUD::removeObject(RadarViewable* viewable)184 {185 Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.text_);186 }*/187 187 } -
code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h
r11564 r11584 52 52 53 53 private: 54 Ogre::TextAreaOverlayElement* text_;55 54 std::vector<Ogre::TextAreaOverlayElement*> texts; 55 void initialize(); 56 56 void setTextSize(float size); 57 57 float getTextSize() const; … … 60 60 const std::string& getFont() const; 61 61 62 63 62 std::string fontName_; 64 63 float textSize_;
Note: See TracChangeset
for help on using the changeset viewer.