Two GUIs to Solve Inventory Display Alpha Channel [SOLVED]

Started by Play_Pretend, Sat 20/10/2007 11:02:37

Previous topic - Next topic

Play_Pretend

Hey all...I just read Ashen's posts about making a GUI with a transparent area on it, and causing a second GUI to pop up simultaneously behind it, which allows you to display smooth, alpha-channeled inventory sprites in the current inventory item window on the Iconbar:

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=26847.0

I just tried this myself, since my game is 32 bit with alpha channels on almost everything...I got it to *pretty* much work, so when the Iconbar menu pops down, it shows smoothly alpha-channelled sprites in the current inventory item window. 

However, since the two GUIs are set to pop up depending on mouse position (y-position of 8 in my game), the background one will disappear once I move the mouse down, even though the main one is still there.  Then they'll flip back and forth between each other if you keep moving the mouse back up to the top of the screen.

Is there any way to make both these GUIS move together as a team, appearing and disappearing only at the same time?  And still do it as a mouse-position popup?  I just tried it again, setting it as Popup Modal, and it works perfectly that way, but I'd really like it as mouse position.  Thanks!

Here's my main GUI window:



And here's the background one that goes behind it, filling the window in the middle:



I suppose the second one could be smaller, but I didn't feel like lining up just the window with the hole. :)

Ashen

How about:
Make the 'background' GUI Mouse Y-Pos based, and the one with the buttons on Normal. (I don't know if it matters which is which, provided only one of them is Mouse Y-Pos - if the one with the buttons is the Y-Pos one, they switch off when you click something, if it's the background one, you'll have to click and move the mouse away. Up to you)
In rep_ex_always add the line:
Code: ags

  gIconbar.Visible = gBackground.Visible; // or whatever the actual Script names are. Second one mentioned should be the Mouse Y-Pos one



If that's no good for you, you'll have to mae them both normal, and code the mouse position bit yourself. (Not that hard - just check against mouse.y to turn them on and GUI.GetAtScreenXY to turn them off).
I know what you're thinking ... Don't think that.

Play_Pretend

#2
Woohoo!  That worked *PERFECTLY*!  Thank you so much!  I used the code line just like you said, set the main GUI Iconbar to Normal, and the background one Iconbacker to Mouse Position, put that line in Repeatedly Execute and it works like a charm!  Thanks a ton Ashen!  ;D

UPDATE:  Whoops, one more quirk: I've noticed now that whenever he enters the game for the first moment, it automatically pops up both the GUIs at the top.  They disappear immediately if the mouse is low enough, but it's still visible for a second.  Is there any way to stop that from happening?  Thanks again!

DOUBLE UPDATE:  Never mind, I figured it out.  I just had to put a gIconbar.Visible = false; command in the game_start section of the global script.  Problem once again solved! :)

SMF spam blocked by CleanTalk