Game Development Community

how to make a transparent button and play video in background of main menu?

by ahsan muzaheed · in Torque 3D Public · 06/02/2011 (9:57 am) · 9 replies

how to make a button transparent in gui editor?
and
in background of the main menu i want to play video(like battelfield or gun).which file format can be played and how in background?
i have search in manual.nothing found
thanks


#1
06/02/2011 (10:14 am)
Button transparency can be adjusted by changing the alpha of the color in the profile associated with the button.

BitmapButtons use the transparency of the associated image asset.

For videos in Torque use Theora videos (.ogg format).
#2
06/02/2011 (10:51 am)
button class is GuiButtonCtrl.
and
profile is GuiMenuButtonProfile.
here is it:
new GuiControlProfile( GuiMenuButtonProfile )
{
opaque = true;
border = false;
fontSize = 18;
fontType = "Arial Bold";
fontColor = "50 50 50";
fontColorHL = "0 0 0";
fontColorNA = "200 200 200";
//fontColorSEL ="0 0 0";
fixedExtent = false;
justify = "center";
canKeyFocus = false;
bitmap = "./images/selector-button";
hasBitmapArray = false;
category = "Core";
};

here is no variable for alpha.
so i look at GuiControlProfile in script manual.
it also do not have one.
it seems i am missing something about the properties of image type.
#3
06/02/2011 (11:11 am)
Given that example, you wont see transparency because the profile is forcing the use of a bitmap.

Just create a new profile, can use the ProfileEditor of the GuiEditor, making sure not to use a bitmap image and setting it's fillColor property to 0 in the alpha. The color properties are expressed numerically as "RED GREEN BLUE ALPHA".

So for example I create a new GuiProfile in the Profile Editor, naming it TransMenuButton. The only property I'm really concerned about at this time is the fillColor, which I set to "242 241 240 0". Save the new profile, then switch back to the Gui Editor and change the profile property of the GuiButtonCtrl to TransMenuButton.

This is the profile as it was saved out from the editor:
singleton GuiControlProfile(TransMenuButton)
{
   fillColor = "242 241 240 0";
};
This results in a transparent button, displaying text only in the default color. You can further modify the text fontColors to suit your needs.
#4
06/02/2011 (3:55 pm)
If 0 is transparent, what is the value for non-transparent? 1? And half is 0.5?
#5
06/02/2011 (4:09 pm)
0-255

Scaled just like the color values.
#6
06/02/2011 (4:13 pm)
I see. Makes sense. Thanx
#7
06/02/2011 (6:34 pm)
ok.it worked.
another shortcut is:
gui editor->profiles->Filter.->type(GuiMenuButtonProfile)->
enter->press button of top-right corner(create new profile by copying selected profile ) ->give a name to it->misc->bitmap->clear it->enter->fill color-> change it to "242 241 240 0"->enter->press button(save the currently selected profile).

the last one is very important.

go to gui->select your control->control->profile->(select the profile that you have created)->file->save

done.

thanks.
#8
06/02/2011 (6:38 pm)
i am trying to save my profile in separate *.cs file.but where to exe this.i mean where gui files are exeing.
#9
06/02/2011 (9:43 pm)
scripts/client/init.cs