[Orxonox-commit 6963] r11584 - in code/branches/CampaignMap_HS17: data/levels data/overlays src/modules/overlays/hud
boltn at orxonox.net
boltn at orxonox.net
Mon Nov 20 17:01:46 CET 2017
Author: boltn
Date: 2017-11-20 17:01:46 +0100 (Mon, 20 Nov 2017)
New Revision: 11584
Modified:
code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw
code/branches/CampaignMap_HS17/data/levels/emptyLevel.oxw
code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo
code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc
code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h
Log:
Planeten koennen nun mittels objectlist beschrieben werden. todo: textart und groesse mittels xml einstellbar machen
Modified: code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw
===================================================================
--- code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw 2017-11-20 15:48:03 UTC (rev 11583)
+++ code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw 2017-11-20 16:01:46 UTC (rev 11584)
@@ -1,5 +1,5 @@
<LevelInfo
- name = "Nikola and Claudio's StoryMode"
+ name = "NC StoryMode"
description = "A level in which the Campaign Menu is defined, which opens other levels."
tags = "test"
screenshot = "emptylevel.png"
@@ -29,45 +29,26 @@
>
<SpawnPoint position="000.000, 000.000, 1000.000" spawnclass=SpaceShip orientation="0, 0, 0, -1" pawndesign= spaceshipescort />
-
+
- <StaticEntity position="0,0,0" direction="0,0,0" >
- <attached>
+ <StoryModePlanet levelName="gaggiplanet1" position="0,0,0" direction="0,0,0">
+ <attached>
+ <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
+ </attached>
+ </StoryModePlanet>
- <Model position="600,370,0" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="600,370,-80" material="Flares/lensflare" scale=4.5 />
-
- <Model position="100,350,-250" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="100,350,-330" material="Flares/lensflare" scale=4.5 />
-
- <Model position="-600,250,-500" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="-600,250,-580" material="Flares/lensflare" scale=5 />
-
- <Model position="-1000,50,-750" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="-1000,50,-830" material="Flares/lensflare" scale=5 />
-
- <Model position="-900,-400,-1000" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="-900,-400,-1080" material="Flares/lensflare" scale=5 />
-
- <Model position="-500,-700,-1250" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="-500,-700,-1330" material="Flares/lensflare" scale=5 />
-
- <Model position="0,-900,-1500" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="0,-900,-1580" material="Flares/lensflare" scale=5 />
-
- <Model position="700,-1100,-1750" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="700,-1100,-1830" material="Flares/lensflare" scale=5 />
-
- <Model position="1500,-1300,-2000" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="1500,-1300,-2080" material="Flares/lensflare" scale=5 />
-
+<StoryModePlanet levelName="gaggiplanet2" position="600,0,0" direction="0,0,0">
+ <attached>
<Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
+ </attached>
+ </StoryModePlanet>
-
+<StoryModePlanet levelName="gaggiplanet3" position="1200,0,0" direction="0,0,0">
+ <attached>
+ <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
</attached>
-</StaticEntity>
-
-
+</StoryModePlanet>
+
</Scene>
</Level>
Modified: code/branches/CampaignMap_HS17/data/levels/emptyLevel.oxw
===================================================================
--- code/branches/CampaignMap_HS17/data/levels/emptyLevel.oxw 2017-11-20 15:48:03 UTC (rev 11583)
+++ code/branches/CampaignMap_HS17/data/levels/emptyLevel.oxw 2017-11-20 16:01:46 UTC (rev 11584)
@@ -29,38 +29,6 @@
skybox = "Orxonox/Starbox"
>
- <StoryModePlanet position="0,0,0" direction="0,0,0">
- <attached>
-
- <Model position="600,370,0" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="600,370,-80" material="Flares/lensflare" scale=4.5 />
-
- <Model position="100,350,-250" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="100,350,-330" material="Flares/lensflare" scale=4.5 />
-
- <Model position="-600,250,-500" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="-600,250,-580" material="Flares/lensflare" scale=5 />
-
- <Model position="-1000,50,-750" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="-1000,50,-830" material="Flares/lensflare" scale=5 />
-
- <Model position="-900,-400,-1000" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="-900,-400,-1080" material="Flares/lensflare" scale=5 />
-
- <Model position="-500,-700,-1250" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="-500,-700,-1330" material="Flares/lensflare" scale=5 />
-
- <Model position="0,-900,-1500" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="0,-900,-1580" material="Flares/lensflare" scale=5 />
-
- <Model position="700,-1100,-1750" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="700,-1100,-1830" material="Flares/lensflare" scale=5 />
-
- <Model position="1500,-1300,-2000" mesh="planets/moon.mesh" scale=100 />
- <Billboard colour="1,1,0.05" position="1500,-1300,-2080" material="Flares/lensflare" scale=5 />
-
- </attached>
- </StoryModePlanet>
<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"/>
<SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
</Scene>
Modified: code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo
===================================================================
--- code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo 2017-11-20 15:48:03 UTC (rev 11583)
+++ code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo 2017-11-20 16:01:46 UTC (rev 11584)
@@ -1,47 +1,13 @@
-<!--
-<Template name="defaultHUD">
- <OverlayGroup name = "defaultHUD" scale = "1, 1">
- <ChatOverlay
- name = "chat"
- position = "0.03, 0.5"
- font = "VeraMono"
- caption = ""
- textsize = 0.025
- />
- <GametypeStatus
- name = "state"
- position = "0.5, 0.85"
- font = "VeraMono"
- textsize = 0.05
- colour = "1.0, 1.0, 0.0, 0.8"
- align = "center"
- />
- </OverlayGroup>
-</Template>
--->
-
-
<Template name="StoryModeHUD2">
<OverlayGroup name = "spaceshiphud" scale = "1, 1">
- <!--
- <HUDNavigation
- name = "Navigation"
- correctaspect = true
- font = "Arial"
- textsize = 0.03
- navMarkerSize = 0.00
- aimMarkerSize = 0.00
- />
- -->
-
<!-- This is the storymode HUD we implemented, to give names to planet objects, rather than using the HUDnavigation-->
<StoryModeHUD
name = "StoryMode"
correctaspect = true
- font = "Monofur"
- textSize = 0.05
+ font = "Arial"
+ textSize = 0.5
/>
</OverlayGroup>
Modified: code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc
===================================================================
--- code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc 2017-11-20 15:48:03 UTC (rev 11583)
+++ code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc 2017-11-20 16:01:46 UTC (rev 11584)
@@ -43,21 +43,18 @@
// Other stuff
#include <typeinfo>
-#include "util/Math.h"
#include "util/Convert.h"
#include "core/command/ConsoleCommandIncludes.h"
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
#include "CameraManager.h"
-#include "Scene.h"
-#include "Radar.h"
#include "graphics/Camera.h"
-#include "controllers/HumanController.h"
#include "worldentities/pawns/Pawn.h"
#include "worldentities/WorldEntity.h"
#include "core/config/ConfigValueIncludes.h"
#include "tools/TextureGenerator.h"
+#include "worldentities/StoryModePlanet.h"
namespace orxonox
{
@@ -67,32 +64,14 @@
StoryModeHUD::StoryModeHUD(Context* context) : OrxonoxOverlay(context)
{
RegisterObject(StoryModeHUD);
-
- // Set default values
- //this->setFont("Monofur");
- //this->setTextSize(0.5f);
-
- // Scales used for dimensions and text size
- float xScale = this->getActualSize().x;
- float yScale = this->getActualSize().y;
-
- // Create text
- text_ = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton()
- .createOverlayElement("TextArea", "StoryModeHUD_navText_" + getUniqueNumberString()));
- //text->setFontName(this->fontName_);
- //text->setCharHeight(this->textSize_ * yScale);
- text_->setDimensions(xScale, yScale);
-
- text_->hide();
-
- this->background_->addChild(text_);
+ this->initialize();
}
- // TODO:
// Destructor of the StoryMode HUD
StoryModeHUD::~StoryModeHUD()
{
-
+ for(Ogre::TextAreaOverlayElement* text : texts)
+ delete text;
}
// Functions of the StoryMode HUD
@@ -106,6 +85,30 @@
XMLPortParam(StoryModeHUD, "textSize", setTextSize, getTextSize, xmlelement, mode);
}
+ void StoryModeHUD::initialize(){
+ // Scales used for dimensions and text size
+ float xScale = this->getActualSize().x;
+ float yScale = this->getActualSize().y;
+
+
+ for(unsigned int i = 0; i < ObjectList<StoryModePlanet>().size(); i++){
+
+ Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton()
+ .createOverlayElement("TextArea", "StoryModeHUD_navText_" + getUniqueNumberString()));
+
+ texts.push_back(text);
+ //text->setFontName(this->fontName_);
+ //text->setCharHeight(this->textSize_ * yScale);
+ texts[i]->setDimensions(xScale, yScale);
+
+ texts[i]->hide();
+
+ this->background_->addChild(texts[i]);
+ }
+ //this->setFont("Monofur");
+ //this->setTextSize("0.5f");
+ }
+
// Set the Font size of the Text.
void StoryModeHUD::setFont(const std::string& font)
{
@@ -116,8 +119,9 @@
return;
}
this->fontName_ = font;
- if(text_ != nullptr)
- text_->setFontName(this->fontName_);
+ for(Ogre::TextAreaOverlayElement* text : texts)
+ if(text != nullptr)
+ text->setFontName(this->fontName_);
}
// Gets the Font of the Text
@@ -157,31 +161,27 @@
// camTransform is a Matrix, which converts 3D world of the game into 2D on your screen
const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix();
+ int i = 0;
+ for(StoryModePlanet* planet : ObjectList<StoryModePlanet>()){
- //display name next to cursor
- //TODO: Planet.getName()
- text_->setCaption("Hello Muthafuckin' World!");
+ //display name next to cursor
+ texts[i]->setCaption(planet->getLevelName());
- // Transform to screen coordinates
- Vector3 pos = camTransform * Vector3(0,0,0); // planet->getRVWorldPosition();
+ // Transform to screen coordinates
+ Vector3 pos = camTransform * planet->getWorldPosition();
- // If you fly passed the description, it gets out of sight
- if (pos.z > 1.0)
- return;
-
- // Position text
- text_->setLeft((pos.x+1)/2); // The (0,0) Coordinate is in the upper left corner.
- text_->setTop((-pos.y+1)/2); // With those two calculations we set the desired positions
+ // If you fly passed the description, it gets out of sight
+ if (!(pos.z > 1.0)){
+
+ // Position text
+ texts[i]->setLeft((pos.x+1)/2); // The (0,0) Coordinate is in the upper left corner.
+ texts[i]->setTop((-pos.y+1)/2); // With those two calculations we set the desired positions
- // Make sure the overlays are shown
- text_->show();
+ // Make sure the overlays are shown
+ texts[i]->show();
+ }
+ i++;
+ }
}
-
- //void StoryModeHUD::addObject()
-
- /*void StoryModeHUD::removeObject(RadarViewable* viewable)
- {
- Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.text_);
- }*/
}
\ No newline at end of file
Modified: code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h
===================================================================
--- code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h 2017-11-20 15:48:03 UTC (rev 11583)
+++ code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h 2017-11-20 16:01:46 UTC (rev 11584)
@@ -51,8 +51,8 @@
private:
- Ogre::TextAreaOverlayElement* text_;
-
+ std::vector<Ogre::TextAreaOverlayElement*> texts;
+ void initialize();
void setTextSize(float size);
float getTextSize() const;
@@ -59,7 +59,6 @@
void setFont(const std::string& font);
const std::string& getFont() const;
-
std::string fontName_;
float textSize_;
More information about the Orxonox-commit
mailing list