Changeset 11323 for code/branches/HUD_HS16
- Timestamp:
- Dec 5, 2016, 6:01:02 PM (8 years ago)
- Location:
- code/branches/HUD_HS16/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc
r11314 r11323 44 44 { 45 45 RegisterClass(HUDPickupItem); 46 Ogre::PanelOverlayElement* overlayElement_;47 46 48 47 HUDPickupItem::HUDPickupItem(Context* context) : OrxonoxOverlay(context) … … 50 49 RegisterObject(HUDPickupItem); 51 50 52 overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDPickupItem" + getUniqueNumberString())); 53 51 std::string name = "HUDPickupItem" + getUniqueNumberString(); 52 53 overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", name )); 54 // overlayElement_->setName(name); 55 54 56 overlayElement_->setDimensions(0.1f,0.1f); 55 57 … … 73 75 } 74 76 75 void HUDPickupItem::hideMe() 76 { 77 orxout() << this << " has called hide" << endl; 77 void HUDPickupItem::hideMe(Pickupable* p) 78 { 79 assert(overlayElement_); 80 assert(this->background_); 81 // if(p->isBeingDestroyed()) //if the pickup is being destroyed, we do nothing 82 // { 83 // orxout() << "now i didnt repaint" << endl; 84 // return; 85 // } 86 orxout() << "name overlay element: " << overlayElement_->getName() << endl; 87 // orxout() << this << " has called hide" << endl; 78 88 overlayElement_->hide(); 79 overlayElement_->_update(); 80 orxout() << "after the call the element is visible: " << overlayElement_->isVisible() << endl; 89 this->background_->removeChild(overlayElement_->getName()); 90 // this->background_->_update(); 91 // orxout() << "after the call the element is visible: " << overlayElement_->isVisible() << endl; 81 92 } 82 93 -
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h
r11314 r11323 24 24 public: 25 25 HUDPickupItem(Context* context); 26 Ogre::PanelOverlayElement* overlayElement_; 26 27 virtual ~HUDPickupItem(); 27 28 … … 37 38 // void setPickup(Pickup* pickup); 38 39 void initializeMaterial(const std::string& s, float x, float y); 39 void hideMe( );40 void hideMe(Pickupable* p); 40 41 41 42 private: … … 47 48 // void updatePosition(); 48 49 50 49 51 WeakPtr<Pawn> owner_; 50 52 WeakPtr<Pickup> pickup_; -
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc
r11314 r11323 59 59 if (this->isInitialized()) 60 60 { 61 //TODO: Destroy me61 this->picks.clear(); 62 62 } 63 63 } … … 80 80 { 81 81 // orxout() << "actual pick is: " << p << endl; 82 if(i% 4==0)82 if(i%5==0) 83 83 { 84 84 offsetY+=0.04f; 85 85 i=0; 86 86 } 87 HUDPickupItem* item = new HUDPickupItem(this->getContext()); 88 // item->initializeMaterial(((Pickup*)p)->getRepresentationName(), offsetX+i*x, offsetY); 87 if(this->picks.count(p)==0) 88 { 89 HUDPickupItem* item = new HUDPickupItem(this->getContext()); 90 // item->initializeMaterial(((Pickup*)p)->getRepresentationName(), offsetX+i*x, offsetY); 89 91 if(i%2==0) 90 92 item->initializeMaterial("Shield", offsetX+i*x, offsetY); … … 93 95 item->setOverlayGroup(this->getOverlayGroup()); 94 96 this->picks[p] = item; 97 } 98 95 99 ++i; 96 100 } … … 104 108 void HUDPickupSystem::removePickup(Pickupable* pickup) 105 109 { 110 assert(pickup); 106 111 HUDPickupItem* item = this->picks.find(pickup)->second; 107 112 orxout() << "removePickup: pickup= " << pickup << " item= " << item << endl; 108 113 assert(item); 109 item->setOverlayGroup(nullptr); 110 item->hideMe(); 111 overlayElement_->_update(); 114 // item->setOverlayGroup(nullptr); 115 item->hideMe(pickup); 116 assert(overlayElement_); 117 // overlayElement_->_update(); 118 assert(this->background_); 119 // this->background_->_update(); 120 this->picks.erase(pickup); 112 121 } 113 122 -
code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc
r11314 r11323 266 266 assert(pickup); 267 267 268 if(!pickupSystem) 269 { 270 for (HUDPickupSystem* hud : ObjectList<HUDPickupSystem>()) 271 pickupSystem = hud; 272 } 268 269 for (HUDPickupSystem* hud : ObjectList<HUDPickupSystem>()) 270 pickupSystem = hud; 271 273 272 assert(pickupSystem); //pickupSystem HAS to be there! 274 273 … … 321 320 322 321 pickupSystem->removePickup(pickup); 323 pickupSystem->updatePickupList(picks);324 322 } 325 323 … … 366 364 orxout() << "The pickup is being used: " << pickup->isUsed() << endl; 367 365 368 if(pickup->isUsed()) 369 manager.usePickup(index, false); 370 else 371 manager.usePickup(index, true); 366 pickup->drop(true); 367 // if(pickup->isUsed()) 368 // manager.usePickup(index, false); 369 // else 370 // manager.usePickup(index, true); 372 371 } 373 372 -
code/branches/HUD_HS16/src/orxonox/interfaces/Pickupable.h
r11071 r11323 96 96 97 97 /** 98 @brief Check whether the Pickupable is in the process of being destroyed. 99 @return Returns true if so. 100 */ 101 inline bool isBeingDestroyed(void) 102 { return this->beingDestroyed_; } 103 104 /** 98 105 @brief Returns whether the Pickupable is currently picked up. 99 106 @return Returns true if the Pickupable is currently picked up, false if not. … … 155 162 156 163 /** 157 @brief Check whether the Pickupable is in the process of being destroyed.158 @return Returns true if so.159 */160 inline bool isBeingDestroyed(void)161 { return this->beingDestroyed_; }162 163 /**164 164 @brief Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 165 165 This method must be implemented by any class directly inheriting from Pickupable.
Note: See TracChangeset
for help on using the changeset viewer.