mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-21 13:44:40 +00:00
Marginally improved game performance by reducing session GUI updates (now waits over a second before updating the controls, but at least the frame rate is better). Also turned off GUI refresh when in full-screen mode (Alt+G).
This was SVN commit r1448.
This commit is contained in:
@@ -9,17 +9,13 @@
|
||||
-->
|
||||
|
||||
<objects>
|
||||
|
||||
<object type="empty" name="session_gui" hotkey="flipgui.toggle" size="0 0 100% 100%" z="1" hidden="true">
|
||||
// <action on="Load"><![CDATA[
|
||||
// setInterval(getObjectInfo, 50);
|
||||
// ]]></action>
|
||||
<action on="Load"><![CDATA[
|
||||
setInterval( getObjectInfo, 1, 1000 );
|
||||
]]></action>
|
||||
<action on="Press"><![CDATA[
|
||||
FlipGUI();
|
||||
]]></action>
|
||||
<action on="Tick"><![CDATA[
|
||||
getObjectInfo();
|
||||
]]></action>
|
||||
|
||||
<!-- GROUP: GROUP PANE -->
|
||||
<object type="empty" name="session_group_pane" hotkey="grouppane.toggle" size="0 0 100% 100%" z="1" hidden="true">
|
||||
|
||||
@@ -36,53 +36,57 @@ function getObjectInfo()
|
||||
{
|
||||
// Updated each tick to extract entity information from selected unit(s).
|
||||
|
||||
if (!selection.length) // If no entity selected,
|
||||
// Don't process GUI when we're full-screen.
|
||||
if (GUIType != "none")
|
||||
{
|
||||
// Hide Status Orb
|
||||
getGUIObjectByName("session_status_orb").hidden = true;
|
||||
|
||||
// Hide Group Pane.
|
||||
getGUIObjectByName("session_group_pane").hidden = true;
|
||||
|
||||
getGlobal().MultipleEntitiesSelected = 0;
|
||||
}
|
||||
else // If at least one entity selected,
|
||||
{
|
||||
// Store globals for entity information.
|
||||
// strString = "" + selection[0].position;
|
||||
// EntityPos = strString.substring(20,strString.length-3);
|
||||
|
||||
UpdateStatusOrb();
|
||||
|
||||
// Check if a group of entities selected
|
||||
if (selection.length > 1)
|
||||
if (!selection.length) // If no entity selected,
|
||||
{
|
||||
// If a group pane isn't already open, and we don't have the same set as last time,
|
||||
// NOTE: This "if" is an optimisation because the game crawls if this set of processing occurs every frame.
|
||||
// It's quite possible for the player to select another group of the same size and for it to not be recognised.
|
||||
// Best solution would be to base this off a "new entities selected" instead of an on-tick.
|
||||
if (
|
||||
// getGUIObjectByName("session_group_pane").hidden == true ||
|
||||
selection.length != getGlobal().MultipleEntitiesSelected)
|
||||
{
|
||||
UpdateGroupPane();
|
||||
getGlobal().MultipleEntitiesSelected = selection.length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getGlobal().MultipleEntitiesSelected = 0;
|
||||
// Hide Status Orb
|
||||
getGUIObjectByName("session_status_orb").hidden = true;
|
||||
|
||||
// Hide Group Pane.
|
||||
getGUIObjectByName("session_group_pane").hidden = true;
|
||||
|
||||
getGlobal().MultipleEntitiesSelected = 0;
|
||||
}
|
||||
}
|
||||
else // If at least one entity selected,
|
||||
{
|
||||
// Store globals for entity information.
|
||||
// strString = "" + selection[0].position;
|
||||
// EntityPos = strString.substring(20,strString.length-3);
|
||||
|
||||
// Modify any resources given/taken (later, we need to base this on a resource-changing event).
|
||||
UpdateResourcePool();
|
||||
UpdateStatusOrb(); // (later, we need to base this on the selected unit's stats changing)
|
||||
|
||||
// Update Team Tray (later, we need to base this on the player creating a group).
|
||||
UpdateTeamTray();
|
||||
// Check if a group of entities selected
|
||||
if (selection.length > 1)
|
||||
{
|
||||
// If a group pane isn't already open, and we don't have the same set as last time,
|
||||
// NOTE: This "if" is an optimisation because the game crawls if this set of processing occurs every frame.
|
||||
// It's quite possible for the player to select another group of the same size and for it to not be recognised.
|
||||
// Best solution would be to base this off a "new entities selected" instead of an on-tick.
|
||||
if (
|
||||
// getGUIObjectByName("session_group_pane").hidden == true ||
|
||||
selection.length != getGlobal().MultipleEntitiesSelected)
|
||||
{
|
||||
UpdateGroupPane(); // (later, we need to base this on the selection changing)
|
||||
getGlobal().MultipleEntitiesSelected = selection.length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getGlobal().MultipleEntitiesSelected = 0;
|
||||
|
||||
// Hide Group Pane.
|
||||
getGUIObjectByName("session_group_pane").hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Modify any resources given/taken (later, we need to base this on a resource-changing event).
|
||||
UpdateResourcePool();
|
||||
|
||||
// Update Team Tray (later, we need to base this on the player creating a group).
|
||||
UpdateTeamTray();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
Reference in New Issue
Block a user