GUI Background Color - Semi-Transparent Colors?

Started by DonQuixoteMC, Sat 15/02/2014 21:11:49

Previous topic - Next topic

DonQuixoteMC

Hey everyone, this is my first post, so bear with me!

I've just started working on a game, and I'm incredibly new to AGS.
Anyhow, this is my question:
I know the "transparent color" is Magenta, but how can I set a semi transparent color as the GUI background color (under "Appearance" in the GUI menu)? Like a black that you can kind of see through.

Thanks in advance!

DonQuixoteMC

Khris

You can't; there are two ways to fix this:

1) Use a second GUI with a lower z order, make its background color black, then set its transparency to 50% or so. If the GUI has a variable size, you can set the 2nd GUI's position and size in repeatedly_execute_always in the Global script:
Code: ags
function repeatedly_execute_always() {
  if (gActualGUI.Visible) {
    gBlackBackground.SetPosition(gActualGUI.X, gActualGUI.Y);
    gBlackBackground.SetSize(gActualGUI.Width, gActualGUI.Height);
    gBlackBackground.Visible = true;
  }
  else gBlackBackground.Visible = false;
}

That way the semi transparent black GUI will always be exactly behind the actual GUI.

2) Create a 32bit color game (you can set the color depth in the General settings), then import a semi transparent PNG as background image.

Crimson Wizard

Maybe I do not understand something, but cannot he just use Transparency property?
I think what DonQuixoteMC wants is semi-transparent black gui?

DonQuixoteMC

Method 2 sounds perfect.

And yeah, that's exactly what I'm going for, Crimson Wizard. How would I set the Transparency property?

Thanks for the replies guys!

Crimson Wizard

#4
Quote from: DonQuixoteMC on Sun 16/02/2014 00:12:07
And yeah, that's exactly what I'm going for, Crimson Wizard. How would I set the Transparency property?
It's in the same menu as "BackgroundColour", several lines lower...
Transparency = 50 is half-transparent.

E: Actually I now remembered what was wrong with that property: it makes everything transparent, gui controls (buttons etc) too.
Depending on what you want precisely this may or may not be useful.

Khris

Exactly, if you want fully opaque GUI content with a semi transparent background, you can't use the .Transparency property.

DonQuixoteMC

So, what you're saying is that I can't have opaque text? The whole GUI gets the transparency effect?

That's fine, I think I'll end up using the 32-bit color method and import semi transparent .PNG files for the border sprites and background. Thanks so much for your help, guys! I tried looking up a solution, but none of the answers quite made sense. Now I understand though! :)

SMF spam blocked by CleanTalk