Some experiments with audio controls in the options window. (Doesn't really work yet, though.)

This was SVN commit r2571.
This commit is contained in:
Acumen
2005-07-31 03:08:07 +00:00
parent bdd5fd8578
commit a9397e0888
4 changed files with 97 additions and 12 deletions
@@ -20,7 +20,7 @@
curr_music.loop();
// Display a .cfg file variable to prove we can access it.
console.write ("Language Version: " + (new ConfigDB()).system.language + ".")
console.write ("Volume: " + g_ConfigDB.system["sound.mastergain"] + ".")
// Unfortunately, although Philip's workaround certainly works,
// a] The value cannot be modified.
// b] Variables a step up in the hierarchy are not recognised (eg system.sound.mastergain).
@@ -889,23 +889,67 @@
style="wheatCrossBox"
type="checkbox"
hotkey="audio.toggle"
size="50%-100 20% 50%-100 30%"
size="50%-50 20% 50%+50 25%"
>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.
// (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);
// (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;
// this.checked = !snd_disabled;
]]></action>
</object>
<object name="pgOptionsAudioMusicGain"
style="wheatBorderBlack"
type="text"
size="50%-20 30% 50%+20 35%"
text_align="center"
text_valign="center"
>
<action on="Load"><![CDATA[
this.caption = g_ConfigDB.system["sound.mastergain"];
]]></action>
</object>
<object name="pgOptionsAudioMusicGainDec"
style="wheatArrowLeft"
type="button"
size="50%-40 30% 50%-25 35%"
>
<action on="Press"><![CDATA[
if (getGUIObjectByName ("pgOptionsAudioMusicGain").caption > 0.0)
guiModifyCaption ("pgOptionsAudioMusicGain", -.1, 1);
curr_music.setGain (getGUIObjectByName ("pgOptionsAudioMusicGain").caption);
g_ConfigDB.system["sound.mastergain"] = getGUIObjectByName ("pgOptionsAudioMusicGain").caption;
]]></action>
</object>
<object name="pgOptionsAudioMusicGainInc"
style="wheatArrowRight"
type="button"
size="50%+25 30% 50%+40 35%"
>
<action on="Press"><![CDATA[
if (getGUIObjectByName ("pgOptionsAudioMusicGain").caption < 1.0)
guiModifyCaption ("pgOptionsAudioMusicGain", .1, 1);
curr_music.setGain (getGUIObjectByName ("pgOptionsAudioMusicGain").caption);
g_ConfigDB.system["sound.mastergain"] = getGUIObjectByName ("pgOptionsAudioMusicGain").caption;
]]></action>
</object>
</object>
<!--
@@ -990,7 +1034,7 @@
<action on="Press"><![CDATA[
// Save changes.
// TODO:
console.write ("Volume: " + g_ConfigDB.system["sound.mastergain"] + ".")
// Close options screen.
closeMainMenuSubWindow ("pgOptions");
]]></action>
@@ -20,7 +20,7 @@
// s.free();
// Adjust the gain (volume) of a sound (floating point range between 0 (silent) and 1 (max volume)).
// s.SetGain(value);
// s.setGain(value);
// ====================================================================
@@ -294,7 +294,15 @@
</sprite>
<sprite name="wheatButtonDisabled">
<effect grayscale=""/>
<effect grayscale="" />
<image texture="global/button/button_wood.png"
real_texture_placement="0 0 160 31"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="wheatButtonTabbed">
<effect add_color="60 42 42 0" />
<image texture="global/button/button_wood.png"
real_texture_placement="0 0 160 31"
size="0 0 100% 100%"
@@ -70,6 +70,15 @@
text_valign="center"
/>
<style name="wheatTabButton"
sprite="wheatButton"
sprite_disabled="wheatButtonTabbed"
sprite_over="wheatButtonOver"
sprite_pressed="wheatButtonTabbed"
text_align="center"
text_valign="center"
/>
<style name="wheatExit"
size="100%+9 0%-25 100%+25 0%-9"
sprite="wheatCheckBoxCross"
@@ -86,6 +95,30 @@
textcolor="black"
/>
<style name="wheatArrowLeft"
font="verdana12"
sprite="wheatCheckBoxOpen"
textcolor="black"
/>
<style name="wheatArrowRight"
font="verdana12"
sprite="wheatCheckBoxOpen"
textcolor="black"
/>
<style name="wheatArrowUp"
font="verdana12"
sprite="wheatCheckBoxOpen"
textcolor="black"
/>
<style name="wheatArrowDn"
font="verdana12"
sprite="wheatCheckBoxOpen"
textcolor="black"
/>
<style name="wheatList"
buffer_zone="5"
font="verdana12"