Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 12, 2016, 4:20:50 PM (7 years ago)
Author:
patricwi
Message:

finished version of HUD and PickupSystem. crash bug remaining

File:
1 edited

Legend:

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

    r11325 r11336  
    6262    }
    6363
    64     void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks)
     64    void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_)
    6565    {
    66         int i=0;
    67         const float offsetX = 0.335f;
    68         float offsetY = 0.77f;
    69         const float x = 0.1f;
    70 
    71         orxout() << "size: " << picks.size() << endl;
     66        int i =0;
     67        const float offsetX = 0.345f;
     68        float offsetY = 0.82f;
     69        const float x = 0.102f;
    7270
    7371        if(picks.size()>0)
    7472        {
    75 
    7673            for(Pickupable* p : picks)
    7774            {
    78                 // orxout() << "actual pick is: " << p << endl;
    79                 if(i%5==0)
     75                i = indexes_.find(p)->second;
     76                offsetY = 0.82f;
     77
     78                if(i>=5)
    8079                {
    81                     offsetY+=0.04f;
    82                     i=0;
     80                    offsetY+=0.075f;
     81                    i-=5;
    8382                }   
    8483                if(this->picks.count(p)==0)
     
    8685                    HUDPickupItem* item = new HUDPickupItem(this->getContext());
    8786                    item->initializeMaterial(this->getIcon(((Pickup*)p)->getRepresentationName()), offsetX+i*x, offsetY);
    88                     orxout() << ((Pickup*)p)->getRepresentationName() << endl;
    8987               
    9088                    item->setOverlayGroup(this->getOverlayGroup());
    9189                    this->picks[p] = item;
    9290                }
    93                
    94                 ++i;
    9591            }
    9692        }
     
    105101        assert(pickup);
    106102        HUDPickupItem* item = this->picks.find(pickup)->second;
    107         orxout() << "removePickup: pickup= " << pickup << " item= " << item << endl;
     103        orxout(internal_info, context::pickups) << "removePickup: pickup= " << pickup << " item= " << item << endl;
    108104        assert(item);
    109         // item->setOverlayGroup(nullptr);
    110105        item->hideMe(pickup, repaint);
    111106        assert(overlayElement_);
    112         // overlayElement_->_update();
    113107        assert(this->background_);
    114         // this->background_->_update();
    115108        this->picks.erase(pickup);
    116109    }
     
    124117    {
    125118        if(repName.find("invisible", 0)!=std::string::npos) return "Eye";
    126         else if(repName.find("tri", 0)!=std::string::npos) return "Asterix";
     119        else if(repName.find("tri", 0)!=std::string::npos) return "Asterisk";
    127120        else if(repName.find("health", 0)!=std::string::npos || repName.find("Health", 0)!=std::string::npos) return "Cross";
    128121        else if(repName.find("shield", 0)!=std::string::npos) return "Shield";
     
    132125        else if(repName.find("speed", 0)!=std::string::npos) return "3arrowsup";
    133126        else if(repName.find("drone", 0)!=std::string::npos) return "Damage";
    134         //        else if(repName.find("xxxxxxx", 0)!=std::string::npos) return "Splash";
    135127        else return "Unknown";
    136128    }
Note: See TracChangeset for help on using the changeset viewer.