Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 28, 2016, 7:21:35 PM (7 years ago)
Author:
patricwi
Message:

linker problem solved, visuals work as long as only 1 item is picked up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc

    r11305 r11314  
    5353        orxout() << "hello here is the HUDPickupSystem" << endl;
    5454        this->background_->addChild(overlayElement_);
    55 
    56         PickupManager::getInstance().setPickupSystem(this);
    5755    }
    5856
     
    6967    void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks)
    7068    {
    71         for(Pickupable* p : picks)
     69        int i=0;
     70        const float offsetX = 0.32f;
     71        float offsetY = 0.77f;
     72        const float x = 0.1f;
     73
     74        orxout() << "size: " << picks.size() << endl;
     75
     76        if(picks.size()>0)
    7277        {
    73             HUDPickupItem* item = new HUDPickupItem(this->getContext());
    74             item->initializeMaterial(((Pickup*)p)->getRepresentationName());
    75             item->printHello();
     78
     79            for(Pickupable* p : picks)
     80            {
     81                // orxout() << "actual pick is: " << p << endl;
     82                if(i%4==0)
     83                {
     84                    offsetY+=0.04f;
     85                    i=0;
     86                }   
     87                HUDPickupItem* item = new HUDPickupItem(this->getContext());
     88                // item->initializeMaterial(((Pickup*)p)->getRepresentationName(), offsetX+i*x, offsetY);
     89                if(i%2==0)
     90                    item->initializeMaterial("Shield", offsetX+i*x, offsetY);
     91                else
     92                    item->initializeMaterial("ArrowUp", offsetX+i*x, offsetY);
     93                item->setOverlayGroup(this->getOverlayGroup());
     94                this->picks[p] = item;
     95                ++i;
     96            }
    7697        }
    7798    }
     
    79100    void HUDPickupSystem::createPickupList()
    80101    {
    81      
    82102    }     
     103
     104    void HUDPickupSystem::removePickup(Pickupable* pickup)
     105    {
     106        HUDPickupItem* item = this->picks.find(pickup)->second;
     107        orxout() << "removePickup: pickup= " << pickup << " item= " << item << endl;
     108        assert(item);
     109        item->setOverlayGroup(nullptr);
     110        item->hideMe();
     111        overlayElement_->_update();
     112    }
    83113
    84114    void HUDPickupSystem::destroyAll()
    85115    {
    86        
     116        this->background_->removeChild(overlayElement_->getName());
    87117    }
    88118}
Note: See TracChangeset for help on using the changeset viewer.