[Orxonox-commit 6638] r11277 - in code/branches/HUD_HS16: data/overlays src/modules/overlays src/modules/overlays/hud src/modules/pickup

patricwi at orxonox.net patricwi at orxonox.net
Mon Nov 7 17:08:11 CET 2016


Author: patricwi
Date: 2016-11-07 17:08:11 +0100 (Mon, 07 Nov 2016)
New Revision: 11277

Modified:
   code/branches/HUD_HS16/data/overlays/HUDTemplates3.oxo
   code/branches/HUD_HS16/data/overlays/HUDTemplatesFPS.oxo
   code/branches/HUD_HS16/src/modules/overlays/OverlaysPrereqs.h
   code/branches/HUD_HS16/src/modules/overlays/hud/CMakeLists.txt
   code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc
   code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h
   code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc
   code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h
   code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc
Log:
visualization of pickup system initiated. next steps: add pickup icons when picked up

Modified: code/branches/HUD_HS16/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/HUD_HS16/data/overlays/HUDTemplates3.oxo	2016-11-07 15:07:14 UTC (rev 11276)
+++ code/branches/HUD_HS16/data/overlays/HUDTemplates3.oxo	2016-11-07 16:08:11 UTC (rev 11277)
@@ -187,14 +187,14 @@
     <HUDPickupSystem
      name                   = "PickupSystem"
      correctaspect          = true
-     position               = "0.45, 0.95"
+     position               = "0.32, 0.81"
      pickpoint              = "0.0, 0.0"
      visible                = "true"
     />
 
     <HUDTimer
      name     = "Timer"
-     position = "0.5, 0.85"
+     position = "0.5, 0.25"
      font     = "VeraMono"
      textsize = 0.1
      colour   = "1.0, 1.0, 0.0, 0.8"

Modified: code/branches/HUD_HS16/data/overlays/HUDTemplatesFPS.oxo
===================================================================
--- code/branches/HUD_HS16/data/overlays/HUDTemplatesFPS.oxo	2016-11-07 15:07:14 UTC (rev 11276)
+++ code/branches/HUD_HS16/data/overlays/HUDTemplatesFPS.oxo	2016-11-07 16:08:11 UTC (rev 11277)
@@ -103,6 +103,14 @@
      weaponModeHUDSize      = "0.09, 0.03"
     />
 
+    <HUDPickupSystem
+     name                   = "PickupSystem"
+     correctaspect          = true
+     position               = "0.45, 0.95"
+     pickpoint              = "0.0, 0.0"
+     visible                = "true"
+    />
+
     <HUDTimer
      name     = "Timer"
      position = "0.5, 0.85"

Modified: code/branches/HUD_HS16/src/modules/overlays/OverlaysPrereqs.h
===================================================================
--- code/branches/HUD_HS16/src/modules/overlays/OverlaysPrereqs.h	2016-11-07 15:07:14 UTC (rev 11276)
+++ code/branches/HUD_HS16/src/modules/overlays/OverlaysPrereqs.h	2016-11-07 16:08:11 UTC (rev 11277)
@@ -103,6 +103,8 @@
     class LastManStandingInfos;
     class PauseNotice;
     class TeamBaseMatchScore;
+    class HUDPickupSystem;
+    class HUDPickupItem;
 
     // stats
     class CreateLines;

Modified: code/branches/HUD_HS16/src/modules/overlays/hud/CMakeLists.txt
===================================================================
--- code/branches/HUD_HS16/src/modules/overlays/hud/CMakeLists.txt	2016-11-07 15:07:14 UTC (rev 11276)
+++ code/branches/HUD_HS16/src/modules/overlays/hud/CMakeLists.txt	2016-11-07 16:08:11 UTC (rev 11277)
@@ -13,6 +13,8 @@
   HUDWeaponMode.cc
   HUDWeapon.cc
   HUDWeaponSystem.cc
+  HUDPickupItem.cc
+  HUDPickupSystem.cc
   ChatOverlay.cc
   AnnounceMessage.cc
   KillMessage.cc

Modified: code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc	2016-11-07 15:07:14 UTC (rev 11276)
+++ code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc	2016-11-07 16:08:11 UTC (rev 11277)
@@ -28,23 +28,31 @@
 
 #include "HUDPickupItem.h"
 
+#include <string>
+
+
+#include <OgreOverlayManager.h>
+#include <OgrePanelOverlayElement.h> 
+
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
 #include "util/Convert.h"
 #include "core/class/Super.h"
+#include "HUDPickupItem.h"
 
 namespace orxonox
 {
     RegisterClass(HUDPickupItem);
+    Ogre::PanelOverlayElement* overlayElement_;
 
     HUDPickupItem::HUDPickupItem(Context* context) : OrxonoxOverlay(context)
     {
         RegisterObject(HUDPickupItem);
 
         overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDPickupItem" + getUniqueNumberString()));
-        overlayElement_->setMaterialName("Orxonox/WSHUD_Weapon");   //TODO be switched
+        
         overlayElement_->setPosition(0.0f,0.0f);
-        overlayElement_->setDimensions(1.0f,1.0f);
+        overlayElement_->setDimensions(0.5f,0.5f);
         this->background_->addChild(overlayElement_);
     }
 
@@ -52,10 +60,15 @@
     {
         if (this->isInitialized())
         {
-            destroyHUDChilds();
+            overlayElement_=nullptr;
         }
     }
 
+    void initializeMaterial(std::string s)
+    {
+        overlayElement_->setMaterialName(s);
+    }
+
     // void HUDWeapon::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     // {
     //     SUPER(HUDWeapon, XMLPort, xmlelement, mode);

Modified: code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h
===================================================================
--- code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h	2016-11-07 15:07:14 UTC (rev 11276)
+++ code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h	2016-11-07 16:08:11 UTC (rev 11277)
@@ -15,9 +15,7 @@
 #include "tools/interfaces/Tickable.h"
 #include "worldentities/pawns/Pawn.h"
 #include "overlays/OverlayGroup.h"
-#include "weaponsystem/Weapon.h"
-#include "weaponsystem/WeaponMode.h"
-#include "HUDWeaponMode.h"
+#include "pickup/Pickup.h"
 
 namespace orxonox
 {
@@ -27,16 +25,17 @@
         HUDPickupItem(Context* context);
         virtual ~HUDPickupItem();
 
-        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
-        virtual void tick(float dt) override;
-        virtual void changedOwner() override;
-        virtual void changedOverlayGroup() override;
-        virtual void changedVisibility() override;
-        virtual void changedName() override;
-        virtual void positionChanged() override;
-        virtual void sizeChanged() override;
+        // virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+        // virtual void tick(float dt) override;
+        // virtual void changedOwner() override;
+        // virtual void changedOverlayGroup() override;
+        // virtual void changedVisibility() override;
+        // virtual void changedName() override;
+        // virtual void positionChanged() override;
+        // virtual void sizeChanged() override;
 
-        void setPickup(Pickup* pickup);     
+        // void setPickup(Pickup* pickup);  
+        void initializeMaterial(std::string s);   
 
     private:
         // void createHUDChilds();
@@ -49,7 +48,6 @@
         WeakPtr<Pawn> owner_;
         WeakPtr<Pickup> pickup_;
 
-        Ogre::PanelOverlayElement* overlayElement_;
     };
 }
 

Modified: code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc	2016-11-07 15:07:14 UTC (rev 11276)
+++ code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc	2016-11-07 16:08:11 UTC (rev 11277)
@@ -26,10 +26,16 @@
  *
  */
 
+#include <vector>
+#include <string>
+
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
 #include "util/Convert.h"
 #include "core/class/Super.h"
+#include "HUDPickupSystem.h"
+#include "pickup/Pickup.h"
+#include "HUDPickupItem.h"
 
 namespace orxonox
 {
@@ -39,6 +45,13 @@
     {
         RegisterObject(HUDPickupSystem);
 
+        overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDPickupSystem" + getUniqueNumberString()));
+        overlayElement_->setMaterialName("PickupBar");
+        overlayElement_->setPosition(0.0f,0.0f);
+        overlayElement_->setDimensions(0.70f,0.15f);
+        orxout() << "hello HUDPickupSystem" << endl;
+        this->background_->addChild(overlayElement_);
+
     }
 
     HUDPickupSystem::~HUDPickupSystem()
@@ -51,9 +64,13 @@
 
    //TODO: XMLPort
 
-    void HUDPickupSystem::updatePickupList()
+    void HUDPickupSystem::updatePickupList(std::vector<Pickup> picks)
     {
-        
+        for(Pickup p : picks)
+        {
+            HUDPickupItem item = new HUDPickupItem(this->getContext());
+            item.initializeMaterial(p.getRepresentationName());
+        }
     }
 
     void HUDPickupSystem::createPickupList()

Modified: code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h
===================================================================
--- code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h	2016-11-07 15:07:14 UTC (rev 11276)
+++ code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h	2016-11-07 16:08:11 UTC (rev 11277)
@@ -31,9 +31,15 @@
 #include <vector>
 #include <string>
 
+
+#include <OgreOverlayManager.h>
+#include <OgrePanelOverlayElement.h> 
+
 #include "overlays/OrxonoxOverlay.h"
 #include "worldentities/pawns/Pawn.h"
 #include "overlays/OverlayGroup.h"
+#include "pickup/Pickup.h"
+#include "pickup/PickupRepresentation.h"
 
 namespace orxonox
 {
@@ -50,9 +56,14 @@
         // virtual void changedName() override;
         // virtual void positionChanged() override;
         // virtual void sizeChanged() override;
-    protected:
-        void updatePickupList();
+    private:
+        void updatePickupList(std::vector<Pickup> picks);
         void createPickupList();
         void destroyAll();
+
+        Ogre::PanelOverlayElement* overlayElement_;
+        WeakPtr<Pawn> owner_;
+
+        std::vector<PickupRepresentation> pickupRepresentations_;
     };
 }
\ No newline at end of file

Modified: code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc	2016-11-07 15:07:14 UTC (rev 11276)
+++ code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc	2016-11-07 16:08:11 UTC (rev 11277)
@@ -50,6 +50,7 @@
 
 #include "CollectiblePickup.h"
 #include "PickupRepresentation.h"
+// #include "overlays/hud/HUDPickupSystem.h"
 
 namespace orxonox
 {
@@ -377,7 +378,7 @@
 
     //This function is called by the command line or by the key binding
     //it uses or unuses the pickup, depending on its current state
-    void PickupManager::useUnusePickup(uint32_t index) //uint32_t index
+    void PickupManager::useUnusePickup(uint32_t index) 
     {
         orxout() << "Hello there I was here " << index << endl;
 




More information about the Orxonox-commit mailing list