Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Revae on Tue 20/11/2012 03:28:12

Title: Disabling mouse-over image on background GUI buttons [Solved]
Post by: Revae on Tue 20/11/2012 03:28:12
So say I have my save GUI overlapping my main GUI, but when the save GUI is visible the buttons on my main GUI (Main Menu, Save, Load, Quit Game etc) still light up with the mouseover image.  I can't click the buttons or anything, but it's still distracting and pretty sloppy looking.  Is there an easy way to freeze gui's that aren't active, or a hard way even?  Or to freeze the rooms for that matter.

Edit (Solved):  I just ended up brute forcing it with a visibility swap.  I just made a gui with the background image being the main menu image with the buttons just drawn on.  When you open the save gui, the original main menu disappears and the fake main menu becomes visible to take it's place.  Best way I could come up with, and it works well enough for me to stop worrying about it.
Title: Re: Disabling mouse-over image on background GUI buttons
Post by: Khris on Tue 20/11/2012 05:35:03
You could add a GUI that's as big as the screen, set its z-index to something between the main and save GUI's z-index and set it to background: black, transparency: 70%.
Then turn it on whenever the save GUI is displayed:
Code (ags) Select
// in rep_ex_always
  gBlackScreen.Visible = (gSave.Visible || gLoad.Visible);
Title: Re: Disabling mouse-over image on background GUI buttons
Post by: Revae on Tue 20/11/2012 09:13:54
Doesn't seem to keep the mouse overlay images from triggering.  I was thinking that I could just put in something like...

Code (AGS) Select

//in REA
if (gSave.Visible == true){
    btnNewGame.MouseOverGraphic = Normal graphic;
}


But that doesn't seem very clean either, since when you mouseover the buttons you get a slight hiccup as well.  Not that noticeable, but it's more noticeable when there are 2 GUI's up.

Since the save GUI is accessible from more than one location I can't really do anything simple like deactivate the main menu GUI and put a false one in its place without going through a check to see what GUI's are open and what not.  And I would still have he button mouseover lag as well, though maybe not as much.
Title: Re: Disabling mouse-over image on background GUI buttons
Post by: MurrayL on Tue 20/11/2012 11:31:32
Do the mouseover images still trigger if you use the same sort of code to modify gMainMenu.Clickable? That should make the entire of the main menu (and all of its controls) ignored by the mouse.
Title: Re: Disabling mouse-over image on background GUI buttons
Post by: ThreeOhFour on Tue 20/11/2012 12:41:09
A complete shot in the dark, but have you tried setting the visibility property of the save gui to "Pause game when shown"?
Title: Re: Disabling mouse-over image on background GUI buttons
Post by: Revae on Wed 21/11/2012 06:44:33
Quote from: ThreeOhFour on Tue 20/11/2012 12:41:09
A complete shot in the dark, but have you tried setting the visibility property of the save gui to "Pause game when shown"?

I didn't even know that existed and must've looked it over.

I'll try that and if it doesn't work I'll give Murray's idea a go.

EDIT:  Nope.  None of that seemed to keep the mouse-over images from showing up.  I tried setting the main menu gui to unclickable outside of the savegui(or whatever) being open, as a test, and the buttons still lit up (though unclickable).
Title: Re: Disabling mouse-over image on background GUI buttons [Solved]
Post by: Khris on Wed 21/11/2012 23:08:38
I tested this and well, this is clearly a bug. It seems like the only thing that the code that switches the button's image checks is the mouse position.
It makes sense that it would ignore the game being paused, but it definitely shouldn't switch a button's image while said button is covered by another (clickable) GUI.

The other solution (or rather, workaround) I can think of is limiting the mouse to the save gui using mouse.SetBounds().
Title: Re: Disabling mouse-over image on background GUI buttons [Solved]
Post by: Revae on Fri 23/11/2012 09:14:47
Yeah.  It didn't look hopeful before I asked the question, but I figured I'd give it a go.  My fake gui looks fine anyway.  No mouse hiccups or anything.  It was just a weird thing to have to do.

If I run into a similar problem later I'll give setbounds a go.
Title: Re: Disabling mouse-over image on background GUI buttons [Solved]
Post by: Crimson Wizard on Fri 23/11/2012 16:53:40
Quote from: Khris on Wed 21/11/2012 23:08:38
I tested this and well, this is clearly a bug.
IMHO that is not a bug but rather a lack of feature. AGS guis always act as modeless dialogs.
Clickable property is not truly equal to "disabled" (someone may want to have click-through gui with buttons that react on mouse moves).
I think that ultimately the solution would be to introduce a concept of modal and non-modal GUIs (or modal mode).
I made an issue for that; please, add any comments if you want: http://www.adventuregamestudio.co.uk/forums/index.php?issue=365.0