Changeset 11700
- Timestamp:
- Jan 6, 2018, 12:15:25 AM (7 years ago)
- Location:
- code/trunk
- Files:
-
- 6 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/HUDPickupItem.cc
r11353 r11700 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 … … 59 59 HUDPickupItem::~HUDPickupItem() 60 60 { 61 if (this->isInitialized())61 /*if (this->isInitialized()) 62 62 { 63 63 overlayElement_=nullptr; 64 } 64 }*/ 65 65 } 66 66 … … 78 78 assert(overlayElement_); 79 79 assert(this->background_); 80 overlayElement_->hide(); 80 orxout()<< overlayElement_->getName()<< endl; 81 //overlayElement_->hide(); 81 82 this->background_->removeChild(overlayElement_->getName()); 83 82 84 } 83 85 } -
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 { -
code/trunk/src/modules/overlays/hud/HUDPickupSystem.h
r11354 r11700 57 57 58 58 void sizeChanged(); 59 void updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_); 60 void createPickupList(); 61 void removePickup(Pickupable* pickup); 59 void sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_); 62 60 63 61 bool repaint=true; //if we shouldnt repaint, set this to false -
code/trunk/src/modules/pickup/PickupManager.cc
r11353 r11700 103 103 // Destroying all the WeakPointers that are still there. 104 104 this->pickups_.clear(); 105 106 105 this->indexes_.clear(); 107 106 108 orxout( internal_info, context::pickups) << "PickupManager destroyed." << endl;107 orxout() << "PickupManager destroyed." << endl; 109 108 } 110 109 … … 266 265 assert(pickup); 267 266 267 orxout() << "just got called"<<endl; 268 268 for (HUDPickupSystem* hud : ObjectList<HUDPickupSystem>()) 269 269 pickupSystem = hud; … … 300 300 301 301 if(pickupSystem) 302 pickupSystem-> updatePickupList(picks, indexes_);302 pickupSystem->sync(picks, indexes_); 303 303 304 304 } … … 316 316 317 317 if(pickupSystem) 318 pickupSystem->removePickup(pickup); 318 pickupSystem->sync(picks, indexes_); 319 orxout() << "end of pickupChangedPickedUp" << endl; 319 320 } 320 321 -
code/trunk/src/orxonox/interfaces/Pickupable.cc
r11071 r11700 80 80 if(this->isPickedUp()) 81 81 this->drop(false); // Drops the pickup without creating a PickupSpawner. 82 orxout()<< "end of preDestroy" << endl; 82 83 } 83 84 … … 98 99 void Pickupable::destroyPickup(void) 99 100 { 101 orxout()<< "beginning of actual destroy" << endl; 100 102 if(!this->isBeingDestroyed()) 101 103 this->Destroyable::destroy(); 102 104 else 103 105 orxout(internal_warning, context::pickups) << this->getIdentifier()->getName() << " may be unsafe. " << endl; 106 orxout()<<"end of actual destroy" << endl; 104 107 } 105 108
Note: See TracChangeset
for help on using the changeset viewer.