Changeset 11700 for code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc
- Timestamp:
- Jan 6, 2018, 12:15:25 AM (6 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/HUD_HS16 merged: 11395,11497-11499,11501-11502,11510,11540,11558
- Property svn:mergeinfo changed
-
code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc
r11354 r11700 56 56 HUDPickupSystem::~HUDPickupSystem() 57 57 { 58 if (this->isInitialized())58 /*if (this->isInitialized()) 59 59 { 60 60 this->picks.clear(); 61 } 61 }*/ 62 62 } 63 63 … … 68 68 } 69 69 70 void HUDPickupSystem::sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_) 71 { 72 //hide all pickup symbols in HUD and delete from local map 73 74 orxout() << "picks size before: " << picks.size() << endl; 75 orxout() << "p size before: " << p.size() << endl; 70 76 71 void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_) 72 { 73 int i =0; 77 for(const auto& sm_pair : picks) 78 { 79 sm_pair.second->hideMe(sm_pair.first, repaint); 80 orxout() << "deleting local list picks: " << picks.size() << " pickup ptr" << sm_pair.first << endl; 81 } 82 83 picks.clear(); 84 assert(picks.empty()); //picks must be empty now 85 86 //add to local map and place on screen 87 int i = 0; 74 88 const float offsetX = 0.345f; 75 89 float offsetY = 0.82f; 76 90 const float x = 0.102f; 91 orxout() << "picks size after: " << picks.size() << endl; 92 orxout() << "p size after: " << p.size() << endl; 77 93 78 if(picks.size()>0)94 for(Pickupable* pickup:p) 79 95 { 80 for(Pickupable* p : picks) 81 { 82 i = indexes_.find(p)->second; 83 offsetY = 0.82f; 96 i=indexes_.find(pickup)->second; 97 //second row has offset 98 if(i==5) 99 { 100 i=0; 101 offsetY+=0.075f; 102 } 84 103 85 if(i>=5) 86 { 87 offsetY+=0.075f; 88 i-=5; 89 } 90 if(this->picks.count(p)==0) 91 { 92 HUDPickupItem* item = new HUDPickupItem(this->getContext()); 93 item->initializeMaterial(this->getIcon(((Pickup*)p)->getRepresentationName()), offsetX+i*x, offsetY); 94 95 item->setOverlayGroup(this->getOverlayGroup()); 96 this->picks[p] = item; 97 } 98 } 104 HUDPickupItem* item = new HUDPickupItem(this->getContext()); 105 item->initializeMaterial(this->getIcon(((Pickup*)pickup)->getRepresentationName()), offsetX+i*x, offsetY); 106 orxout() << "created new pickupHUDItem"<<endl; 107 item->setOverlayGroup(this->getOverlayGroup()); 108 picks[pickup] = item; 99 109 } 100 110 } 101 111 102 void HUDPickupSystem::createPickupList() 103 { 104 } 105 106 void HUDPickupSystem::removePickup(Pickupable* pickup) 107 { 108 assert(pickup); 109 HUDPickupItem* item = this->picks.find(pickup)->second; 110 orxout(internal_info, context::pickups) << "removePickup: pickup= " << pickup << " item= " << item << endl; 111 assert(item); 112 item->hideMe(pickup, repaint); 113 assert(overlayElement_); 114 assert(this->background_); 115 this->picks.erase(pickup); 116 } 117 112 118 113 void HUDPickupSystem::destroyAll() 119 114 {
Note: See TracChangeset
for help on using the changeset viewer.