Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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");
Note: See TracChangeset for help on using the changeset viewer.