Index: code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt	(revision 10685)
+++ code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt	(revision 10688)
@@ -8,4 +8,7 @@
   HUDTimer.cc
   HUDEnemyHealthBar.cc
+  HUDWeaponMode.cc
+  HUDWeapon.cc
+  HUDWeaponSystem.cc
   ChatOverlay.cc
   AnnounceMessage.cc
Index: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc	(revision 10688)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc	(revision 10688)
@@ -0,0 +1,186 @@
+/*
+ *   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:
+ *      Yuning Chai
+ *      Felix Schulthess
+ *   Co-authors:
+ *      Reto Grieder
+ *      Wolfgang Roenninger
+ *
+ */
+
+#include "HUDWeapon.h"
+
+#include <OgreOverlayManager.h>
+#include <OgrePanelOverlayElement.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/TextureGenerator.h"
+#include "util/Convert.h"
+#include "core/class/Super.h"
+
+namespace orxonox
+{
+    RegisterClass(HUDWeapon);
+
+    HUDWeapon::HUDWeapon(Context* context) : OrxonoxOverlay(context)
+    {
+        RegisterObject(HUDWeapon);
+
+        overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeapon" + getUniqueNumberString()));
+        overlayElement_->setMaterialName("Orxonox/WSHUD_Weapon");
+        overlayElement_->setPosition(0.0f,0.0f);
+        overlayElement_->setDimensions(1.0f,1.0f);
+        this->background_->addChild(overlayElement_);
+    }
+
+    HUDWeapon::~HUDWeapon()
+    {
+        if (this->isInitialized())
+        {
+            destroyHUDChilds();
+            //this->overlayElement_->destroy();            
+        }
+    }
+
+    void HUDWeapon::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(HUDWeapon, XMLPort, xmlelement, mode);
+
+        /*XMLPortParam(HUDWeapons, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlelement, mode);
+        XMLPortParam(HUDWeapons, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlelement, mode);*/
+    }
+
+    void HUDWeapon::tick(float dt)
+    {
+        SUPER(HUDWeapon, tick, dt);
+
+        if (this->owner_)
+        {
+
+        }
+    }    
+
+    void HUDWeapon::positionChanged()
+    {
+        OrxonoxOverlay::positionChanged();
+
+        positionHUDChilds();
+    }     
+
+    void HUDWeapon::changedOwner()
+    {
+        SUPER(HUDWeapon, changedOwner);
+
+        this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
+
+        updateWeaponModeList();
+    }
+
+    void HUDWeapon::changedOverlayGroup()
+    {
+        SUPER(HUDWeapon, changedOverlayGroup);
+
+        //this->getOverlayGroup()->addElement(this->textOverlay_.get());
+    }   
+
+    void HUDWeapon::changedVisibility()
+    {
+        SUPER(HUDWeapon, changedVisibility);
+
+        //this->textOverlay_->setVisible(this->isVisible());
+    }
+
+    void HUDWeapon::changedName()
+    {
+        SUPER(HUDWeapon, changedName);
+
+        //this->textOverlay_->setName(this->getName() + "text");
+    }
+
+    void HUDWeapon::setWeapon(Weapon* weapon)
+    {
+        weapon_ = weapon;
+
+        if (!weapon_)
+        {
+            return;
+        }
+
+        updateWeaponModeList();
+    }
+
+    void HUDWeapon::updateWeaponModeList()
+    {
+        if (owner_ == NULL || weapon_ == NULL)
+        {
+            return;
+        }
+            
+        destroyHUDChilds();
+
+        weaponModes_ = weapon_->getAllWeaponmodes();
+
+        createHUDChilds();
+        positionHUDChilds();        
+    }  
+
+    void HUDWeapon::createHUDChilds()
+    {
+        for (std::multimap<unsigned int, WeaponMode*>::iterator it = weaponModes_->begin(); it != weaponModes_->end(); ++it)
+        {
+            HUDWeaponMode* hudWeaponMode = new HUDWeaponMode(this->getContext());
+            hudWeaponMode->setOwner(owner_);
+            hudWeaponMode->setWeaponMode(it->second);
+            hudWeaponModes_.push_back(hudWeaponMode);
+        }    
+    }      
+
+    void HUDWeapon::positionHUDChilds()
+    {
+        int positionIndex = 0;
+
+        for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
+        {
+            (*it)->setOverlayGroup(this->getOverlayGroup());            
+            (*it)->setAspectCorrection(this->getAspectCorrection());
+            (*it)->setPosition(this->getPosition() + Vector2(0.0f,0.025f*positionIndex));
+            (*it)->setSize(Vector2(0.15f,0.025f));
+            (*it)->setPickPoint(Vector2(0.0f,0.0f));
+
+            ++ positionIndex;        
+        }
+
+        overlayElement_->setDimensions(1.0f,0.25f*hudWeaponModes_.size());
+    }  
+
+    void HUDWeapon::destroyHUDChilds()
+    {
+        for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
+        {
+            (*it)->destroy();
+        } 
+
+        hudWeaponModes_.clear();
+    }
+}
Index: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h	(revision 10688)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h	(revision 10688)
@@ -0,0 +1,87 @@
+/*
+ *   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:
+ *      Fabien Vultier
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _HUDWeapon_H__
+#define _HUDWeapon_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include <map>
+#include <vector>
+#include <string>
+
+#include <OgreOverlayManager.h>
+#include <OgreMaterialManager.h>
+#include <OgreTechnique.h>
+#include <OgrePass.h>
+#include <OgrePanelOverlayElement.h> 
+
+#include "overlays/OrxonoxOverlay.h"
+#include "overlays/OverlayText.h"
+#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"
+
+namespace orxonox
+{
+    class _OverlaysExport HUDWeapon : public OrxonoxOverlay, public Tickable
+    {
+    public:
+        HUDWeapon(Context* context);
+        virtual ~HUDWeapon();
+
+        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+        virtual void tick(float dt);
+        virtual void changedOwner();
+        virtual void changedOverlayGroup();
+        virtual void changedVisibility();
+        virtual void changedName();
+        virtual void positionChanged(); 
+
+        virtual void setWeapon(Weapon* weapon);
+
+    private:
+        virtual void createHUDChilds();
+        virtual void positionHUDChilds();
+        virtual void destroyHUDChilds();        
+        virtual void updateWeaponModeList();
+
+        WeakPtr<Pawn> owner_;
+        WeakPtr<Weapon> weapon_;
+
+        std::multimap<unsigned int, WeaponMode*>* weaponModes_;
+        std::vector<WeakPtr<HUDWeaponMode> > hudWeaponModes_;
+
+        Ogre::PanelOverlayElement* overlayElement_;        
+    };
+}
+
+#endif /* _HUDWeapon_H__ */
Index: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc	(revision 10688)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc	(revision 10688)
@@ -0,0 +1,258 @@
+/*
+ *   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:
+ *      Yuning Chai
+ *      Felix Schulthess
+ *   Co-authors:
+ *      Reto Grieder
+ *      Wolfgang Roenninger
+ *
+ */
+
+#include "HUDWeaponMode.h"
+
+#include <OgreOverlayManager.h>
+#include <OgrePanelOverlayElement.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/TextureGenerator.h"
+#include "weaponsystem/WeaponMode.h"
+#include "weaponsystem/Munition.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+    RegisterClass(HUDWeaponMode);
+
+    HUDWeaponMode::HUDWeaponMode(Context* context) : OrxonoxOverlay(context)
+    {
+        RegisterObject(HUDWeaponMode);
+
+        overlayElementIcon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeaponMode" + getUniqueNumberString()));
+        overlayElementIcon_->setPosition(0.0f,0.0f);
+        overlayElementIcon_->setDimensions(1.0f,1.0f);
+        this->background_->addChild(overlayElementIcon_);
+
+        overlayElementReplenish_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeaponMode" + getUniqueNumberString()));
+        overlayElementReplenish_->setPosition(0.0f,0.0f);
+        overlayElementReplenish_->setDimensions(1.0f,1.0f);
+        this->background_->addChild(overlayElementReplenish_);
+
+        overlayElementMunition_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeaponMode" + getUniqueNumberString()));
+        overlayElementMunition_->setPosition(0.0f,0.0f);
+        overlayElementMunition_->setDimensions(1.0f,1.0f);
+        this->background_->addChild(overlayElementMunition_);
+
+        overlayElementState_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeaponMode" + getUniqueNumberString()));
+        overlayElementState_->setPosition(0.0f,0.0f);
+        overlayElementState_->setDimensions(1.0f,1.0f);
+        this->background_->addChild(overlayElementState_);
+
+        overlayElementIcon_->show();
+        overlayElementReplenish_->show();
+        overlayElementMunition_->show();
+        overlayElementState_->show();
+
+        // Create two text overlays
+        this->textOverlayLeft_ = new OverlayText(this->getContext());
+        assert(this->textOverlayLeft_.get());
+        this->textOverlayLeft_->setCaption("???");
+        textOverlayLeft_->setPickPoint(Vector2(0.0f,0.0f));
+        textOverlayLeft_->setVisible(true);
+        textOverlayLeft_->setAlignment(OverlayText::Left);
+        textOverlayLeft_->setTextSize(0.02f);
+        textOverlayLeft_->setColour(ColourValue(0.21,0.70,0.21,1.0));
+        textOverlayLeft_->setPosition(getPosition());
+        textOverlayLeft_->setAspectCorrection(this->getAspectCorrection());
+        
+        this->textOverlayRight_ = new OverlayText(this->getContext());
+        assert(this->textOverlayLeft_.get());
+        this->textOverlayRight_->setCaption("???");
+        textOverlayRight_->setPickPoint(Vector2(0.0f,0.0f));
+        textOverlayRight_->setVisible(true);
+        textOverlayRight_->setAlignment(OverlayText::Left);
+        textOverlayRight_->setTextSize(0.02f);
+        textOverlayRight_->setColour(ColourValue(0.21,0.70,0.21,1.0));
+        textOverlayRight_->setPosition(getPosition());
+        textOverlayRight_->setAspectCorrection(this->getAspectCorrection());        
+
+        materialNameState_ = "Orxonox/WSHUD_Reloading";
+
+        overlayElementReplenish_->setMaterialName("Orxonox/WSHUD_Replenish");
+    }
+
+    HUDWeaponMode::~HUDWeaponMode()
+    {
+        if (this->isInitialized())
+        {
+            //this->textOverlay_->destroy();            
+        }
+    }
+
+    void HUDWeaponMode::tick(float dt)
+    {
+        SUPER(HUDWeaponMode, tick, dt);
+
+        if (this->owner_ && this->weaponMode_)
+        {
+            std::string lastMaterialNameState = materialNameState_;
+
+            if (weaponMode_->getReloading())
+            {
+                materialNameState_ = "Orxonox/WSHUD_Reloading";
+            }
+            else
+            {
+                materialNameState_ = "Orxonox/WSHUD_Ready";
+            }            
+
+            Munition* munition = this->weaponMode_->getMunition();
+
+            if (munition != NULL)
+            {
+                bool useSeparateMagazines = munition->getUseSeparateMagazines();
+                bool stackMunition = munition->getStackMunition();
+
+                if (!useSeparateMagazines && !stackMunition)
+                {
+                    this->textOverlayLeft_->setCaption(multi_cast<std::string>(munition->getNumMunitionInCurrentMagazine(weaponMode_)));
+                    this->textOverlayRight_->setCaption(multi_cast<std::string>(munition->getNumMagazines()));
+                }
+                else if (!useSeparateMagazines && stackMunition)
+                {
+                    this->textOverlayLeft_->setCaption(multi_cast<std::string>(munition->getNumMunition(weaponMode_)));
+                    this->textOverlayRight_->setCaption("");
+                }
+                else if (useSeparateMagazines && !stackMunition)
+                {
+                    this->textOverlayLeft_->setCaption(multi_cast<std::string>(munition->getNumMunitionInCurrentMagazine(weaponMode_)));
+                    this->textOverlayRight_->setCaption(multi_cast<std::string>(munition->getNumMagazines()));
+                }
+
+                if (munition->getNumMunition(weaponMode_) == 0)
+                {
+                    materialNameState_ = "Orxonox/WSHUD_Empty";
+                }
+            }
+
+            if (munition->isA(Class(ReplenishingMunition)))
+            {
+                ReplenishingMunition* replenishingMunition = dynamic_cast<ReplenishingMunition*>(munition);
+
+                if (replenishingMunition->canAddMunition(1))
+                {
+                    float progress = 1.0f - replenishingMunition->getProgress();
+                    overlayElementReplenish_->setDimensions(1.0f,progress);                    
+                }
+                else
+                {
+                    overlayElementReplenish_->setDimensions(1.0f,1.0f);
+                }
+            }
+
+            if (materialNameState_ != lastMaterialNameState)
+            {
+                overlayElementState_->setMaterialName(materialNameState_);
+            }
+        }
+    }    
+
+    void HUDWeaponMode::positionChanged()
+    {
+        OrxonoxOverlay::positionChanged();
+
+        positionHUDChilds();
+    }    
+
+    void HUDWeaponMode::changedOwner()
+    {
+        SUPER(HUDWeaponMode, changedOwner);
+
+        this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
+
+        //updateWeaponsList();
+    }
+
+    void HUDWeaponMode::changedOverlayGroup()
+    {
+        SUPER(HUDWeaponMode, changedOverlayGroup);
+
+        this->getOverlayGroup()->addElement(this->textOverlayLeft_.get());
+        this->getOverlayGroup()->addElement(this->textOverlayRight_.get());
+    }   
+
+    void HUDWeaponMode::changedVisibility()
+    {
+        SUPER(HUDWeaponMode, changedVisibility);
+
+        //this->textOverlay_->setVisible(this->isVisible());
+    }
+
+    void HUDWeaponMode::changedName()
+    {
+        SUPER(HUDWeaponMode, changedName);
+
+        //this->textOverlay_->setName(this->getName() + "text");
+    }  
+
+    void HUDWeaponMode::setWeaponMode(WeaponMode* weaponMode)
+    {
+        weaponMode_ = weaponMode;
+
+        if (!weaponMode_)
+        {
+            return;
+        }
+
+        std::string materialName = weaponMode_->getHUDImageString();
+
+        overlayElementIcon_->setMaterialName(materialName);
+
+        Munition* munition = this->weaponMode_->getMunition();
+
+        if (munition != NULL)
+        {
+            bool useSeparateMagazines = munition->getUseSeparateMagazines();
+            bool stackMunition = munition->getStackMunition();
+
+            if (!useSeparateMagazines && !stackMunition)
+            {
+                overlayElementMunition_->setMaterialName("Orxonox/WSHUD_MunitionShare");
+            }
+            else if (!useSeparateMagazines && stackMunition)
+            {
+                overlayElementMunition_->setMaterialName("Orxonox/WSHUD_MunitionStack");
+            }
+            else if (useSeparateMagazines && !stackMunition)
+            {
+                overlayElementMunition_->setMaterialName("Orxonox/WSHUD_MunitionSeparate");
+            }
+        }      
+    }
+
+    void HUDWeaponMode::positionHUDChilds()
+    {
+        textOverlayLeft_->setPosition(getPosition() + Vector2(0.06f,0.0f));
+        textOverlayRight_->setPosition(getPosition() + Vector2(0.105f,0.0f));
+    }  
+}
Index: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h	(revision 10688)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h	(revision 10688)
@@ -0,0 +1,86 @@
+/*
+ *   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:
+ *      Fabien Vultier
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _HUDWeaponMode_H__
+#define _HUDWeaponMode_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include <map>
+#include <vector>
+#include <string>
+
+#include <OgreOverlayManager.h>
+#include <OgreMaterialManager.h>
+#include <OgreTechnique.h>
+#include <OgrePass.h>
+#include <OgrePanelOverlayElement.h> 
+
+#include "overlays/OrxonoxOverlay.h"
+#include "overlays/OverlayText.h"
+#include "tools/interfaces/Tickable.h"
+#include "worldentities/pawns/Pawn.h"
+#include "overlays/OverlayGroup.h"
+#include "weaponsystem/ReplenishingMunition.h"
+
+namespace orxonox
+{
+    class _OverlaysExport HUDWeaponMode : public OrxonoxOverlay, public Tickable
+    {
+    public:
+        HUDWeaponMode(Context* context);
+        virtual ~HUDWeaponMode();
+
+        virtual void tick(float dt);
+        virtual void changedOwner();
+        virtual void changedOverlayGroup();
+        virtual void changedVisibility();
+        virtual void changedName();
+        virtual void positionChanged();
+
+        virtual void setWeaponMode(WeaponMode* weaponMode);
+
+    private:
+        virtual void positionHUDChilds();
+
+        WeakPtr<Pawn> owner_;
+        WeakPtr<WeaponMode> weaponMode_;
+
+        Ogre::PanelOverlayElement* overlayElementIcon_;
+        Ogre::PanelOverlayElement* overlayElementReplenish_;
+        Ogre::PanelOverlayElement* overlayElementMunition_;
+        Ogre::PanelOverlayElement* overlayElementState_;
+
+        std::string materialNameState_;
+
+        StrongPtr<OverlayText> textOverlayLeft_;
+        StrongPtr<OverlayText> textOverlayRight_;
+    };
+}
+
+#endif /* _HUDWeaponMode_H__ */
Index: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc	(revision 10688)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc	(revision 10688)
@@ -0,0 +1,183 @@
+/*
+ *   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:
+ *      Yuning Chai
+ *      Felix Schulthess
+ *   Co-authors:
+ *      Reto Grieder
+ *      Wolfgang Roenninger
+ *
+ */
+
+#include "HUDWeaponSystem.h"
+
+#include <OgreOverlayManager.h>
+#include <OgrePanelOverlayElement.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/TextureGenerator.h"
+#include "weaponsystem/WeaponSystem.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/Weapon.h"
+#include "util/Convert.h"
+#include "core/class/Super.h"
+
+namespace orxonox
+{
+    RegisterClass(HUDWeaponSystem);
+
+    HUDWeaponSystem::HUDWeaponSystem(Context* context) : OrxonoxOverlay(context)
+    {
+        RegisterObject(HUDWeaponSystem);
+
+        weapons_.clear();
+        hudWeapons_.clear();
+    }
+
+    HUDWeaponSystem::~HUDWeaponSystem()
+    {
+        if (this->isInitialized())
+        {
+            destroyHUDChilds();
+        }
+    }
+
+    void HUDWeaponSystem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(HUDWeaponSystem, XMLPort, xmlelement, mode);
+
+        /*XMLPortParam(HUDWeaponSystem, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlelement, mode);
+        XMLPortParam(HUDWeaponSystem, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlelement, mode);*/
+    }
+
+    void HUDWeaponSystem::tick(float dt)
+    {
+        SUPER(HUDWeaponSystem, tick, dt);
+
+        if (this->owner_)
+        {
+
+        }
+    }  
+
+    void HUDWeaponSystem::positionChanged()
+    {
+        OrxonoxOverlay::positionChanged();
+
+        positionHUDChilds();
+    }  
+
+    void HUDWeaponSystem::changedOwner()
+    {
+        SUPER(HUDWeaponSystem, changedOwner);
+
+        this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
+
+        updateWeaponList();
+    }
+
+    void HUDWeaponSystem::changedOverlayGroup()
+    {
+        SUPER(HUDWeaponSystem, changedOverlayGroup);
+
+        //this->getOverlayGroup()->addElement(this->textOverlay_.get());
+    }   
+
+    void HUDWeaponSystem::changedVisibility()
+    {
+        SUPER(HUDWeaponSystem, changedVisibility);
+
+        //this->textOverlay_->setVisible(this->isVisible());
+    }
+
+    void HUDWeaponSystem::changedName()
+    {
+        SUPER(HUDWeaponSystem, changedName);
+
+        //this->textOverlay_->setName(this->getName() + "text");
+    }  
+
+    void HUDWeaponSystem::updateWeaponList()
+    {
+        if (owner_ == NULL)
+        {
+            return;
+        }
+
+        weapons_.clear();
+
+        destroyHUDChilds();
+
+        std::vector<WeaponPack*>* weaponPacks = owner_->getAllWeaponPacks();
+
+        for (std::vector<WeaponPack*>::const_iterator itPacks = weaponPacks->begin(); itPacks != weaponPacks->end(); ++itPacks)
+        {
+            std::vector<Weapon*>* weapons = (*itPacks)->getAllWeapons();
+
+            for (std::vector<Weapon*>::const_iterator itWeapons = weapons->begin(); itWeapons != weapons->end(); ++itWeapons)
+            {
+                this->weapons_.push_back(*itWeapons);
+            }
+        }
+
+        createHUDChilds();
+        positionHUDChilds();        
+    }
+
+    void HUDWeaponSystem::createHUDChilds()
+    {
+        for (std::vector<WeakPtr<Weapon> >::iterator it = weapons_.begin(); it != weapons_.end(); ++it)
+        {
+            HUDWeapon* hudWeapon = new HUDWeapon(this->getContext());            
+            hudWeapon->setOwner(owner_);
+            hudWeapon->setWeapon(*it);
+            hudWeapons_.push_back(hudWeapon);
+        }       
+    }      
+
+    void HUDWeaponSystem::positionHUDChilds()
+    {
+        int positionIndex = 0;
+
+        for (std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)
+        {
+            (*it)->setOverlayGroup(this->getOverlayGroup());            
+            (*it)->setAspectCorrection(this->getAspectCorrection());
+            (*it)->setPosition(this->getPosition() + Vector2(0.15f*positionIndex,0.0f));            
+            (*it)->setSize(Vector2(0.15f,0.10f));
+            (*it)->setPickPoint(Vector2(0.0f,0.0f));
+
+            ++ positionIndex;
+        }        
+    }  
+
+    void HUDWeaponSystem::destroyHUDChilds()
+    {
+        for (std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)
+        {
+            (*it)->destroy();
+        } 
+
+        hudWeapons_.clear();     
+    }     
+}
Index: code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.h	(revision 10688)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.h	(revision 10688)
@@ -0,0 +1,80 @@
+/*
+ *   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:
+ *      Fabien Vultier
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _HUDWeaponSystem_H__
+#define _HUDWeaponSystem_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include <map>
+#include <vector>
+#include <string>
+
+#include <OgreOverlayManager.h>
+#include <OgreMaterialManager.h>
+#include <OgreTechnique.h>
+#include <OgrePass.h>
+#include <OgrePanelOverlayElement.h> 
+
+#include "overlays/OrxonoxOverlay.h"
+#include "overlays/OverlayText.h"
+#include "tools/interfaces/Tickable.h"
+#include "worldentities/pawns/Pawn.h"
+#include "overlays/OverlayGroup.h"
+#include "HUDWeapon.h"
+
+namespace orxonox
+{
+    class _OverlaysExport HUDWeaponSystem : public OrxonoxOverlay, public Tickable
+    {
+    public:
+        HUDWeaponSystem(Context* context);
+        virtual ~HUDWeaponSystem();
+
+        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+        virtual void tick(float dt);
+        virtual void changedOwner();
+        virtual void changedOverlayGroup();
+        virtual void changedVisibility();
+        virtual void changedName();
+        virtual void positionChanged();     
+
+    private:
+        virtual void updateWeaponList();
+        virtual void createHUDChilds();
+        virtual void positionHUDChilds();
+        virtual void destroyHUDChilds();
+
+        WeakPtr<Pawn> owner_;
+
+        std::vector<WeakPtr<Weapon> > weapons_;
+        std::vector<WeakPtr<HUDWeapon> > hudWeapons_;
+    };
+}
+
+#endif /* _HUDWeaponSystem_H__ */
