1
0
forked from 0ad/0ad
0ad/binaries/data/mods/official/gui/test/functions_page_pregame.js

82 lines
1.9 KiB
JavaScript

/*
DESCRIPTION : Main Pregame JS Script file.
NOTES : Contains functions and code for Main Menu.
*/
// ====================================================================
// Helper function that enables the dark background mask, then reveals a given subwindow object.
function openMainMenuSubWindow (windowName)
{
guiUnHide ("pgSubWindow");
guiUnHide (windowName);
}
// ====================================================================
// Helper function that disables the dark background mask, then hides a given subwindow object.
function closeMainMenuSubWindow (windowName)
{
guiHide ("pgSubWindow");
guiHide (windowName);
}
// ====================================================================
// Switch to a given options tab window.
function openOptionsTab(tabName)
{
// Hide the other tabs.
for (i = 1; i <= 3; i++)
{
switch (i)
{
case 1:
tmpName = "pgOptionsAudio";
break;
case 2:
tmpName = "pgOptionsVideo";
break;
case 3:
tmpName = "pgOptionsGame";
break;
default:
break;
}
if (tmpName != tabName)
{
getGUIObjectByName (tmpName + "Window").hidden = true;
getGUIObjectByName (tmpName + "Button").enabled = true;
}
}
// Make given tab visible.
getGUIObjectByName (tabName + "Window").hidden = false;
getGUIObjectByName (tabName + "Button").enabled = false;
}
// ====================================================================
// Move the credits up the screen.
function updateCredits()
{
// If there are still credit lines to remove, remove them.
if (getNumItems("pgCredits") > 0)
removeItem ("pgCredits", 0);
else
{
// When we've run out of credit,
// Stop the increment timer if it's still active.
cancelInterval();
// Close the credits screen and return.
closeMainMenuSubWindow ("pgCredits");
guiUnHide ("pg");
}
}
// ====================================================================