[Orxonox-commit 466] r3041 - branches/pickups2/src/orxonox/objects/pickup

danielh at orxonox.net danielh at orxonox.net
Sun May 24 22:01:49 CEST 2009


Author: danielh
Date: 2009-05-24 22:01:49 +0200 (Sun, 24 May 2009)
New Revision: 3041

Modified:
   branches/pickups2/src/orxonox/objects/pickup/PickupInventory.cc
Log:
Now creating some CEGUI windows for items as soon as the inventory is first loaded -> less delay later on

Modified: branches/pickups2/src/orxonox/objects/pickup/PickupInventory.cc
===================================================================
--- branches/pickups2/src/orxonox/objects/pickup/PickupInventory.cc	2009-05-24 19:43:45 UTC (rev 3040)
+++ branches/pickups2/src/orxonox/objects/pickup/PickupInventory.cc	2009-05-24 20:01:49 UTC (rev 3041)
@@ -64,8 +64,19 @@
     PickupInventory::PickupInventory()
     {
         this->bInventoryVisible_ = false;
-        this->createdEquipmentWindows_ = this->createdUsableWindows_ = 0;
         this->visibleEquipmentWindows_ = this->visibleUsableWIndows_ = 0;
+
+        // Create some windows to avoid creating them while playing
+        CEGUI::WindowManager* winMgr = CEGUI::WindowManager::getSingletonPtr();
+        for(int i = 0; i < 10; i++)
+        {
+            std::ostringstream id;
+            id << i;
+
+            PickupInventory::createItemWindows(winMgr, "equ/" + id.str(), i % 5, i / 5);
+            PickupInventory::createItemWindows(winMgr, "use/" + id.str(), i % 5, i / 5);
+        }
+        this->createdEquipmentWindows_ = this->createdUsableWindows_ = 10;
     }
     PickupInventory::~PickupInventory()
     {
@@ -297,6 +308,7 @@
         CEGUI::Window* frame = winMgr->createWindow("TaharezLook/StaticImage", "orxonox/Inventory/Frame/" + id);
         frame->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 5 + x * 70), CEGUI::UDim(0, 5 + y * 90)));
         frame->setSize(CEGUI::UVector2(CEGUI::UDim(0, 65), CEGUI::UDim(0, 65)));
+        frame->setVisible(false);
 
         CEGUI::Window* text = winMgr->createWindow("TaharezLook/StaticText", "orxonox/Inventory/Title/" + id);
         text->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 5 + x * 70), CEGUI::UDim(0, 70 + y * 90)));
@@ -306,11 +318,13 @@
         text->setProperty("HorzFormatting", "HorzCentred");
         text->setProperty("VertFormatting", "VertCentred");
         text->setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF");
+        text->setVisible(false);
 
         CEGUI::Window* btn = winMgr->createWindow("TaharezLook/Button", "orxonox/Inventory/Items/" + id);
         btn->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 8 + x * 70), CEGUI::UDim(0, 8 + y * 90)));
         btn->setSize(CEGUI::UVector2(CEGUI::UDim(0, 59), CEGUI::UDim(0, 59)));
         btn->subscribeScriptedEvent("Clicked", "itemClicked");
+        btn->setVisible(false);
     }
     void PickupInventory::setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour)
     {




More information about the Orxonox-commit mailing list