[Orxonox-commit 5459] r10122 - code/branches/hudHS14/src/modules/overlays/hud
aejonas at orxonox.net
aejonas at orxonox.net
Wed Nov 12 16:08:14 CET 2014
Author: aejonas
Date: 2014-11-12 16:08:14 +0100 (Wed, 12 Nov 2014)
New Revision: 10122
Modified:
code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.cc
code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.h
Log:
health bar is now under the spaceship while moving
Modified: code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.cc 2014-11-12 15:07:10 UTC (rev 10121)
+++ code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.cc 2014-11-12 15:08:14 UTC (rev 10122)
@@ -81,6 +81,7 @@
this->setTextSize(0.05f);
this->setNavMarkerSize(0.03f);
this->setAimMarkerSize(0.02f);
+ this->setHealthMarkerSize(0.08f);
this->setDetectionLimit(10000.0f);
this->currentMunitionSpeed_ = 2500.0f;
@@ -115,6 +116,8 @@
XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode);
XMLPortParam(HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode);
XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlelement, mode);
+ XMLPortParam(HUDNavigation, "healthMarkerSize", setHealthMarkerSize, getHealthMarkerSize, xmlelement, mode);
+
}
void HUDNavigation::setFont(const std::string& font)
@@ -205,6 +208,7 @@
for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++markerCount, ++listIt)
{
+
std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.find(listIt->first);
closeEnough = listIt->second < this->detectionLimit_;
// display radarviewables on HUD if the marker limit and max-distance is not exceeded
@@ -274,6 +278,8 @@
}
+
+
// Transform to screen coordinates
Vector3 pos = camTransform * it->first->getRVWorldPosition();
@@ -357,7 +363,12 @@
{
// Object is in view
- // Change material only if outOfView changed
+
+
+
+
+
+ // Change material only if outOfView changed
if (it->second.wasOutOfView_)
{
//it->second.panel_->setMaterialName("Orxonox/NavTDC");
@@ -366,12 +377,19 @@
it->second.target_->setDimensions(this->aimMarkerSize_ * this->getActualSize().x, this->aimMarkerSize_ * this->getActualSize().y);
//manipulation bzw versuch !!! Jonas
- it->second.health_->setMaterialName(TextureGenerator::getMaterialName("bar2b.png", it->first->getRadarObjectColour()));
+ it->second.health_->setMaterialName(TextureGenerator::getMaterialName("bar2.png", it->first->getRadarObjectColour()));
+ it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x, this->healthMarkerSize_ * this->getActualSize().y);
it->second.wasOutOfView_ = false;
}
+
+ //i need to find the place where the amount of health is saved!!!
+ //this->selectedTarget_->getWorldEntity()->
+
+
// Position health (versuch !!!!)
+ it->second.health_->setUV(0.0f, 0.0f, 1.0f, 1.0f);
it->second.health_->setLeft((pos.x + 1.0f - it->second.panel_->getWidth()) * 0.5f);
it->second.health_->setTop((-pos.y + 1.0f - it->second.panel_->getHeight()) * 0.5f);
@@ -430,7 +448,7 @@
else // do not display on HUD
{
- it->second.health_->hide()
+ it->second.health_->hide();
it->second.panel_->hide();
it->second.text_->hide();
it->second.target_->hide();
@@ -486,7 +504,7 @@
Ogre::PanelOverlayElement* health = static_cast<Ogre::PanelOverlayElement*>( Ogre::OverlayManager::getSingleton()
.createOverlayElement("Panel", "HUDNavigation_healthMarker_" + getUniqueNumberString()));
//panel->setMaterialName("Orxonox/NavTDC");
- health->setMaterialName(TextureGenerator::getMaterialName("bar2b.png", object->getRadarObjectColour()));
+ health->setMaterialName(TextureGenerator::getMaterialName("bar2.png", object->getRadarObjectColour()));
health->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale);
//panel->setColour(object->getRadarObjectColour());
@@ -518,7 +536,7 @@
text->hide();
ObjectInfo tempStruct =
- { health, panel, target, text, false, false, false, false};
+ { health, panel, target, text, false, false, false};
this->activeObjectList_[object] = tempStruct;
this->background_->addChild(health);
Modified: code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.h
===================================================================
--- code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.h 2014-11-12 15:07:10 UTC (rev 10121)
+++ code/branches/hudHS14/src/modules/overlays/hud/HUDNavigation.h 2014-11-12 15:08:14 UTC (rev 10122)
@@ -77,9 +77,8 @@
struct ObjectInfo
{
- //manipulation bzw versuch !!! Jonas
+ //manipulation bzw versuch !!! health additional
Ogre::PanelOverlayElement* health_;
-
Ogre::PanelOverlayElement* panel_;
Ogre::PanelOverlayElement* target_;
Ogre::TextAreaOverlayElement* text_;
@@ -91,6 +90,14 @@
bool showObject(RadarViewable* rv);
// XMLPort accessors
+ inline void setHealthMarkerSize(float size)
+ {
+ this->healthMarkerSize_ = size;
+ this->sizeChanged();
+ }
+ inline float getHealthMarkerSize() const
+ { return healthMarkerSize_; }
+
inline void setNavMarkerSize(float size)
{
this->navMarkerSize_ = size;
@@ -103,6 +110,7 @@
this->aimMarkerSize_ = size;
this->sizeChanged();
}
+
inline float getAimMarkerSize() const
{ return aimMarkerSize_; }
inline void setDetectionLimit(float limit)
@@ -124,6 +132,7 @@
std::map<RadarViewable*, ObjectInfo> activeObjectList_;
std::list<std::pair<RadarViewable*, unsigned int> > sortedObjectList_;
+ float healthMarkerSize_;
float navMarkerSize_;
float aimMarkerSize_;
std::string fontName_;
More information about the Orxonox-commit
mailing list