[Orxonox-commit 7086] r11703 - code/trunk/src/modules/overlays/hud

landauf at orxonox.net landauf at orxonox.net
Sat Jan 6 02:11:17 CET 2018


Author: landauf
Date: 2018-01-06 02:11:17 +0100 (Sat, 06 Jan 2018)
New Revision: 11703

Modified:
   code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc
Log:
[HUD_HS16] fixed bug with the position of the hud pickup items

Modified: code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc	2018-01-06 01:01:20 UTC (rev 11702)
+++ code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc	2018-01-06 01:11:17 UTC (rev 11703)
@@ -78,23 +78,19 @@
         assert(items_.empty()); //items_ must be empty now
 
         //add to local map and place on screen
-        int i = 0;
         const float offsetX = 0.345f;
-        float offsetY = 0.82f;
+        const float offsetY = 0.82f;
         const float x = 0.102f;
+        const float y = 0.075f;
 
         for(Pickupable* pickup:p)
         {
-            i=indexes_.find(pickup)->second;
-            //second row has offset
-            if(i==5)
-            {    
-                i=0;
-                offsetY+=0.075f;
-            }
+            int index = indexes_.find(pickup)->second;
+            int row = index / 5;
+            int column = index % 5;
 
             HUDPickupItem* item = new HUDPickupItem(this->getContext());
-            item->initializeMaterial(this->getIcon(((Pickup*)pickup)->getRepresentationName()), offsetX+i*x, offsetY);
+            item->initializeMaterial(this->getIcon(((Pickup*)pickup)->getRepresentationName()), offsetX+column*x, offsetY+row*y);
             item->setOverlayGroup(this->getOverlayGroup());
             items_.push_back(item);
         }



More information about the Orxonox-commit mailing list