Changeset 11540
- Timestamp:
- Nov 6, 2017, 4:05:15 PM (7 years ago)
- Location:
- code/branches/HUD_HS16/src/modules
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc
r11510 r11540 50 50 51 51 std::string name = "HUDPickupItem" + getUniqueNumberString(); 52 52 orxout() << "name: "<< name<<endl; 53 53 overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", name )); 54 54 … … 78 78 assert(overlayElement_); 79 79 assert(this->background_); 80 overlayElement_->hide(); 81 //this->background_->removeChild(overlayElement_->getName()); 80 orxout()<< overlayElement_->getName()<< endl; 81 //overlayElement_->hide(); 82 this->background_->removeChild(overlayElement_->getName()); 83 82 84 } 83 85 } -
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc
r11510 r11540 68 68 } 69 69 70 void HUDPickupSystem::sync(std::vector<Pickupable*> p) 71 { 72 //hide all pickup symbols in HUD and delete from local map 73 74 for(const auto& sm_pair : picks) 75 { 76 sm_pair.second->hideMe(sm_pair.first, repaint); 77 picks.erase(sm_pair.first); 78 } 79 80 //add to local map and place on screen 81 int i = 0; 82 const float offsetX = 0.345f; 83 float offsetY = 0.82f; 84 const float x = 0.102f; 85 for(Pickupable* pickup:p) 86 { 87 //second row has offset 88 if(i==4) 89 { 90 i=0; 91 offsetY+=0.075f; 92 } 93 94 HUDPickupItem* item = new HUDPickupItem(this->getContext()); 95 item->initializeMaterial(this->getIcon(((Pickup*)pickup)->getRepresentationName()), offsetX+i*x, offsetY); 96 orxout() << "created new pickupHUDItem"<<endl; 97 item->setOverlayGroup(this->getOverlayGroup()); 98 picks[pickup] = item; 99 i++; 100 } 101 102 } 70 103 71 104 void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_) … … 92 125 HUDPickupItem* item = new HUDPickupItem(this->getContext()); 93 126 item->initializeMaterial(this->getIcon(((Pickup*)p)->getRepresentationName()), offsetX+i*x, offsetY); 94 127 orxout() << "created new pickupHUDItem"<<endl; 95 128 item->setOverlayGroup(this->getOverlayGroup()); 96 129 this->picks[p] = item; … … 110 143 HUDPickupItem* item = this->picks.find(pickup)->second; 111 144 orxout() << "removePickup: pickup= " << pickup << " item= " << item << endl; 145 this->picks.erase(pickup); 112 146 //assert(item); 113 147 item->hideMe(pickup, repaint); … … 115 149 //assert(overlayElement_); 116 150 //assert(this->background_); 117 //this->picks.erase(pickup);118 151 orxout()<< "end removePickup method" << endl; 119 152 } -
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h
r11351 r11540 57 57 58 58 void sizeChanged(); 59 void sync(std::vector<Pickupable*> p); 59 60 void updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_); 60 61 void createPickupList(); -
code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc
r11510 r11540 265 265 assert(pickup); 266 266 267 orxout() << "just got called"<<endl; 267 268 for (HUDPickupSystem* hud : ObjectList<HUDPickupSystem>()) 268 269 pickupSystem = hud; … … 299 300 300 301 if(pickupSystem) 301 pickupSystem-> updatePickupList(picks, indexes_);302 pickupSystem->sync(picks); 302 303 303 304 } … … 315 316 316 317 if(pickupSystem) 317 pickupSystem-> removePickup(pickup);318 pickupSystem->sync(picks); 318 319 orxout() << "end of pickupChangedPickedUp" << endl; 319 320 }
Note: See TracChangeset
for help on using the changeset viewer.