Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: on Mon 23/08/2004 04:53:00

Title: Creating a "5 Days a Stranger" style GUI.
Post by: on Mon 23/08/2004 04:53:00
This is the first time I've had to ask a question since I started using AGS in March of this year. I'm sorry to repeat a question if it's been answered.

What I want to do is make a GUI menu that pops up when the user clicks the right mouse button, and then disapears when the mouse is moved off the GUI. Basically what was used for '5 Days.' I don't need an explanation of how to create the actual GUI items. What I could use some help with is the code that I could use to accomplish this technique.

Your help is GREATLY appreciated and I look forward to any replies you can offer.Ã,  ;)

- Steve
Title: Re: Creating a "5 Days a Stranger" style GUI.
Post by: Rui 'Trovatore' Pires on Mon 23/08/2004 08:17:36
Well, I have a tendency to complicate stuff, so there's probably a better way, but -

To summon it with right-click, at the on_mouse_click function you replace the stantard SetNextMode with GUIOn(whatever).  But some extra code will be needed to make sure the GUI isn't offscreen if the mouse is too close to an edge, and out of the top of my head I can't help you.

To make it go away, have a line like this in repeatedly_execute -

if (IsGUIOn(whatever) && GetGUIAt(mouse.x, mouse.y)!=whatever) GUIOff(whatever)
Title: Re: Creating a "5 Days a Stranger" style GUI.
Post by: SilverWizard_OTF on Mon 23/08/2004 13:31:16
You can also use the script command CentreGui( //your Gui);  if you to be revealed in the centre o the screen, the desired Gui.
Title: Re: Creating a "5 Days a Stranger" style GUI.
Post by: Rui 'Trovatore' Pires on Mon 23/08/2004 16:00:01
But of course, then you'd have to set the mouse's coordinates manually so it'd show up at the center of the screen.

I don't think that's the best solution, and neither it is what he's looking for, SilverWizard.
Title: Re: Creating a "5 Days a Stranger" style GUI.
Post by: SilverWizard_OTF on Mon 23/08/2004 20:37:36
Well, i only said my opinion...