Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3041


Ignore:
Timestamp:
May 24, 2009, 10:01:49 PM (16 years ago)
Author:
danielh
Message:

Now creating some CEGUI windows for items as soon as the inventory is first loaded → less delay later on

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickups2/src/orxonox/objects/pickup/PickupInventory.cc

    r3040 r3041  
    6565    {
    6666        this->bInventoryVisible_ = false;
    67         this->createdEquipmentWindows_ = this->createdUsableWindows_ = 0;
    6867        this->visibleEquipmentWindows_ = this->visibleUsableWIndows_ = 0;
     68
     69        // Create some windows to avoid creating them while playing
     70        CEGUI::WindowManager* winMgr = CEGUI::WindowManager::getSingletonPtr();
     71        for(int i = 0; i < 10; i++)
     72        {
     73            std::ostringstream id;
     74            id << i;
     75
     76            PickupInventory::createItemWindows(winMgr, "equ/" + id.str(), i % 5, i / 5);
     77            PickupInventory::createItemWindows(winMgr, "use/" + id.str(), i % 5, i / 5);
     78        }
     79        this->createdEquipmentWindows_ = this->createdUsableWindows_ = 10;
    6980    }
    7081    PickupInventory::~PickupInventory()
     
    298309        frame->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 5 + x * 70), CEGUI::UDim(0, 5 + y * 90)));
    299310        frame->setSize(CEGUI::UVector2(CEGUI::UDim(0, 65), CEGUI::UDim(0, 65)));
     311        frame->setVisible(false);
    300312
    301313        CEGUI::Window* text = winMgr->createWindow("TaharezLook/StaticText", "orxonox/Inventory/Title/" + id);
     
    307319        text->setProperty("VertFormatting", "VertCentred");
    308320        text->setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF");
     321        text->setVisible(false);
    309322
    310323        CEGUI::Window* btn = winMgr->createWindow("TaharezLook/Button", "orxonox/Inventory/Items/" + id);
     
    312325        btn->setSize(CEGUI::UVector2(CEGUI::UDim(0, 59), CEGUI::UDim(0, 59)));
    313326        btn->subscribeScriptedEvent("Clicked", "itemClicked");
     327        btn->setVisible(false);
    314328    }
    315329    void PickupInventory::setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour)
Note: See TracChangeset for help on using the changeset viewer.