Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: DonQuixoteMC on Sat 15/02/2014 21:11:49

Title: GUI Background Color - Semi-Transparent Colors?
Post by: DonQuixoteMC on Sat 15/02/2014 21:11:49
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
Title: Re: GUI Background Color - Semi-Transparent Colors?
Post by: Khris on Sat 15/02/2014 23:27:01
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) Select
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.
Title: Re: GUI Background Color - Semi-Transparent Colors?
Post by: Crimson Wizard on Sat 15/02/2014 23:29:47
Maybe I do not understand something, but cannot he just use Transparency property?
I think what DonQuixoteMC wants is semi-transparent black gui?
Title: Re: GUI Background Color - Semi-Transparent Colors?
Post by: DonQuixoteMC on Sun 16/02/2014 00:12:07
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!
Title: Re: GUI Background Color - Semi-Transparent Colors?
Post by: Crimson Wizard on Sun 16/02/2014 00:33:42
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.
Title: Re: GUI Background Color - Semi-Transparent Colors?
Post by: Khris on Sun 16/02/2014 01:35:12
Exactly, if you want fully opaque GUI content with a semi transparent background, you can't use the .Transparency property.
Title: Re: GUI Background Color - Semi-Transparent Colors?
Post by: DonQuixoteMC on Sun 16/02/2014 18:15:45
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! :)