- Timestamp:
- Jan 6, 2018, 3:13:26 PM (7 years ago)
- Location:
- code/trunk
- Files:
-
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/data/overlays/HUDPickupTemplate.oxo
r11354 r11705 187 187 <HUDPickupSystem 188 188 name = "PickupSystem" 189 background = "PickupBar" 189 190 correctaspect = true 191 size = "0.70, 0.15" 190 192 position = "0.32, 0.81" 191 193 pickpoint = "0.0, 0.0" -
code/trunk/data/overlays/HUDTemplates3.oxo
r11451 r11705 187 187 <HUDPickupSystem 188 188 name = "PickupSystem" 189 background = "PickupBar" 189 190 correctaspect = true 191 size = "0.70, 0.15" 190 192 position = "0.32, 0.81" 191 193 pickpoint = "0.0, 0.0" -
code/trunk/src/modules/overlays/OverlaysPrereqs.h
r11353 r11705 105 105 class TeamBaseMatchScore; 106 106 class HUDPickupSystem; 107 class HUDPickupItem;108 107 109 108 // stats -
code/trunk/src/modules/overlays/hud/CMakeLists.txt
r11353 r11705 14 14 HUDWeapon.cc 15 15 HUDWeaponSystem.cc 16 HUDPickupItem.cc17 16 HUDPickupSystem.cc 18 17 ChatOverlay.cc -
code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc
r11704 r11705 31 31 32 32 #include <OgreOverlayManager.h> 33 #include <OgreOverlayElement.h> 33 34 #include <OgrePanelOverlayElement.h> 34 35 35 36 #include "core/CoreIncludes.h" 36 37 #include "core/class/Super.h" 37 #include "util/ StringUtils.h"38 #include "util/Convert.h" 38 39 #include "HUDPickupSystem.h" 39 #include "HUDPickupItem.h"40 40 #include "pickup/PickupManager.h" 41 41 … … 48 48 RegisterObject(HUDPickupSystem); 49 49 50 overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDPickupSystem" + getUniqueNumberString())); 51 overlayElement_->setMaterialName("PickupBar"); 52 overlayElement_->setPosition(0.0f,0.0f); 53 overlayElement_->setDimensions(0.70f,0.15f); 54 this->background_->addChild(overlayElement_); 50 const float offsetX = 0.02f; 51 const float offsetY = 0.05f; 52 const float x = 0.2; 53 const float y = 0.5f; 54 55 for (int index = 0; index < 10; ++index) 56 { 57 int row = index / 5; 58 int column = index % 5; 59 60 std::string name = "HUDPickupItem" + multi_cast<std::string>(index); 61 Ogre::OverlayElement* item = Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", name); 62 63 item->setDimensions(0.16, 0.4); 64 item->setPosition(offsetX + column*x, offsetY + row*y); 65 this->items_.push_back(item); 66 } 55 67 } 56 68 57 69 HUDPickupSystem::~HUDPickupSystem() 58 70 { 71 for (Ogre::OverlayElement* item : items_) 72 Ogre::OverlayManager::getSingleton().destroyOverlayElement(item); 59 73 } 60 74 … … 69 83 SUPER(HUDPickupSystem, tick, dt); 70 84 71 //hide all pickup symbols in HUD and delete from local map72 for (HUDPickupItem* item : items_)85 int numPickups = PickupManager::getInstance().getNumPickups(); 86 for (size_t index = 0; index < this->items_.size(); ++index) 73 87 { 74 item->hideMe(); 75 } 88 Ogre::OverlayElement* item = this->items_[index]; 76 89 77 items_.clear(); 78 assert(items_.empty()); //items_ must be empty now 79 80 //add to local map and place on screen 81 const float offsetX = 0.345f; 82 const float offsetY = 0.82f; 83 const float x = 0.102f; 84 const float y = 0.075f; 85 86 int numPickups = PickupManager::getInstance().getNumPickups(); 87 for (int index = 0; index < numPickups; ++index) 88 { 89 int row = index / 5; 90 int column = index % 5; 91 92 const PickupInventoryContainer* container = PickupManager::getInstance().popPickup(); 93 94 HUDPickupItem* item = new HUDPickupItem(this->getContext()); 95 item->initializeMaterial(this->getIcon(container->representationName), offsetX+column*x, offsetY+row*y); 96 item->setOverlayGroup(this->getOverlayGroup()); 97 items_.push_back(item); 90 if (static_cast<int>(index) < numPickups) 91 { 92 const PickupInventoryContainer* container = PickupManager::getInstance().popPickup(); 93 item->setMaterialName(this->getIcon(container->representationName)); 94 if (!item->getParent()) 95 this->background_->addChild(item); 96 } 97 else 98 { 99 if (item->getParent()) 100 this->background_->removeChild(item->getName()); 101 } 98 102 } 99 103 } -
code/trunk/src/modules/overlays/hud/HUDPickupSystem.h
r11704 r11705 51 51 52 52 private: 53 54 53 std::string getIcon(std::string repName); 55 54 56 std::vector<HUDPickupItem*> items_; 57 Ogre::PanelOverlayElement* overlayElement_; 55 std::vector<Ogre::OverlayElement*> items_; 58 56 }; 59 57 }
Note: See TracChangeset
for help on using the changeset viewer.