Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 7, 2016, 5:08:11 PM (8 years ago)
Author:
patricwi
Message:

visualization of pickup system initiated. next steps: add pickup icons when picked up

Location:
code/branches/HUD_HS16
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/HUD_HS16/data/overlays/HUDTemplates3.oxo

    r11262 r11277  
    188188     name                   = "PickupSystem"
    189189     correctaspect          = true
    190      position               = "0.45, 0.95"
     190     position               = "0.32, 0.81"
    191191     pickpoint              = "0.0, 0.0"
    192192     visible                = "true"
     
    195195    <HUDTimer
    196196     name     = "Timer"
    197      position = "0.5, 0.85"
     197     position = "0.5, 0.25"
    198198     font     = "VeraMono"
    199199     textsize = 0.1
  • code/branches/HUD_HS16/data/overlays/HUDTemplatesFPS.oxo

    r11104 r11277  
    104104    />
    105105
     106    <HUDPickupSystem
     107     name                   = "PickupSystem"
     108     correctaspect          = true
     109     position               = "0.45, 0.95"
     110     pickpoint              = "0.0, 0.0"
     111     visible                = "true"
     112    />
     113
    106114    <HUDTimer
    107115     name     = "Timer"
  • code/branches/HUD_HS16/src/modules/overlays/OverlaysPrereqs.h

    r11052 r11277  
    104104    class PauseNotice;
    105105    class TeamBaseMatchScore;
     106    class HUDPickupSystem;
     107    class HUDPickupItem;
    106108
    107109    // stats
  • code/branches/HUD_HS16/src/modules/overlays/hud/CMakeLists.txt

    r11052 r11277  
    1414  HUDWeapon.cc
    1515  HUDWeaponSystem.cc
     16  HUDPickupItem.cc
     17  HUDPickupSystem.cc
    1618  ChatOverlay.cc
    1719  AnnounceMessage.cc
  • code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc

    r11264 r11277  
    2929#include "HUDPickupItem.h"
    3030
     31#include <string>
     32
     33
     34#include <OgreOverlayManager.h>
     35#include <OgrePanelOverlayElement.h>
     36
    3137#include "core/CoreIncludes.h"
    3238#include "core/XMLPort.h"
    3339#include "util/Convert.h"
    3440#include "core/class/Super.h"
     41#include "HUDPickupItem.h"
    3542
    3643namespace orxonox
    3744{
    3845    RegisterClass(HUDPickupItem);
     46    Ogre::PanelOverlayElement* overlayElement_;
    3947
    4048    HUDPickupItem::HUDPickupItem(Context* context) : OrxonoxOverlay(context)
     
    4351
    4452        overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDPickupItem" + getUniqueNumberString()));
    45         overlayElement_->setMaterialName("Orxonox/WSHUD_Weapon");   //TODO be switched
     53       
    4654        overlayElement_->setPosition(0.0f,0.0f);
    47         overlayElement_->setDimensions(1.0f,1.0f);
     55        overlayElement_->setDimensions(0.5f,0.5f);
    4856        this->background_->addChild(overlayElement_);
    4957    }
     
    5361        if (this->isInitialized())
    5462        {
    55             destroyHUDChilds();
     63            overlayElement_=nullptr;
    5664        }
     65    }
     66
     67    void initializeMaterial(std::string s)
     68    {
     69        overlayElement_->setMaterialName(s);
    5770    }
    5871
  • code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h

    r11264 r11277  
    1616#include "worldentities/pawns/Pawn.h"
    1717#include "overlays/OverlayGroup.h"
    18 #include "weaponsystem/Weapon.h"
    19 #include "weaponsystem/WeaponMode.h"
    20 #include "HUDWeaponMode.h"
     18#include "pickup/Pickup.h"
    2119
    2220namespace orxonox
     
    2826        virtual ~HUDPickupItem();
    2927
    30         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    31         virtual void tick(float dt) override;
    32         virtual void changedOwner() override;
    33         virtual void changedOverlayGroup() override;
    34         virtual void changedVisibility() override;
    35         virtual void changedName() override;
    36         virtual void positionChanged() override;
    37         virtual void sizeChanged() override;
     28        // virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     29        // virtual void tick(float dt) override;
     30        // virtual void changedOwner() override;
     31        // virtual void changedOverlayGroup() override;
     32        // virtual void changedVisibility() override;
     33        // virtual void changedName() override;
     34        // virtual void positionChanged() override;
     35        // virtual void sizeChanged() override;
    3836
    39         void setPickup(Pickup* pickup);     
     37        // void setPickup(Pickup* pickup); 
     38        void initializeMaterial(std::string s);   
    4039
    4140    private:
     
    5049        WeakPtr<Pickup> pickup_;
    5150
    52         Ogre::PanelOverlayElement* overlayElement_;
    5351    };
    5452}
  • code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc

    r11263 r11277  
    2727 */
    2828
     29#include <vector>
     30#include <string>
     31
    2932#include "core/CoreIncludes.h"
    3033#include "core/XMLPort.h"
    3134#include "util/Convert.h"
    3235#include "core/class/Super.h"
     36#include "HUDPickupSystem.h"
     37#include "pickup/Pickup.h"
     38#include "HUDPickupItem.h"
    3339
    3440namespace orxonox
     
    3945    {
    4046        RegisterObject(HUDPickupSystem);
     47
     48        overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDPickupSystem" + getUniqueNumberString()));
     49        overlayElement_->setMaterialName("PickupBar");
     50        overlayElement_->setPosition(0.0f,0.0f);
     51        overlayElement_->setDimensions(0.70f,0.15f);
     52        orxout() << "hello HUDPickupSystem" << endl;
     53        this->background_->addChild(overlayElement_);
    4154
    4255    }
     
    5265   //TODO: XMLPort
    5366
    54     void HUDPickupSystem::updatePickupList()
     67    void HUDPickupSystem::updatePickupList(std::vector<Pickup> picks)
    5568    {
    56        
     69        for(Pickup p : picks)
     70        {
     71            HUDPickupItem item = new HUDPickupItem(this->getContext());
     72            item.initializeMaterial(p.getRepresentationName());
     73        }
    5774    }
    5875
  • code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h

    r11263 r11277  
    3232#include <string>
    3333
     34
     35#include <OgreOverlayManager.h>
     36#include <OgrePanelOverlayElement.h>
     37
    3438#include "overlays/OrxonoxOverlay.h"
    3539#include "worldentities/pawns/Pawn.h"
    3640#include "overlays/OverlayGroup.h"
     41#include "pickup/Pickup.h"
     42#include "pickup/PickupRepresentation.h"
    3743
    3844namespace orxonox
     
    5157        // virtual void positionChanged() override;
    5258        // virtual void sizeChanged() override;
    53     protected:
    54         void updatePickupList();
     59    private:
     60        void updatePickupList(std::vector<Pickup> picks);
    5561        void createPickupList();
    5662        void destroyAll();
     63
     64        Ogre::PanelOverlayElement* overlayElement_;
     65        WeakPtr<Pawn> owner_;
     66
     67        std::vector<PickupRepresentation> pickupRepresentations_;
    5768    };
    5869}
  • code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc

    r11253 r11277  
    5151#include "CollectiblePickup.h"
    5252#include "PickupRepresentation.h"
     53// #include "overlays/hud/HUDPickupSystem.h"
    5354
    5455namespace orxonox
     
    378379    //This function is called by the command line or by the key binding
    379380    //it uses or unuses the pickup, depending on its current state
    380     void PickupManager::useUnusePickup(uint32_t index) //uint32_t index
     381    void PickupManager::useUnusePickup(uint32_t index)
    381382    {
    382383        orxout() << "Hello there I was here " << index << endl;
Note: See TracChangeset for help on using the changeset viewer.