Problems with GUI and sounds in TGB
by Janusz Bien · in Torque Game Engine · 08/17/2006 (3:15 am) · 0 replies
I'm trying to add some sounds to my buttons in menu, but there's this problem I can't solve by myself:
I've created the script for audio to load:
new AudioDescription(AudioNonLooping)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $GuiAudioType;
};
new AudioDescription(AudioLooping)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $GuiAudioType;
};
new AudioProfile(backgroundMusic)
{
filename = "~/data/audio/36_07 Piano Bar I.wav";
description = "AudioLooping";
preload = false;
};
new AudioProfile(najechane)
{
filename = "~/data/audio/collect-gem-new.wav";
description = "AudioNonLooping";
preload = false;
};
new AudioProfile(wcisniete)
{
filename = "~/data/audio/option-accept.wav";
description = "AudioNonLooping";
preload = false;
};
and added it in my main.cs file:
exec("./data/audio/audio.cs");
then I've created the script for new GUI profile for the buttons:
if(!isObject(klawisz_gra)) new GuiControlProfile (klawisz_gra)
{
opaque = true;
border = true;
soundButtonDown = "wcisniete";
soundButtonOver = "najechane";
};
and added it in my main.cs file also:
exec("./gui/profil.cs");
the new "klawisz_gra" profile is on the list in the GUI editor. when I choose it for the button and hit F10 to run the gui, all works fine, have sound on mouse over and when I press the button
I can save the gui and this is how the button script looks like:
new GuiBitmapButtonCtrl() {
canSaveDynamicFields = "0";
class = "menuButton";
Profile = "klawisz_gra";
HorizSizing = "right";
VertSizing = "bottom";
position = "260 225";
Extent = "280 60";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "~/data/images/ENCYKLOPEDIA";
};
so far so good... but here's my problem - when I run my GUI, there are no sound at all, when I run GUI editor, the profile for the button is "GuiDefaultProfile" instead of "klawisz_gra". no matter what I do, it still go back to "GuiDefaultProfile".
Please help me, I'm desperate!
I've created the script for audio to load:
new AudioDescription(AudioNonLooping)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $GuiAudioType;
};
new AudioDescription(AudioLooping)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $GuiAudioType;
};
new AudioProfile(backgroundMusic)
{
filename = "~/data/audio/36_07 Piano Bar I.wav";
description = "AudioLooping";
preload = false;
};
new AudioProfile(najechane)
{
filename = "~/data/audio/collect-gem-new.wav";
description = "AudioNonLooping";
preload = false;
};
new AudioProfile(wcisniete)
{
filename = "~/data/audio/option-accept.wav";
description = "AudioNonLooping";
preload = false;
};
and added it in my main.cs file:
exec("./data/audio/audio.cs");
then I've created the script for new GUI profile for the buttons:
if(!isObject(klawisz_gra)) new GuiControlProfile (klawisz_gra)
{
opaque = true;
border = true;
soundButtonDown = "wcisniete";
soundButtonOver = "najechane";
};
and added it in my main.cs file also:
exec("./gui/profil.cs");
the new "klawisz_gra" profile is on the list in the GUI editor. when I choose it for the button and hit F10 to run the gui, all works fine, have sound on mouse over and when I press the button
I can save the gui and this is how the button script looks like:
new GuiBitmapButtonCtrl() {
canSaveDynamicFields = "0";
class = "menuButton";
Profile = "klawisz_gra";
HorizSizing = "right";
VertSizing = "bottom";
position = "260 225";
Extent = "280 60";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "~/data/images/ENCYKLOPEDIA";
};
so far so good... but here's my problem - when I run my GUI, there are no sound at all, when I run GUI editor, the profile for the button is "GuiDefaultProfile" instead of "klawisz_gra". no matter what I do, it still go back to "GuiDefaultProfile".
Please help me, I'm desperate!