Changeset 11305 for code/branches/HUD_HS16
- Timestamp:
- Nov 21, 2016, 4:18:45 PM (8 years ago)
- Location:
- code/branches/HUD_HS16/src/modules
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc
r11295 r11305 65 65 } 66 66 67 void initializeMaterial(const std::string& s)67 void HUDPickupItem::initializeMaterial(const std::string& s) 68 68 { 69 69 overlayElement_->setMaterialName(s); 70 70 } 71 71 72 void printHello()72 void HUDPickupItem::printHello() 73 73 { 74 74 orxout() << "lets say hello" << endl; -
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h
r11295 r11305 53 53 } 54 54 55 #endif /* _HUDWeapon_H__ */55 #endif -
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc
r11295 r11305 37 37 #include "pickup/Pickup.h" 38 38 #include "HUDPickupItem.h" 39 #include "pickup/PickupManager.h" 39 40 40 41 namespace orxonox … … 53 54 this->background_->addChild(overlayElement_); 54 55 56 PickupManager::getInstance().setPickupSystem(this); 55 57 } 56 58 … … 65 67 //TODO: XMLPort 66 68 67 void HUDPickupSystem::updatePickupList(std::vector< WeakPtr<Pickup>> picks)69 void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks) 68 70 { 69 for(Pickup * p : picks)71 for(Pickupable* p : picks) 70 72 { 71 73 HUDPickupItem* item = new HUDPickupItem(this->getContext()); 72 // item->initializeMaterial(p->getRepresentationName());74 item->initializeMaterial(((Pickup*)p)->getRepresentationName()); 73 75 item->printHello(); 74 76 } -
code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h
r11293 r11305 26 26 * 27 27 */ 28 29 30 #ifndef _HUDPickupSystem_H__ 31 #define _HUDPickupSystem_H__ 32 28 33 #include "overlays/OverlaysPrereqs.h" 29 34 … … 58 63 // virtual void positionChanged() override; 59 64 // virtual void sizeChanged() override; 65 void updatePickupList(std::vector<Pickupable*> picks); 60 66 private: 61 void updatePickupList(std::vector<WeakPtr<Pickup>> picks);62 67 void createPickupList(); 63 68 void destroyAll(); … … 69 74 }; 70 75 } 76 77 #endif -
code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc
r11277 r11305 51 51 #include "CollectiblePickup.h" 52 52 #include "PickupRepresentation.h" 53 //#include "overlays/hud/HUDPickupSystem.h"53 #include "overlays/hud/HUDPickupSystem.h" 54 54 55 55 namespace orxonox … … 70 70 SetConsoleCommand("useUnusePickup", &PickupManager::useUnusePickup).addShortcut().setActive(true); 71 71 72 // SetConsoleCommand("HumanController", "fire", &HumanController::fire ).addShortcut().keybindMode(KeybindMode::OnHold);73 72 /** 74 73 @brief … … 82 81 83 82 orxout(internal_info, context::pickups) << "PickupManager created." << endl; 83 } 84 85 void PickupManager::setPickupSystem(HUDPickupSystem* system) 86 { 87 pickupSystem=system; 84 88 } 85 89 … … 295 299 this->pickups_[index] = pickup; 296 300 297 // //Add pickup keybinding 298 // if( KeyBinderManager::exists() ) 299 // addKeyBindingForNewPickup(pickup, index); 300 // else 301 // orxout() << "Could not create new keybinding because KeyBinderManager doesn't exist." << endl; 301 //TODO 302 std::vector<Pickupable*> picks; 303 304 PickupManager& manager = PickupManager::getInstance(); 305 306 Pickupable* pickup = nullptr; 307 308 for(uint32_t i = 0; i!=10; i++) 309 { 310 pickup=manager.pickups_.find(i)->second; 311 picks.push_back(pickup); 312 } 313 // pickupSystem->updatePickupList(picks); 314 302 315 } 303 316 else // If it was dropped, it is removed from the required lists. … … 307 320 index = it->second; 308 321 309 // //Remove pickup keybinding 310 // if( KeyBinderManager::exists() ) 311 // removeKeyBindingForOldPickup(pickup, index); 312 // else 313 // orxout() << "Could not delete old keybinding because KeyBinderManager doesn't exist." << endl; 314 315 // Remove the Pickupable from the indexes_ and pickups_ list. 322 316 323 this->indexes_.erase(pickup); 317 324 this->pickups_.find(index)->second=nullptr; //set to null, so that can be identified as free slot by getPickupIndex() … … 342 349 343 350 } 344 345 //PRECONDITION: KeyBinderManager exists, pickup is not NULL, 0 < index < 9346 //FUNCTION: Adds a keybinding for the new pickup using its index and sets a console command347 // void PickupManager::addKeyBindingForNewPickup(Pickupable* pickup, uint32_t index)348 // {349 // std::string name="Keys.KeyNumpad";350 // std::string binding="useOrUnusePickup";351 352 // name.append(std::to_string(index));353 // binding.append(std::to_string(index));354 355 // SetConsoleCommand(binding, &PickupManager::useUnusePickup(pickup, index));356 // KeyBinderManager::getInstance().getCurrent()->setBinding(binding, name, true);357 358 // orxout() << "Keybinding for item " << index << " has been added on keybinding " << name << endl;359 360 361 // }362 363 //PRECONDITION: KeyBinderManager exists, pickup is not NULL, 0 < index < 9364 //FUNCTION: Removes the keybinding of the pickup using its index365 // void PickupManager::removeKeyBindingForOldPickup(Pickupable* pickup, uint32_t index)366 // {367 // std::string name="Keys.KeyNumpad";368 // std::string binding="";369 370 // name.append(std::to_string(index));371 372 // SetConsoleCommand(binding, nullptr);373 // KeyBinderManager::getInstance().getCurrent()->setBinding("", name, true);374 375 // orxout() << "Keybinding for item " << index << " has been removed on keybinding " << name << endl;376 377 // }378 351 379 352 //This function is called by the command line or by the key binding -
code/branches/HUD_HS16/src/modules/pickup/PickupManager.h
r11253 r11305 45 45 #include "util/Singleton.h" 46 46 #include "interfaces/PickupListener.h" 47 #include "overlays/hud/HUDPickupSystem.h" 47 48 48 49 namespace orxonox // tolua_export … … 148 149 static void dropPickupNetworked(uint32_t pickup); //!< Helper method to drop the input pickup on the server. 149 150 static void usePickupNetworked(uint32_t pickup, bool use); //!< Helper method to use (or unuse) the input Pickupable on the server. 151 void setPickupSystem(HUDPickupSystem* system); 150 152 151 153 private: 154 HUDPickupSystem* pickupSystem; 152 155 static PickupManager* singletonPtr_s; 153 156 static const std::string guiName_s; //!< The name of the PickupInventory
Note: See TracChangeset
for help on using the changeset viewer.