Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 30, 2015, 7:51:49 PM (9 years ago)
Author:
fvultier
Message:

The weapon system HUD rescales properly if the window size changes.

Location:
code/branches/fabienHS15/src/modules
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc

    r10721 r10724  
    2929#include "HUDWeapon.h"
    3030
    31 #include <OgreOverlayManager.h>
    32 #include <OgrePanelOverlayElement.h>
    33 
    3431#include "core/CoreIncludes.h"
    3532#include "core/XMLPort.h"
    36 #include "tools/TextureGenerator.h"
    3733#include "util/Convert.h"
    3834#include "core/class/Super.h"
     
    186182            (*it)->setWeaponIndex(this->weaponIndex_);
    187183            (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
    188             (*it)->positionHUDChilds();
    189184
    190185            ++ positionIndex;
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h

    r10721 r10724  
    3737
    3838#include <OgreOverlayManager.h>
    39 #include <OgreMaterialManager.h>
    40 #include <OgreTechnique.h>
    41 #include <OgrePass.h>
    4239#include <OgrePanelOverlayElement.h>
    4340
    4441#include "overlays/OrxonoxOverlay.h"
    45 #include "overlays/OverlayText.h"
    4642#include "tools/interfaces/Tickable.h"
    4743#include "worldentities/pawns/Pawn.h"
     
    7975            { weaponIndex_ = index;
    8076              this->updatePosition();
    81             }
    82 
    83         virtual void positionHUDChilds();
     77            }       
    8478
    8579    private:
    8680        virtual void createHUDChilds();
    87        
     81        virtual void positionHUDChilds();
    8882        virtual void destroyHUDChilds();
    8983        virtual void updateWeaponModeList();
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc

    r10721 r10724  
    2121 *
    2222 *   Author:
    23  *      Yuning Chai
    24  *      Felix Schulthess
     23 *      Fabien Vultier
    2524 *   Co-authors:
    26  *      Reto Grieder
    27  *      Wolfgang Roenninger
     25 *      ...
    2826 *
    2927 */
    3028
    3129#include "HUDWeaponMode.h"
    32 
    33 #include <OgreOverlayManager.h>
    34 #include <OgrePanelOverlayElement.h>
    3530
    3631#include "core/CoreIncludes.h"
    3732#include "core/XMLPort.h"
    38 #include "tools/TextureGenerator.h"
    39 #include "weaponsystem/WeaponMode.h"
    40 #include "weaponsystem/Munition.h"
    4133#include "util/Convert.h"
     34#include "core/class/Super.h"
    4235
    4336namespace orxonox
     
    8780        textOverlayLeft_->setColour(ColourValue(0.21,0.70,0.21,1.0));
    8881        textOverlayLeft_->setAspectCorrection(false);
     82        textOverlayLeft_->setZOrder(600);
    8983       
    9084        this->textOverlayRight_ = new OverlayText(this->getContext());
     
    9791        textOverlayRight_->setColour(ColourValue(0.21,0.70,0.21,1.0));
    9892        textOverlayRight_->setAspectCorrection(false);
     93        textOverlayRight_->setZOrder(600);
    9994
    10095        materialNameState_ = "Orxonox/WSHUD_Reloading";
     
    137132            if (munition != NULL)
    138133            {
    139                 bool useSeparateMagazines = munition->getUseSeparateMagazines();
    140                 bool stackMunition = munition->getStackMunition();
    141 
    142                 if (!useSeparateMagazines && !stackMunition)
     134                MunitionDeployment::Value deployment = munition->getMunitionDeployment();
     135
     136                if (deployment == MunitionDeployment::Share)
    143137                {
    144138                    this->textOverlayLeft_->setCaption(multi_cast<std::string>(munition->getNumMunitionInCurrentMagazine(weaponMode_)));
    145139                    this->textOverlayRight_->setCaption(multi_cast<std::string>(munition->getNumMagazines()));
    146140                }
    147                 else if (!useSeparateMagazines && stackMunition)
     141                else if (deployment == MunitionDeployment::Stack)
    148142                {
    149143                    this->textOverlayLeft_->setCaption(multi_cast<std::string>(munition->getNumMunition(weaponMode_)));
    150144                    this->textOverlayRight_->setCaption("");
    151145                }
    152                 else if (useSeparateMagazines && !stackMunition)
     146                else if (deployment == MunitionDeployment::Separate)
    153147                {
    154148                    this->textOverlayLeft_->setCaption(multi_cast<std::string>(munition->getNumMunitionInCurrentMagazine(weaponMode_)));
     
    245239        if (munition != NULL)
    246240        {
    247             bool useSeparateMagazines = munition->getUseSeparateMagazines();
    248             bool stackMunition = munition->getStackMunition();
    249 
    250             if (!useSeparateMagazines && !stackMunition)
     241            MunitionDeployment::Value deployment = munition->getMunitionDeployment();
     242
     243            if (deployment == MunitionDeployment::Share)
    251244            {
    252245                overlayElementMunition_->setMaterialName("Orxonox/WSHUD_MunitionShare");
    253246            }
    254             else if (!useSeparateMagazines && stackMunition)
     247            else if (deployment == MunitionDeployment::Stack)
    255248            {
    256249                overlayElementMunition_->setMaterialName("Orxonox/WSHUD_MunitionStack");
    257250            }
    258             else if (useSeparateMagazines && !stackMunition)
     251            else if (deployment == MunitionDeployment::Separate)
    259252            {
    260253                overlayElementMunition_->setMaterialName("Orxonox/WSHUD_MunitionSeparate");
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h

    r10721 r10724  
    3838
    3939#include <OgreOverlayManager.h>
    40 #include <OgreMaterialManager.h>
    41 #include <OgreTechnique.h>
    42 #include <OgrePass.h>
    4340#include <OgrePanelOverlayElement.h>
    4441
     
    4946#include "overlays/OverlayGroup.h"
    5047#include "weaponsystem/ReplenishingMunition.h"
     48#include "weaponsystem/WeaponMode.h"
     49#include "weaponsystem/Munition.h"
    5150
    5251namespace orxonox
     
    8483            }
    8584
    86         virtual void positionHUDChilds();
    87 
    8885    private:
    8986        virtual void updateSize();
    9087        virtual void updatePosition();
     88        virtual void positionHUDChilds();
    9189
    9290        WeakPtr<Pawn> owner_;
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc

    r10721 r10724  
    2121 *
    2222 *   Author:
    23  *      Yuning Chai
    24  *      Felix Schulthess
     23 *      Fabien Vultier
    2524 *   Co-authors:
    26  *      Reto Grieder
    27  *      Wolfgang Roenninger
     25 *      ...
    2826 *
    2927 */
     
    3129#include "HUDWeaponSystem.h"
    3230
    33 #include <OgreOverlayManager.h>
    34 #include <OgrePanelOverlayElement.h>
    35 
    3631#include "core/CoreIncludes.h"
    3732#include "core/XMLPort.h"
    38 #include "tools/TextureGenerator.h"
    3933#include "weaponsystem/WeaponSystem.h"
    4034#include "weaponsystem/WeaponPack.h"
     
    7367    }
    7468
    75     void HUDWeaponSystem::tick(float dt)
    76     {
    77         SUPER(HUDWeaponSystem, tick, dt);
    78 
    79         if (this->owner_)
    80         {
    81 
    82         }
    83     } 
    84 
    8569    void HUDWeaponSystem::positionChanged()
    8670    {
     
    11195    {
    11296        SUPER(HUDWeaponSystem, changedOverlayGroup);
    113 
    114         //this->getOverlayGroup()->addElement(this->textOverlay_.get());
    11597    }   
    11698
     
    118100    {
    119101        SUPER(HUDWeaponSystem, changedVisibility);
    120 
    121         //this->textOverlay_->setVisible(this->isVisible());
    122102    }
    123103
     
    125105    {
    126106        SUPER(HUDWeaponSystem, changedName);
    127 
    128         //this->textOverlay_->setName(this->getName() + "text");
    129107    } 
    130108
     
    178156    {
    179157        int positionIndex = 0;
    180         //this->setSize(weaponModeHUDSize_);
    181         // this->weaponModeHUDActualSize_ = this->getActualSize();
    182158
    183159        for (std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)
     
    185161            (*it)->setWeaponIndex(positionIndex);
    186162            (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
    187             (*it)->positionHUDChilds();           
    188163
    189164            ++ positionIndex;
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.h

    r10721 r10724  
    3636#include <string>
    3737
    38 #include <OgreOverlayManager.h>
    39 #include <OgreMaterialManager.h>
    40 #include <OgreTechnique.h>
    41 #include <OgrePass.h>
    42 #include <OgrePanelOverlayElement.h>
    43 
    4438#include "overlays/OrxonoxOverlay.h"
    45 #include "overlays/OverlayText.h"
    46 #include "tools/interfaces/Tickable.h"
    4739#include "worldentities/pawns/Pawn.h"
    4840#include "overlays/OverlayGroup.h"
     
    5143namespace orxonox
    5244{
    53     class _OverlaysExport HUDWeaponSystem : public OrxonoxOverlay, public Tickable
     45    class _OverlaysExport HUDWeaponSystem : public OrxonoxOverlay
    5446    {
    5547    public:
     
    5850
    5951        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    60         virtual void tick(float dt);
    6152        virtual void changedOwner();
    6253        virtual void changedOverlayGroup();
  • code/branches/fabienHS15/src/modules/pickup/items/CMakeLists.txt

    r10715 r10724  
    88  ShrinkPickup.cc
    99  DamageBoostPickup.cc
     10  BoostPickup.cc
    1011  MunitionPickup.cc
    1112  MunitionContainer.cc
  • code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.cc

    r10721 r10724  
    111111            this->Pickupable::destroy();
    112112
    113 
    114113        // If the pickup has transited to used.
    115114        if(this->isUsed())
  • code/branches/fabienHS15/src/modules/weapons/munitions/LaserMunition.cc

    r10713 r10724  
    4343        RegisterObject(LaserMunition);
    4444
    45         this->maxMunitionPerMagazine_ = 10;
     45        this->maxMunitionPerMagazine_ = 20;
    4646        this->maxMagazines_ = 10;
    4747        this->magazines_ = 10;
     
    5555        this->replenishMunitionAmount_ = 1;
    5656
    57         this->reloadTime_ = 0.8f;
     57        this->reloadTime_ = 0.5f;
    5858    }
    5959}
Note: See TracChangeset for help on using the changeset viewer.