[SOLVED]GUI transparency

Started by Revae, Sun 22/01/2012 04:46:46

Previous topic - Next topic

Revae

Hey all.

I've been trying to find information on making a "New game, Load game, etc." menu, but moreover, one with semi-transparency (a drop shadow).  What I'm trying to do exactly is make an inventory item that will open this:

Over whatever room you're in.

But when I have the GUI open by default there is no transparency, the background is black.  Whats more is the buttons, and title overlayed on the GUI background also aren't transparent, the parts that should be show up black as well.

The verbcoin templets inventory seems to get around this by having a separate underlay, but I can't figure out how they worked that out in any scripts.  I've looked around the internet for 2 days now, but the only gui scripting tutorials, or threads I can find are for AGS 2.6, or don't cover anything like this.

If worst comes to worst, I could fake it, but I'd lose the drop shadow, and it wouldn't look nearly as clean.  Not the end of the world, but I figure I should be learning as much as possible as I go, and this seems pretty useful.  Thanks in advance for any help!

Revae

Wish I'd played around for 10 minutes more before posting that.  I have the buttons working, but not the background transparency.  So.  Yeah.  :D

Khris

Afaik it's still not possible to put semi-transparent buttons on a semi-transparent GUI.
If you want semi-transparent buttons, use "normal" transparency for the GUI background (by selecting a single color during importing it).

As for the drop shadow, use a second GUI which you position and turn (in)visible in repeatedly_execute_always so it's going to mimic the inventory GUI.

Code: ags
repeatedly_execute_always() {
  gInvShadow.Visible = gInventory.Visible;
  gInvShadow.SetPosition(gInventory.X, gInventory.Y);
}

Miglioshin


If I understand correctly what you want to do, you want to 'cut' the black background of your Gui.

Try to change the black background colour of your GUI background sprite into a unique colour (different from any other colour used in the sprite) and, while re-importing the image set the transparency colour accordingly (like top-lef pixel or bottom left pixel or so)
In the same way you do for the objects or charachters sprites.

If you wanted your 'entire'  gui to be semi-transparent (for some reason), just set the trsparency accordingly in the GUI menu (to the right) or in game_start():
gMyGui.Transparency=50 (i.e.) (0 = solid - 100 = invisible)

Just checked it with one of my GUIs (AGS 3.2.1 SP1) and it works fine.

Revae

Alright.  After some fudging about for a while I think I have all this figured out.  Thanks folks!

Though I don't know what "afaik" means.

Miglioshin


I'm not an expert when it comes to abbreviations or chat-like typing...

but I guess ''afaik'' means ''as far as I know''.

Cheers

Khris

Revae, could you give some info about how you solved this?
Imagine someone else finding this in a few months with [solved] in the title and all and there's no actual solution :)

Revae

Quote from: Khris on Tue 24/01/2012 16:02:26
Revae, could you give some info about how you solved this?
Imagine someone else finding this in a few months with [solved] in the title and all and there's no actual solution :)

Sure.  I cheated.  Instead of having a transparent image for the button I used an opaque button with a background the same as the GUI.  Which makes more sense really anyway since the buttons in this case don't move around at all.

Sorry about that.

SMF spam blocked by CleanTalk