1
0
forked from 0ad/0ad

Made the framework of options, history, and campaign screens, mostly just for the hell of it, and fixed various things. Can't do much with them, mind, but Rome wasn't burnt in a day (thank you, Mr Nero).

This was SVN commit r2559.
This commit is contained in:
Acumen 2005-07-28 02:36:48 +00:00
parent f9b9e46436
commit f4844681a1
6 changed files with 312 additions and 58 deletions

View File

@ -47,7 +47,19 @@
==========================================
-->
<object name="pgSinglePlayer"
<object name="pgCampaignsBt"
style="pgButton"
type="button"
size="24.609375% 28.90625% 49.609375% 62.2395833%"
sprite_over="pgCampaignsOver"
tooltip="Want to play a campaign? Tough luck, buddy! That's right, go cry on your mamma's shoulder."
>
<action on="Press"><![CDATA[
openMainMenuSubWindow ("pgCampaigns");
]]></action>
</object>
<object name="pgSinglePlayerBt"
style="pgButton"
type="button"
size="51.2695312% 10.9275% 76.2695312% 44.270833%"
@ -60,7 +72,7 @@
]]></action>
</object>
<object name="pgMultiPlayer"
<object name="pgMultiPlayerBt"
style="pgButton"
type="button"
size="57.5195312% 38.28125% 82.5195312% 71.6145833%"
@ -73,7 +85,7 @@
]]></action>
</object>
<object name="pgEditor"
<object name="pgEditorBt"
style="pgButton"
type="button"
size="40.234375% 60.15625% 65.234375% 93.4895833%"
@ -88,31 +100,29 @@
]]></action>
</object>
<object name="pgOptions"
<object name="pgOptionsBt"
style="pgButton"
type="button"
size="74.7070312% 42.0572916% 99.7070312% 75.390625%"
sprite_over="pgOptionsOver"
tooltip="This will take you to the options menu. It does not work now, but someday it might."
>
<action on="Press"><![CDATA[
// Open Options window.
openMainMenuSubWindow ("pgOptions");
]]></action>
</object>
<object name="pgCampaigns"
style="pgButton"
type="button"
size="24.609375% 28.90625% 49.609375% 62.2395833%"
sprite_over="pgCampaignsOver"
tooltip="Want to play a campaign? Tough luck, buddy! That's right, go cry on your mamma's shoulder."
>
</object>
<object name="pgHistory"
<object name="pgHistoryBt"
style="pgButton"
type="button"
size="72.265625% 66.5364583% 97.265625% 99.8697916%"
sprite_over="pgHistoryOver"
tooltip="One day you will click this button and learn more about ancient history than any history teach ever taught you."
>
<action on="Press"><![CDATA[
openMainMenuSubWindow ("pgHistory");
]]></action>
</object>
<!--
@ -217,6 +227,35 @@
hidden="true"
sprite="bkTranslucent"
>
<!--
===============================================
- CAMPAIGNS SCREEN -
===============================================
-->
<object name="pgCampaigns"
style="wheatWindow"
type="image"
hidden="true"
size="50%-150 50%-120 50%+150 50%+120"
>
<object name="pgCampaignsTitleBar"
style="wheatWindowTitleBar"
type="button"
>Campaigns
</object>
<object name="pgCampaignsExitButton"
style="wheatExit"
type="button"
>
<action on="Press"><![CDATA[
closeMainMenuSubWindow ("pgCampaigns");
]]></action>
</object>
</object>
<!--
===============================================
- MULTIPLAYER MODE SELECTION SCREEN -
@ -798,11 +837,190 @@
</object>
</object>
<!--
===============================================
- CREDITS SCREEN
===============================================
-->
<!--
===============================================
- OPTIONS SCREEN -
===============================================
-->
<object name="pgOptions"
style="wheatWindow"
type="image"
hidden="true"
size="50%-400 50%-300 50%+400 50%+300"
>
<object name="pgOptionsTitleBar"
style="wheatWindowTitleBar"
type="button"
>Options
</object>
<object name="pgOptionsExitButton"
style="wheatExit"
type="button"
>
<action on="Press"><![CDATA[
// Close Options Screen, abandoning all changes.
closeMainMenuSubWindow ("pgOptions");
]]></action>
</object>
<!--
===============================================
- OPTIONS SCREEN - AUDIO
===============================================
-->
<object name="pgOptionsAudioWindow"
style="wheatBorderBlack"
type="image"
size="1% 4% 99% 90%"
>
<object name="pgOptionsAudioSoundCheckBox"
style="wheatCrossBox"
type="checkbox"
hotkey="audio.toggle"
size="50%-100 20% 50%-100 30%"
>Play Sound
<action on="Load"><![CDATA[
// (Would like to set checkbox state to value of snd_disabled, but looks like that variable isn't exposed until after the GUI is loaded.
// this.checked = !snd_disabled;
]]></action>
<action on="Press"><![CDATA[
// Clicking the checkbox turns sound on and off.
// (Or at least it should, but it doesn't. Checkbox text doesn't appear either. Maybe this control isn't finished yet?)
if (snd_disabled == true)
snd_disable (false);
else
snd_disable (true);
this.checked = !snd_disabled;
]]></action>
</object>
</object>
<!--
===============================================
- OPTIONS SCREEN - VIDEO
===============================================
-->
<object name="pgOptionsVideoWindow"
style="wheatBorderBlack"
type="image"
hidden="true"
size="1% 4% 99% 90%"
/>
<!--
===============================================
- OPTIONS SCREEN - GAME
===============================================
-->
<object name="pgOptionsGameWindow"
style="wheatBorderBlack"
type="image"
hidden="true"
size="1% 4% 99% 90%"
/>
<!--
===============================================
- OPTIONS SCREEN - TAB BUTTONS
===============================================
-->
<object name="pgOptionsAudioButton"
style="wheatButton"
type="button"
enabled="false"
size="1% 1% 30% 7%"
>Audio
<action on="Press"><![CDATA[
// Open Audio tab.
openOptionsTab ("pgOptionsAudio");
]]></action>
</object>
<object name="pgOptionsVideoButton"
style="wheatButton"
type="button"
size="35% 1% 65% 7%"
>Video
<action on="Press"><![CDATA[
// Open Video tab.
openOptionsTab ("pgOptionsVideo");
]]></action>
</object>
<object name="pgOptionsGameButton"
style="wheatButton"
type="button"
size="70% 1% 99% 7%"
>Game
<action on="Press"><![CDATA[
// Open Game tab.
openOptionsTab ("pgOptionsGame");
]]></action>
</object>
<!--
===============================================
- OPTIONS SCREEN - ACCEPT BUTTON
===============================================
-->
<object name="pgOptionsAcceptButton"
style="wheatButton"
type="button"
size="40% 92% 60% 100%"
>Accept
<action on="Press"><![CDATA[
// Save changes.
// TODO:
// Close options screen.
closeMainMenuSubWindow ("pgOptions");
]]></action>
</object>
</object>
<!--
===============================================
- HISTORY SCREEN -
===============================================
-->
<object name="pgHistory"
style="wheatWindow"
type="image"
hidden="true"
size="50%-150 50%-120 50%+150 50%+120"
>
<object name="pgHistoryTitleBar"
style="wheatWindowTitleBar"
type="button"
>History
</object>
<object name="pgHistoryExitButton"
style="wheatExit"
type="button"
>
<action on="Press"><![CDATA[
closeMainMenuSubWindow ("pgHistory");
]]></action>
</object>
</object>
<!--
===============================================
- CREDITS SCREEN
===============================================
-->
<object name="pgCredits"
style="fancyTextHeadWhite"

View File

@ -11,25 +11,6 @@
-->
<object>
<!--
==========================================
- AUDIO TOGGLER
==========================================
-->
<object name="audioToggle"
type="button"
hotkey="audio.toggle"
hidden="true"
>
<action on="Press"><![CDATA[
if (snd_disabled == true)
snd_disable (false);
else
snd_disable (true);
]]></action>
</object>
<!--
==========================================
- FPS COUNTER

View File

@ -5,26 +5,60 @@
// ====================================================================
// Helper function that enables the dark background mask, then reveals a given subwindow object.
function openMainMenuSubWindow (windowName)
{
// Helper function that enables the dark background mask, then reveals a given subwindow object.
guiUnHide ("pgSubWindow");
guiUnHide (windowName);
}
// ====================================================================
// Helper function that disables the dark background mask, then hides a given subwindow object.
function closeMainMenuSubWindow (windowName)
{
// Helper function that disables the dark background mask, then hides a given subwindow object.
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.

View File

@ -300,4 +300,8 @@ NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET
>243 242 240
</color>
<color name="blue"
>0 0 255
</color>
</setup>

View File

@ -13,12 +13,15 @@
-->
<!-- Notes:
* backcolor doesn't seem to currently support the new color presets, so it's still using the RGB method.
* Can we make size = 0 0 100% 100% by default? It's seems to be the most common value ("stretched sprite").
While we're here:
* Ask Gee about the assertion failure on startup, and how all the colour values are black (probably related);
* Ask him to remove the "error drawing sprite of 1x0 size" error, since this can happen legitimately sometimes
(divider of 1 pixel width, progressbar at value 0)
* Also ask about clear() function for lists.
* Ask about interpretation of special characters (weird question mark).
* Text formatting for lists (eg centering).
* DDS transparency (ie main menu buttons).
* Ask him about the checkbox and whether it's available for use (show first example in Options).
-->
<sprite name="bkTranslucent">
@ -28,50 +31,50 @@
</sprite>
<sprite name="bkWhiteBorderBlack">
<image backcolor="255 255 255"
<image backcolor="white"
size="0 0 100% 100%"
border="true"
bordercolor="0 0 0"
bordercolor="black"
/>
</sprite>
<sprite name="bkBlueBorderBlack">
<image backcolor="0 0 255"
<image backcolor="blue"
size="0 0 100% 100%"
border="true"
bordercolor="0 0 0"
bordercolor="black"
/>
</sprite>
<sprite name="bkBorderBlack">
<image backcolor="0 0 0"
<image backcolor="black"
size="-1 -1 100%+1 0"
/>
<image backcolor="0 0 0"
<image backcolor="black"
size="-1 100% 100%+1 100%+1"
/>
<image backcolor="0 0 0"
<image backcolor="black"
size="-1 0 0 100%"
/>
<image backcolor="0 0 0"
<image backcolor="black"
size="100% 0 100%+1 100%"
/>
</sprite>
<sprite name="bkFillBlack">
<image backcolor="0 0 0"
<image backcolor="black"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="bkFillWhite">
<image backcolor="255 255 255"
<image backcolor="white"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="bkFillGray">
<image backcolor="243 242 240"
<image backcolor="gray"
size="0 0 100% 100%"
/>
</sprite>
@ -290,6 +293,14 @@
/>
</sprite>
<sprite name="wheatButtonDisabled">
<effect grayscale=""/>
<image texture="global/button/button_wood.png"
real_texture_placement="0 0 160 31"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="wheatIndentBorder">
<!-- Starting with top left corner continuing in a clockwise manner -->
<!-- Top border -->

View File

@ -53,14 +53,18 @@
<style name="wheatButton"
sprite="wheatButton"
sprite_disabled="wheatButtonDisabled"
sprite_over="wheatButtonOver"
sprite_pressed="wheatButtonOver"
text_align="center"
text_valign="center"
/>
<style name="wheatButtonFancy"
sprite="wheatButton"
sprite_disabled="wheatButtonDisabled"
sprite_over="wheatButtonOver"
sprite_pressed="wheatButtonOver"
font="prospero18"
text_align="center"
text_valign="center"
@ -74,10 +78,12 @@
tooltip_style="pgToolTip"
/>
<style name="wheatCheckBox"
size="100%+9 0%-25 100%+25 0%-9"
<style name="wheatCrossBox"
font="verdana12"
sprite="wheatCheckBoxOpen"
sprite_over="wheatCheckBoxCross"
sprite2="wheatCheckBoxCross"
square_side="16"
textcolor="black"
/>
<style name="wheatList"