Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 6, 2018, 12:15:25 AM (7 years ago)
Author:
landauf
Message:

merged the remaining commits of HUD_HS16 branch back to trunk (except commit r11392 which added DDDialogue that seems to be just a test)

Location:
code/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/overlays/hud/HUDPickupItem.cc

    r11353 r11700  
    5050
    5151        std::string name = "HUDPickupItem" + getUniqueNumberString();
    52 
     52        orxout() << "name: "<< name<<endl;
    5353        overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", name ));
    5454
     
    5959    HUDPickupItem::~HUDPickupItem()
    6060    {
    61         if (this->isInitialized())
     61        /*if (this->isInitialized())
    6262        {
    6363            overlayElement_=nullptr;
    64         }
     64        }*/
    6565    }
    6666
     
    7878        assert(overlayElement_);
    7979        assert(this->background_);
    80         overlayElement_->hide();
     80        orxout()<< overlayElement_->getName()<< endl;
     81        //overlayElement_->hide();
    8182        this->background_->removeChild(overlayElement_->getName());
     83       
    8284    }
    8385}
  • code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc

    r11354 r11700  
    5656    HUDPickupSystem::~HUDPickupSystem()
    5757    {
    58         if (this->isInitialized())
     58        /*if (this->isInitialized())
    5959        {
    6060            this->picks.clear();
    61         }
     61        }*/
    6262    }
    6363
     
    6868    }
    6969   
     70    void HUDPickupSystem::sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_)
     71    {
     72        //hide all pickup symbols in HUD and delete from local map
     73       
     74        orxout() << "picks size before: " << picks.size() << endl;
     75        orxout() << "p size before: " << p.size() << endl;
    7076
    71     void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_)
    72     {
    73         int i =0;
     77        for(const auto& sm_pair : picks)
     78        {
     79            sm_pair.second->hideMe(sm_pair.first, repaint);
     80            orxout() << "deleting local list picks: " << picks.size() << " pickup ptr" << sm_pair.first << endl;
     81        }
     82
     83        picks.clear();
     84        assert(picks.empty()); //picks must be empty now
     85
     86        //add to local map and place on screen
     87        int i = 0;
    7488        const float offsetX = 0.345f;
    7589        float offsetY = 0.82f;
    7690        const float x = 0.102f;
     91        orxout() << "picks size after: " << picks.size() << endl;
     92        orxout() << "p size after: " << p.size() << endl;
    7793
    78         if(picks.size()>0)
     94        for(Pickupable* pickup:p)
    7995        {
    80             for(Pickupable* p : picks)
    81             {
    82                 i = indexes_.find(p)->second;
    83                 offsetY = 0.82f;
     96            i=indexes_.find(pickup)->second;
     97            //second row has offset
     98            if(i==5)
     99            {   
     100                i=0;
     101                offsetY+=0.075f;
     102            }
    84103
    85                 if(i>=5)
    86                 {
    87                     offsetY+=0.075f;
    88                     i-=5;
    89                 }   
    90                 if(this->picks.count(p)==0)
    91                 {
    92                     HUDPickupItem* item = new HUDPickupItem(this->getContext());
    93                     item->initializeMaterial(this->getIcon(((Pickup*)p)->getRepresentationName()), offsetX+i*x, offsetY);
    94                
    95                     item->setOverlayGroup(this->getOverlayGroup());
    96                     this->picks[p] = item;
    97                 }
    98             }
     104            HUDPickupItem* item = new HUDPickupItem(this->getContext());
     105            item->initializeMaterial(this->getIcon(((Pickup*)pickup)->getRepresentationName()), offsetX+i*x, offsetY);
     106            orxout() << "created new pickupHUDItem"<<endl;
     107            item->setOverlayGroup(this->getOverlayGroup());
     108            picks[pickup] = item;
    99109        }
    100110    }
    101111
    102     void HUDPickupSystem::createPickupList()
    103     {
    104     }     
    105 
    106     void HUDPickupSystem::removePickup(Pickupable* pickup)
    107     {
    108         assert(pickup);
    109         HUDPickupItem* item = this->picks.find(pickup)->second;
    110         orxout(internal_info, context::pickups) << "removePickup: pickup= " << pickup << " item= " << item << endl;
    111         assert(item);
    112         item->hideMe(pickup, repaint);
    113         assert(overlayElement_);
    114         assert(this->background_);
    115         this->picks.erase(pickup);
    116     }
    117 
     112   
    118113    void HUDPickupSystem::destroyAll()
    119114    {
  • code/trunk/src/modules/overlays/hud/HUDPickupSystem.h

    r11354 r11700  
    5757
    5858        void sizeChanged();
    59         void updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_); 
    60         void createPickupList(); 
    61         void removePickup(Pickupable* pickup);
     59        void sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_);
    6260
    6361        bool repaint=true; //if we shouldnt repaint, set this to false
  • code/trunk/src/modules/pickup/PickupManager.cc

    r11353 r11700  
    103103        // Destroying all the WeakPointers that are still there.
    104104        this->pickups_.clear();
    105 
    106105        this->indexes_.clear();
    107106
    108         orxout(internal_info, context::pickups) << "PickupManager destroyed." << endl;
     107        orxout() << "PickupManager destroyed." << endl;
    109108    }
    110109
     
    266265        assert(pickup);
    267266
     267        orxout() << "just got called"<<endl;
    268268        for (HUDPickupSystem* hud : ObjectList<HUDPickupSystem>())
    269269            pickupSystem = hud;
     
    300300
    301301            if(pickupSystem)
    302                 pickupSystem->updatePickupList(picks, indexes_);
     302                pickupSystem->sync(picks, indexes_);
    303303           
    304304        }
     
    316316
    317317            if(pickupSystem)
    318                 pickupSystem->removePickup(pickup);
     318                pickupSystem->sync(picks, indexes_);
     319            orxout() << "end of pickupChangedPickedUp" << endl;
    319320        }
    320321
Note: See TracChangeset for help on using the changeset viewer.