Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 6, 2017, 4:05:15 PM (6 years ago)
Author:
patricwi
Message:

sync function added without success, order of pickups in HUD is mixed up

File:
1 edited

Legend:

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

    r11510 r11540  
    6868    }
    6969   
     70    void HUDPickupSystem::sync(std::vector<Pickupable*> p)
     71    {
     72        //hide all pickup symbols in HUD and delete from local map
     73
     74        for(const auto& sm_pair : picks)
     75        {
     76            sm_pair.second->hideMe(sm_pair.first, repaint);
     77            picks.erase(sm_pair.first);
     78        }
     79
     80        //add to local map and place on screen
     81        int i = 0;
     82        const float offsetX = 0.345f;
     83        float offsetY = 0.82f;
     84        const float x = 0.102f;
     85        for(Pickupable* pickup:p)
     86        {
     87            //second row has offset
     88            if(i==4)
     89            {   
     90                i=0;
     91                offsetY+=0.075f;
     92            }
     93
     94            HUDPickupItem* item = new HUDPickupItem(this->getContext());
     95            item->initializeMaterial(this->getIcon(((Pickup*)pickup)->getRepresentationName()), offsetX+i*x, offsetY);
     96            orxout() << "created new pickupHUDItem"<<endl;
     97            item->setOverlayGroup(this->getOverlayGroup());
     98            picks[pickup] = item;
     99            i++;
     100        }
     101
     102    }
    70103
    71104    void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_)
     
    92125                    HUDPickupItem* item = new HUDPickupItem(this->getContext());
    93126                    item->initializeMaterial(this->getIcon(((Pickup*)p)->getRepresentationName()), offsetX+i*x, offsetY);
    94                
     127                    orxout() << "created new pickupHUDItem"<<endl;
    95128                    item->setOverlayGroup(this->getOverlayGroup());
    96129                    this->picks[p] = item;
     
    110143        HUDPickupItem* item = this->picks.find(pickup)->second;
    111144        orxout() << "removePickup: pickup= " << pickup << " item= " << item << endl;
     145        this->picks.erase(pickup);
    112146        //assert(item);
    113147        item->hideMe(pickup, repaint);
     
    115149        //assert(overlayElement_);
    116150        //assert(this->background_);
    117         //this->picks.erase(pickup);
    118151        orxout()<< "end removePickup method" << endl;
    119152    }
Note: See TracChangeset for help on using the changeset viewer.