GUI vanishes when mouse is not over...

Started by Dzhak, Mon 13/07/2009 15:36:24

Previous topic - Next topic

Dzhak

Hi all.

I have made a little menu GUI that sits in the bottom left corner of the screen, with butons that allow you to select look or talk cursers or your inventory etc.
When you click on the inventory button that opens up over the menu.

What I want to happen is that when the mouse is not over the inventory it dissapears and leaves the menu back on show.
When you click an item it stays up so you can mix items and whatnot but as soon as the curser leaves it, it vanishes.
An example of this would be something like in 5 days a stranger.

Thanks in advance for any help.

PS. I'm sure this is pretty simple really...I always seem to get stuck on the simple things but manage ok with some rather complex stuff. Heh heh.

GuyAwesome

At the most basic
Code: ags

  // in repeatedly_execute
  if (GUI.GetAtScreenXY(mouse.x,mouse.y) != gInventory) gInventory.Visible = false;


That should work, provided when the Inventory GUI appears it's under the cursor. If not, it'll switch right back off - try moving the cursor with mouse.SetPosition, or allowing the GUI to be visible if the cursor is over the Menu GUI as well, or whatever. If the Menu GUI switches off when the Inventory is on, try
Code: ags

  if (GUI.GetAtScreenXY(mouse.x,mouse.y) != gInventory && gInventory.Visible == true) {
    gInventory.Visible = false;
    gMenu.Visible = true;
}


For anything more advanced - more details please, or is it complex enough for you to handle now?  :P

Dzhak

Well Guyawesome, you are in fact...awesome.

Much thanks dude.

SMF spam blocked by CleanTalk