[Orxonox-commit 3229] r7920 - in code/branches/hudimprovements: data/overlays src/modules/overlays src/modules/overlays/hud src/orxonox/worldentities/pawns

bknecht at orxonox.net bknecht at orxonox.net
Sun Feb 20 00:33:06 CET 2011


Author: bknecht
Date: 2011-02-20 00:33:06 +0100 (Sun, 20 Feb 2011)
New Revision: 7920

Added:
   code/branches/hudimprovements/src/modules/overlays/hud/HUDBoostBar.cc
   code/branches/hudimprovements/src/modules/overlays/hud/HUDBoostBar.h
Modified:
   code/branches/hudimprovements/data/overlays/HUDTemplates3.oxo
   code/branches/hudimprovements/src/modules/overlays/OverlaysPrereqs.h
   code/branches/hudimprovements/src/modules/overlays/hud/CMakeLists.txt
   code/branches/hudimprovements/src/orxonox/worldentities/pawns/SpaceShip.h
Log:
added HUDBoostBar, an additional bar in the HUD to determine available boost. The bar is invisible when we have permanent boost.

Modified: code/branches/hudimprovements/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/hudimprovements/data/overlays/HUDTemplates3.oxo	2011-02-19 20:56:53 UTC (rev 7919)
+++ code/branches/hudimprovements/data/overlays/HUDTemplates3.oxo	2011-02-19 23:33:06 UTC (rev 7920)
@@ -34,7 +34,7 @@
      name              = "HealthBar1"
      background        = "Orxonox/HealthBarBackground"
      size              = "0.35, 0.0875"
-     position          = "0.0 , 0.95 "
+     position          = "0.0 , 0.9 "
      pickpoint         = "0, 1"
      bartexture        = "healthbar_bar.png"
      textfont          = "VeraMono"
@@ -55,7 +55,7 @@
      name          = "SpeedBar1"
      background    = "Orxonox/BarBackground"
      size          = "0.35, 0.05"
-     position      = "0.0 , 1.0 "
+     position      = "0.0 , 0.95 "
      pickpoint     = "0, 1"
      correctaspect = false
     >
@@ -64,6 +64,19 @@
       <BarColour position = 1.0 colour = "0.7,0.2,0.2" />
     </HUDSpeedBar>
 
+    <HUDBoostBar
+     name          = "BoostBar1"
+     background    = "Orxonox/BarBackground"
+     size          = "0.35, 0.05"
+     position      = "0.0 , 1.0 "
+     pickpoint     = "0, 1"
+     correctaspect = false
+    >
+      <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
+      <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
+      <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
+    </HUDBoostBar>
+
     <HUDNavigation
      name          = "Navigation"
      correctaspect = true

Modified: code/branches/hudimprovements/src/modules/overlays/OverlaysPrereqs.h
===================================================================
--- code/branches/hudimprovements/src/modules/overlays/OverlaysPrereqs.h	2011-02-19 20:56:53 UTC (rev 7919)
+++ code/branches/hudimprovements/src/modules/overlays/OverlaysPrereqs.h	2011-02-19 23:33:06 UTC (rev 7920)
@@ -85,6 +85,7 @@
     class HUDNavigation;
     class HUDRadar;
     class HUDSpeedBar;
+    class HUDBoostBar;
     class HUDTimer;
     class KillMessage;
     class LastManStandingInfos;

Modified: code/branches/hudimprovements/src/modules/overlays/hud/CMakeLists.txt
===================================================================
--- code/branches/hudimprovements/src/modules/overlays/hud/CMakeLists.txt	2011-02-19 20:56:53 UTC (rev 7919)
+++ code/branches/hudimprovements/src/modules/overlays/hud/CMakeLists.txt	2011-02-19 23:33:06 UTC (rev 7920)
@@ -3,6 +3,7 @@
   HUDNavigation.cc
   HUDRadar.cc
   HUDSpeedBar.cc
+  HUDBoostBar.cc
   HUDHealthBar.cc
   HUDTimer.cc
   ChatOverlay.cc

Added: code/branches/hudimprovements/src/modules/overlays/hud/HUDBoostBar.cc
===================================================================
--- code/branches/hudimprovements/src/modules/overlays/hud/HUDBoostBar.cc	                        (rev 0)
+++ code/branches/hudimprovements/src/modules/overlays/hud/HUDBoostBar.cc	2011-02-19 23:33:06 UTC (rev 7920)
@@ -0,0 +1,72 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "HUDBoostBar.h"
+
+#include "core/CoreIncludes.h"
+#include "worldentities/pawns/SpaceShip.h"
+#include "items/Engine.h"
+
+namespace orxonox
+{
+    CreateFactory(HUDBoostBar);
+
+    HUDBoostBar::HUDBoostBar(BaseObject* creator)
+        : HUDBar(creator)
+    {
+        RegisterObject(HUDBoostBar);
+
+        this->owner_ = 0;
+    }
+
+    HUDBoostBar::~HUDBoostBar()
+    {
+    }
+
+    void HUDBoostBar::tick(float dt)
+    {
+        SUPER(HUDBoostBar, tick, dt);
+
+        if (this->owner_ /*&& !this->owner_->getPermanentBoost()*/)
+        {
+            this->show();
+            float value = this->owner_->getBoostPower() / this->owner_->getInitialBoostPower();
+            this->setValue(value);
+        }
+        /*else
+            this->hide();*/
+    }
+
+    void HUDBoostBar::changedOwner()
+    {
+        SUPER(HUDBoostBar, changedOwner);
+
+        this->owner_ = orxonox_cast<SpaceShip*>(this->getOwner());
+    }
+}
+

Added: code/branches/hudimprovements/src/modules/overlays/hud/HUDBoostBar.h
===================================================================
--- code/branches/hudimprovements/src/modules/overlays/hud/HUDBoostBar.h	                        (rev 0)
+++ code/branches/hudimprovements/src/modules/overlays/hud/HUDBoostBar.h	2011-02-19 23:33:06 UTC (rev 7920)
@@ -0,0 +1,52 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _HUDBoostBar_H__
+#define _HUDBoostBar_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "HUDBar.h"
+
+namespace orxonox
+{
+    class _OverlaysExport HUDBoostBar : public HUDBar, public Tickable
+    {
+    public:
+        HUDBoostBar(BaseObject* creator);
+        virtual ~HUDBoostBar();
+
+        virtual void tick(float dt);
+        virtual void changedOwner();
+
+    private:
+        SpaceShip* owner_;
+    };
+}
+#endif /* _HUDBoostBar_H__ */

Modified: code/branches/hudimprovements/src/orxonox/worldentities/pawns/SpaceShip.h
===================================================================
--- code/branches/hudimprovements/src/orxonox/worldentities/pawns/SpaceShip.h	2011-02-19 20:56:53 UTC (rev 7919)
+++ code/branches/hudimprovements/src/orxonox/worldentities/pawns/SpaceShip.h	2011-02-19 23:33:06 UTC (rev 7920)
@@ -73,6 +73,11 @@
             inline bool getBoost() const
                 { return this->bBoost_; }
 
+            inline float getBoostPower()
+                { return this->boostPower_; }
+            inline float getInitialBoostPower()
+                { return this->initialBoostPower_; }
+
             inline void setEngineTemplate(const std::string& temp)
                 { this->enginetemplate_ = temp; this->loadEngineTemplate(); }
             inline const std::string& getEngineTemplate() const
@@ -107,7 +112,7 @@
             virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
 
             void loadEngineTemplate();
-            
+
             void boostCooledDown(void);
 
             std::string enginetemplate_;




More information about the Orxonox-commit mailing list