diff --git a/binaries/data/mods/official/gui/test/4_session.xml b/binaries/data/mods/official/gui/test/4_session.xml
index 0e5b428535..a20558e99c 100644
--- a/binaries/data/mods/official/gui/test/4_session.xml
+++ b/binaries/data/mods/official/gui/test/4_session.xml
@@ -169,23 +169,19 @@
+ />
+ />
+ />
+ />
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/official/gui/test/functions_page_pregame_load.js b/binaries/data/mods/official/gui/test/functions_page_pregame_load.js
index 6ddbf78b5b..5ffb0aac74 100644
--- a/binaries/data/mods/official/gui/test/functions_page_pregame_load.js
+++ b/binaries/data/mods/official/gui/test/functions_page_pregame_load.js
@@ -41,18 +41,20 @@ function startMap (mapName, losSetting, openWindow)
btCode = new Array("");
messageBox(400, 200, "The game could not be started with the given parameters. You probably have entered an invalid map name.", "Error", 0, btCaptions, btCode);
}
-
+
// Set starting UI layout.
GUIType=rb;
- flipGUI (GUIType);
// Initialise Resource Pools by attaching them to the Player object.
// (CPlayer code takes care of giving a copy to each player.)
createResources();
-
+
// Set session UI sprites to match the skin for the player's civilisation.
// (We don't have skins for all civs yet, so we're using the standard menu skin. But it should be settable from here later.)
setSkin ("wheat");
+
+ // Set GUI coordinates to starting orientation.
+ flipGUI (GUIType);
}
// ====================================================================
diff --git a/binaries/data/mods/official/gui/test/functions_sim_player.js b/binaries/data/mods/official/gui/test/functions_sim_player.js
index b576b3e6e9..b13f314dd6 100644
--- a/binaries/data/mods/official/gui/test/functions_sim_player.js
+++ b/binaries/data/mods/official/gui/test/functions_sim_player.js
@@ -192,21 +192,26 @@ function refreshResource (resourceName, resourceIndex)
// Get resource readout object.
resourceObject = getGUIObjectByName ("snResourceCounter_" + (resourceIndex + 1));
+ // Get resource icon object.
+ resourceIconObject = getGUIObjectByName ("snResourceCounterIcon_" + (resourceIndex + 1));
+
// Update counter caption (since we need to have up-to-date text to determine the length of the counter).
- caption
- = "[icon=iconResource" + resourceName + " displace=\"0 0\"] "
- + localPlayer.resource.valueOf()[resourceName];
+ caption = localPlayer.resource.valueOf()[resourceName];
// The Population counter also lists the amount of available housing.
if (resourceName == "Population")
- caption
- += "/" + localPlayer.resource.valueOf()["Housing"];
+ caption += "/" + localPlayer.resource.valueOf()["Housing"];
resourceObject.caption = caption;
- // Update caption tooltip.
+ // Update counter tooltip.
resourceObject.tooltip = resourceName + ": " + resourceObject.caption;
+
+ // Set resource icon.
+ resourceIconObject.cell_id = cellGroup["Resource"][resourceName.toLowerCase()].id;
// Get the index of the resource readout to be resized.
crdResult = getCrd (resourceObject.name, true);
+ // Get the index of the resource icon.
+ crdIconResult = getCrd (resourceIconObject.name, true);
// For each coordinate group stored for this control,
for (coordGroup in Crd[crdResult].coord)
@@ -252,14 +257,32 @@ function refreshResource (resourceName, resourceIndex)
= Crd[crdResult-1].coord[coordGroup].height;
}
+ // Transfer to icon coordinates.
+ Crd[crdIconResult].coord[coordGroup].width = 32;
+ Crd[crdIconResult].coord[coordGroup].height = 32;
+ Crd[crdIconResult].coord[coordGroup].x = Crd[crdResult].coord[coordGroup].x;
+ Crd[crdIconResult].coord[coordGroup].y = Crd[crdResult].coord[coordGroup].y;
+
+
// Recalculate readout's size coordinates.
Crd[crdResult].size[coordGroup] = calcCrdArray (Crd[crdResult].coord[coordGroup].rx, Crd[crdResult].coord[coordGroup].ry, Crd[crdResult].coord[coordGroup].x, Crd[crdResult].coord[coordGroup].y, Crd[crdResult].coord[coordGroup].width, Crd[crdResult].coord[coordGroup].height, Crd[crdResult].coord[coordGroup].rx2, Crd[crdResult].coord[coordGroup].ry2);
+ // Recalculate icon's size coordinates.
+ Crd[crdIconResult].size[coordGroup] = calcCrdArray (Crd[crdIconResult].coord[coordGroup].rx, Crd[crdIconResult].coord[coordGroup].ry, Crd[crdIconResult].coord[coordGroup].x, Crd[crdIconResult].coord[coordGroup].y, Crd[crdIconResult].coord[coordGroup].width, Crd[crdIconResult].coord[coordGroup].height, Crd[crdIconResult].coord[coordGroup].rx2, Crd[crdIconResult].coord[coordGroup].ry2);
+
// If this coordinate is part of the currently active set, update the control onscreen too.
if (coordGroup == GUIType)
{
// Update counter size.
- resourceObject.size = Crd[getCrd(resourceObject.name, true)].size[GUIType];
+// resourceObject.size = Crd[getCrd(resourceObject.name, true)].size[GUIType];
+// resourceIconObject.size = Crd[getCrd(resourceIconObject.name, true)].size[GUIType];
+
+ resourceObject.size = Crd[crdResult].size[GUIType];
+ resourceIconObject.size = Crd[crdIconResult].size[GUIType];
+
+ console.write (resourceName + " Counter: " + resourceObject.size);
+ console.write (resourceName + " Icon: " + resourceIconObject.size);
+
}
}
}
diff --git a/binaries/data/mods/official/gui/test/sprite1.xml b/binaries/data/mods/official/gui/test/sprite1.xml
index cf03d6bd6b..e950c0a42d 100644
--- a/binaries/data/mods/official/gui/test/sprite1.xml
+++ b/binaries/data/mods/official/gui/test/sprite1.xml
@@ -666,13 +666,17 @@
+