Changeset 11704 for code/trunk/src/modules/overlays/hud
- Timestamp:
- Jan 6, 2018, 3:16:00 AM (7 years ago)
- Location:
- code/trunk/src/modules/overlays/hud
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc
r11703 r11704 38 38 #include "HUDPickupSystem.h" 39 39 #include "HUDPickupItem.h" 40 #include "pickup/Pickup.h"41 40 #include "pickup/PickupManager.h" 42 41 … … 66 65 } 67 66 68 void HUDPickupSystem:: sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_)67 void HUDPickupSystem::tick(float dt) 69 68 { 69 SUPER(HUDPickupSystem, tick, dt); 70 70 71 //hide all pickup symbols in HUD and delete from local map 71 72 72 for(HUDPickupItem* item : items_) 73 73 { … … 84 84 const float y = 0.075f; 85 85 86 for(Pickupable* pickup:p) 86 int numPickups = PickupManager::getInstance().getNumPickups(); 87 for (int index = 0; index < numPickups; ++index) 87 88 { 88 int index = indexes_.find(pickup)->second;89 89 int row = index / 5; 90 90 int column = index % 5; 91 91 92 const PickupInventoryContainer* container = PickupManager::getInstance().popPickup(); 93 92 94 HUDPickupItem* item = new HUDPickupItem(this->getContext()); 93 item->initializeMaterial(this->getIcon( ((Pickup*)pickup)->getRepresentationName()), offsetX+column*x, offsetY+row*y);95 item->initializeMaterial(this->getIcon(container->representationName), offsetX+column*x, offsetY+row*y); 94 96 item->setOverlayGroup(this->getOverlayGroup()); 95 97 items_.push_back(item); -
code/trunk/src/modules/overlays/hud/HUDPickupSystem.h
r11702 r11704 37 37 #include "util/OgreForwardRefs.h" 38 38 #include "overlays/OrxonoxOverlay.h" 39 #include "tools/interfaces/Tickable.h" 39 40 40 41 namespace orxonox 41 42 { 42 class _OverlaysExport HUDPickupSystem : public OrxonoxOverlay 43 class _OverlaysExport HUDPickupSystem : public OrxonoxOverlay, public Tickable 43 44 { 44 45 public: … … 46 47 virtual ~HUDPickupSystem(); 47 48 48 v oid sizeChanged();49 v oid sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_);49 virtual void tick(float dt) override; 50 virtual void sizeChanged() override; 50 51 51 52 private:
Note: See TracChangeset
for help on using the changeset viewer.