diff --git a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlay.js b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlay.js
index a728416faf..ad1f2b2189 100644
--- a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlay.js
+++ b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlay.js
@@ -10,9 +10,13 @@ class DeveloperOverlay
this.devCommandsOverlay.onPress = this.toggle.bind(this);
this.checkBoxes = this.getCheckboxNames().map((name, i) =>
- new DeveloperOverlayCheckbox(
- new DeveloperOverlayCheckboxes.prototype[name](playerViewControl, selection),
+ new DeveloperOverlayControlCheckbox(
+ new DeveloperOverlayControlCheckboxes.prototype[name](playerViewControl, selection),
i));
+ this.dropDowns = this.getDropDownNames().map((name, i) =>
+ new DeveloperOverlayControlDropDown(
+ new DeveloperOverlayControlDrowDowns.prototype[name](playerViewControl, selection),
+ i + this.checkBoxes.length));
this.resize();
}
@@ -22,7 +26,12 @@ class DeveloperOverlay
*/
getCheckboxNames()
{
- return Object.keys(DeveloperOverlayCheckboxes.prototype);
+ return Object.keys(DeveloperOverlayControlCheckboxes.prototype);
+ }
+
+ getDropDownNames()
+ {
+ return Object.keys(DeveloperOverlayControlDrowDowns.prototype);
}
toggle()
@@ -35,6 +44,9 @@ class DeveloperOverlay
this.checkBoxes.forEach(checkbox => {
checkbox.setHidden(this.devCommandsOverlay.hidden);
});
+ this.dropDowns.forEach(dropDown => {
+ dropDown.setHidden(this.devCommandsOverlay.hidden);
+ });
}
sendNotification()
@@ -59,7 +71,8 @@ class DeveloperOverlay
let size = this.devCommandsOverlay.size;
size.bottom =
size.top +
- this.checkBoxes.reduce((height, checkbox) => height + checkbox.getHeight(), 0);
+ this.checkBoxes.reduce((height, checkbox) => height + checkbox.getHeight(), 0) +
+ this.dropDowns.reduce((height, dropDown) => height + dropDown.getHeight(), 0);
this.devCommandsOverlay.size = size;
}
}
diff --git a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlay.xml b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlay.xml
index 61172c047c..9e3185f37b 100644
--- a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlay.xml
+++ b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlay.xml
@@ -4,15 +4,16 @@
name="devCommandsOverlay"
type="image"
sprite="sessionOverlayBackground"
- size="100%-250 50%-200 100%-8 50%"
+ size="100%-250 50%-280 100%-8 50%"
z="40"
hidden="true"
hotkey="session.devcommands.toggle"
>
-
diff --git a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControl.js b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControl.js
new file mode 100644
index 0000000000..3341b22645
--- /dev/null
+++ b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControl.js
@@ -0,0 +1,35 @@
+/**
+ * Base class for all controls on the developer overlay.
+ */
+class DeveloperOverlayControl
+{
+ constructor(handler, i)
+ {
+ this.handler = handler;
+ this.handler.update = () => this.update();
+
+ this.body = Engine.GetGUIObjectByName("dev_command[" + i + "]");
+ this.resize(i);
+
+ this.updater = this.update.bind(this);
+
+ if (this.handler.checked)
+ registerPlayersInitHandler(this.updater);
+ }
+
+ getHeight()
+ {
+ return this.body.size.bottom - this.body.size.top;
+ }
+
+ resize(i)
+ {
+ let size = this.body.size;
+ let height = size.bottom;
+ size.top = height * i;
+ size.bottom = height * (i + 1);
+ this.body.size = size;
+ this.body.hidden = false;
+ }
+}
+
diff --git a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayCheckbox.js b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlCheckbox.js
similarity index 59%
rename from binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayCheckbox.js
rename to binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlCheckbox.js
index 19b2513760..bf38a81a08 100644
--- a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayCheckbox.js
+++ b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlCheckbox.js
@@ -1,26 +1,19 @@
/**
* This class sets up a checkbox in the developer overlay and assigns its specific handler.
*/
-class DeveloperOverlayCheckbox
+class DeveloperOverlayControlCheckbox extends DeveloperOverlayControl
{
constructor(handler, i)
{
- this.handler = handler;
- this.handler.update = () => this.update();
+ super(handler, i);
this.label = Engine.GetGUIObjectByName("dev_command_label[" + i + "]");
this.label.caption = this.handler.label();
+ this.label.hidden = false;
this.checkbox = Engine.GetGUIObjectByName("dev_command_checkbox[" + i + "]");
this.checkbox.onPress = this.onPress.bind(this);
-
- this.body = Engine.GetGUIObjectByName("dev_command[" + i + "]");
- this.resize(i);
-
- this.updater = this.update.bind(this);
-
- if (this.handler.checked)
- registerPlayersInitHandler(this.updater);
+ this.checkbox.hidden = false;
}
onPress()
@@ -47,19 +40,5 @@ class DeveloperOverlayCheckbox
else
registerSimulationUpdateHandler(this.updater);
}
-
- getHeight()
- {
- return this.body.size.bottom - this.body.size.top;
- }
-
- resize(i)
- {
- let size = this.body.size;
- let height = size.bottom;
- size.top = height * i;
- size.bottom = height * (i + 1);
- this.body.size = size;
- this.body.hidden = false;
- }
}
+
diff --git a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayCheckboxes.js b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlCheckboxes.js
similarity index 77%
rename from binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayCheckboxes.js
rename to binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlCheckboxes.js
index 0a3a81c7a0..6f5f63cd5a 100644
--- a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayCheckboxes.js
+++ b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlCheckboxes.js
@@ -4,11 +4,11 @@
* If the class has a checked property, then that will be called every simulation update to
* synchronize the state of the checkbox (only if the developer overaly is opened).
*/
-class DeveloperOverlayCheckboxes
+class DeveloperOverlayControlCheckboxes
{
}
-DeveloperOverlayCheckboxes.prototype.ControlAll = class
+DeveloperOverlayControlCheckboxes.prototype.ControlAll = class
{
label()
{
@@ -30,7 +30,7 @@ DeveloperOverlayCheckboxes.prototype.ControlAll = class
}
};
-DeveloperOverlayCheckboxes.prototype.ChangePerspective = class
+DeveloperOverlayControlCheckboxes.prototype.ChangePerspective = class
{
constructor(playerViewControl)
{
@@ -48,7 +48,7 @@ DeveloperOverlayCheckboxes.prototype.ChangePerspective = class
}
};
-DeveloperOverlayCheckboxes.prototype.SelectionEntityState = class
+DeveloperOverlayControlCheckboxes.prototype.SelectionEntityState = class
{
constructor(playerViewControl, selection)
{
@@ -66,7 +66,7 @@ DeveloperOverlayCheckboxes.prototype.SelectionEntityState = class
}
};
-DeveloperOverlayCheckboxes.prototype.PathfinderOverlay = class
+DeveloperOverlayControlCheckboxes.prototype.PathfinderOverlay = class
{
label()
{
@@ -79,7 +79,7 @@ DeveloperOverlayCheckboxes.prototype.PathfinderOverlay = class
}
};
-DeveloperOverlayCheckboxes.prototype.HierarchicalPathfinderOverlay = class
+DeveloperOverlayControlCheckboxes.prototype.HierarchicalPathfinderOverlay = class
{
label()
{
@@ -92,7 +92,7 @@ DeveloperOverlayCheckboxes.prototype.HierarchicalPathfinderOverlay = class
}
};
-DeveloperOverlayCheckboxes.prototype.ObstructionOverlay = class
+DeveloperOverlayControlCheckboxes.prototype.ObstructionOverlay = class
{
label()
{
@@ -105,7 +105,7 @@ DeveloperOverlayCheckboxes.prototype.ObstructionOverlay = class
}
};
-DeveloperOverlayCheckboxes.prototype.UnitMotionOverlay = class
+DeveloperOverlayControlCheckboxes.prototype.UnitMotionOverlay = class
{
label()
{
@@ -118,7 +118,7 @@ DeveloperOverlayCheckboxes.prototype.UnitMotionOverlay = class
}
};
-DeveloperOverlayCheckboxes.prototype.RangeOverlay = class
+DeveloperOverlayControlCheckboxes.prototype.RangeOverlay = class
{
label()
{
@@ -131,7 +131,7 @@ DeveloperOverlayCheckboxes.prototype.RangeOverlay = class
}
};
-DeveloperOverlayCheckboxes.prototype.BoundingBoxOverlay = class
+DeveloperOverlayControlCheckboxes.prototype.BoundingBoxOverlay = class
{
label()
{
@@ -144,7 +144,7 @@ DeveloperOverlayCheckboxes.prototype.BoundingBoxOverlay = class
}
};
-DeveloperOverlayCheckboxes.prototype.RestrictCamera = class
+DeveloperOverlayControlCheckboxes.prototype.RestrictCamera = class
{
label()
{
@@ -162,7 +162,7 @@ DeveloperOverlayCheckboxes.prototype.RestrictCamera = class
}
};
-DeveloperOverlayCheckboxes.prototype.RevealMap = class
+DeveloperOverlayControlCheckboxes.prototype.RevealMap = class
{
label()
{
@@ -183,7 +183,7 @@ DeveloperOverlayCheckboxes.prototype.RevealMap = class
}
};
-DeveloperOverlayCheckboxes.prototype.EnableTimeWarp = class
+DeveloperOverlayControlCheckboxes.prototype.EnableTimeWarp = class
{
constructor()
{
@@ -202,7 +202,7 @@ DeveloperOverlayCheckboxes.prototype.EnableTimeWarp = class
};
-DeveloperOverlayCheckboxes.prototype.ActivateRejoinTest = class
+DeveloperOverlayControlCheckboxes.prototype.ActivateRejoinTest = class
{
constructor()
{
@@ -241,7 +241,7 @@ DeveloperOverlayCheckboxes.prototype.ActivateRejoinTest = class
}
};
-DeveloperOverlayCheckboxes.prototype.PromoteSelectedUnits = class
+DeveloperOverlayControlCheckboxes.prototype.PromoteSelectedUnits = class
{
label()
{
@@ -262,7 +262,7 @@ DeveloperOverlayCheckboxes.prototype.PromoteSelectedUnits = class
}
};
-DeveloperOverlayCheckboxes.prototype.EnableCulling = class
+DeveloperOverlayControlCheckboxes.prototype.EnableCulling = class
{
label()
{
@@ -280,7 +280,7 @@ DeveloperOverlayCheckboxes.prototype.EnableCulling = class
}
};
-DeveloperOverlayCheckboxes.prototype.LockCullCamera = class
+DeveloperOverlayControlCheckboxes.prototype.LockCullCamera = class
{
label()
{
@@ -298,7 +298,7 @@ DeveloperOverlayCheckboxes.prototype.LockCullCamera = class
}
};
-DeveloperOverlayCheckboxes.prototype.DisplayCameraFrustum = class
+DeveloperOverlayControlCheckboxes.prototype.DisplayCameraFrustum = class
{
label()
{
@@ -316,7 +316,7 @@ DeveloperOverlayCheckboxes.prototype.DisplayCameraFrustum = class
}
};
-DeveloperOverlayCheckboxes.prototype.DisplayShadowsFrustum = class
+DeveloperOverlayControlCheckboxes.prototype.DisplayShadowsFrustum = class
{
label()
{
diff --git a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlDropDown.js b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlDropDown.js
new file mode 100644
index 0000000000..c3b011a154
--- /dev/null
+++ b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlDropDown.js
@@ -0,0 +1,38 @@
+/**
+ * This class sets up a dropdown in the developer overlay and assigns its specific handler.
+ */
+class DeveloperOverlayControlDropDown extends DeveloperOverlayControl
+{
+ constructor(handler, i)
+ {
+ super(handler, i);
+
+ this.dropdown = Engine.GetGUIObjectByName("dev_command_dropdown[" + i + "]");
+ this.dropdown.onSelectionChange = this.onSelectionChange.bind(this);
+ this.dropdown.hidden = false;
+ }
+
+ onSelectionChange()
+ {
+ this.handler.onSelectionChange(this.dropdown.selected);
+ this.update();
+ }
+
+ update()
+ {
+ this.dropdown.list = this.handler.values().map(e => e.label);
+ this.dropdown.list_data = this.handler.values().map(e => e.value);
+ if (this.handler.selected && this.dropdown.selected != this.handler.selected())
+ this.dropdown.selected = this.handler.selected();
+ if (this.handler.enabled)
+ this.dropdown.enabled = this.handler.enabled();
+ }
+
+ setHidden(hidden)
+ {
+ if (hidden)
+ unregisterSimulationUpdateHandler(this.updater);
+ else
+ registerSimulationUpdateHandler(this.updater);
+ }
+}
diff --git a/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlDropDowns.js b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlDropDowns.js
new file mode 100644
index 0000000000..a9230e0624
--- /dev/null
+++ b/binaries/data/mods/public/gui/session/developer_overlay/DeveloperOverlayControlDropDowns.js
@@ -0,0 +1,37 @@
+/**
+ * This class stores the handlers for the individual dropdowns available in the developer overlay.
+ * Such a class must have onSelectionChange function.
+ * If the class has a selected property, then that will be called every simulation update to
+ * synchronize the state of the dropdown (only if the developer overaly is opened).
+ */
+class DeveloperOverlayControlDrowDowns
+{
+}
+
+DeveloperOverlayControlDrowDowns.prototype.RenderDebugMode = class
+{
+ constructor()
+ {
+ this.selectedIndex = this.values().map(e => e.value).indexOf(
+ Engine.Renderer_GetRenderDebugMode());
+ }
+
+ values()
+ {
+ return [
+ { "value": "RENDER_DEBUG_MODE_NONE", "label": translate("Render Debug Mode Disabled") },
+ { "value": "RENDER_DEBUG_MODE_AO", "label": translate("Render Debug Mode AO") }
+ ];
+ }
+
+ onSelectionChange(selectedIndex)
+ {
+ this.selectedIndex = selectedIndex;
+ Engine.Renderer_SetRenderDebugMode(this.values()[this.selectedIndex].value);
+ }
+
+ selected()
+ {
+ return this.selectedIndex;
+ }
+};
diff --git a/binaries/data/mods/public/gui/session/styles.xml b/binaries/data/mods/public/gui/session/styles.xml
index 0a8c313a42..e3077a97bc 100644
--- a/binaries/data/mods/public/gui/session/styles.xml
+++ b/binaries/data/mods/public/gui/session/styles.xml
@@ -103,11 +103,39 @@
/>
+
+