Changeset 11558
- Timestamp:
- Nov 13, 2017, 4:14:47 PM (7 years ago)
- Location:
- code/branches/HUD_HS16/src/modules
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc
r11540 r11558 68 68 } 69 69 70 void HUDPickupSystem::sync(std::vector<Pickupable*> p )70 void HUDPickupSystem::sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_) 71 71 { 72 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; 73 76 74 77 for(const auto& sm_pair : picks) 75 78 { 76 79 sm_pair.second->hideMe(sm_pair.first, repaint); 77 picks.erase(sm_pair.first);80 orxout() << "deleting local list picks: " << picks.size() << " pickup ptr" << sm_pair.first << endl; 78 81 } 82 83 picks.clear(); 84 assert(picks.empty()); //picks must be empty now 79 85 80 86 //add to local map and place on screen … … 83 89 float offsetY = 0.82f; 84 90 const float x = 0.102f; 91 orxout() << "picks size after: " << picks.size() << endl; 92 orxout() << "p size after: " << p.size() << endl; 93 85 94 for(Pickupable* pickup:p) 86 95 { 96 i=indexes_.find(pickup)->second; 87 97 //second row has offset 88 if(i== 4)98 if(i==5) 89 99 { 90 100 i=0; … … 97 107 item->setOverlayGroup(this->getOverlayGroup()); 98 108 picks[pickup] = item; 99 i++;100 }101 102 }103 104 void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_)105 {106 int i =0;107 const float offsetX = 0.345f;108 float offsetY = 0.82f;109 const float x = 0.102f;110 111 if(picks.size()>0)112 {113 for(Pickupable* p : picks)114 {115 i = indexes_.find(p)->second;116 offsetY = 0.82f;117 118 if(i>=5)119 {120 offsetY+=0.075f;121 i-=5;122 }123 if(this->picks.count(p)==0)124 {125 HUDPickupItem* item = new HUDPickupItem(this->getContext());126 item->initializeMaterial(this->getIcon(((Pickup*)p)->getRepresentationName()), offsetX+i*x, offsetY);127 orxout() << "created new pickupHUDItem"<<endl;128 item->setOverlayGroup(this->getOverlayGroup());129 this->picks[p] = item;130 }131 }132 109 } 133 110 } 134 111 135 void HUDPickupSystem::createPickupList() 136 { 137 } 138 139 void HUDPickupSystem::removePickup(Pickupable* pickup) 140 { 141 assert(pickup); 142 orxout()<< "removePickup called with " << pickup << endl; 143 HUDPickupItem* item = this->picks.find(pickup)->second; 144 orxout() << "removePickup: pickup= " << pickup << " item= " << item << endl; 145 this->picks.erase(pickup); 146 //assert(item); 147 item->hideMe(pickup, repaint); 148 orxout() << "i am hidden now" << endl; 149 //assert(overlayElement_); 150 //assert(this->background_); 151 orxout()<< "end removePickup method" << endl; 152 } 153 112 154 113 void HUDPickupSystem::destroyAll() 155 114 { -
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h
r11540 r11558 57 57 58 58 void sizeChanged(); 59 void sync(std::vector<Pickupable*> p); 60 void updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_); 61 void createPickupList(); 62 void removePickup(Pickupable* pickup); 59 void sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_); 63 60 64 61 bool repaint=true; //if we shouldnt repaint, set this to false -
code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc
r11540 r11558 300 300 301 301 if(pickupSystem) 302 pickupSystem->sync(picks );302 pickupSystem->sync(picks, indexes_); 303 303 304 304 } … … 316 316 317 317 if(pickupSystem) 318 pickupSystem->sync(picks );318 pickupSystem->sync(picks, indexes_); 319 319 orxout() << "end of pickupChangedPickedUp" << endl; 320 320 }
Note: See TracChangeset
for help on using the changeset viewer.