Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: auriond on Wed 25/10/2006 12:45:05

Title: Setting GUI visibility from within the game?
Post by: auriond on Wed 25/10/2006 12:45:05
I'm just curious to know if this is possible, since I've searched the manual, the FAQs and the forums to no avail:

Is it possible to allow the player to set a GUI's visibility from within the game using an options GUI button? I'm talking about, for example, allowing the player the option of turning the Iconbar GUI permanently on, or turning it "off" (actually, rendering the GUI's Visible property to Mouse YPos). The effect can be seen in Gabriel Knight 1. I thought it must have been addressed before, so if I've missed it, please point me to the relevant page. Thanks!
Title: Re: Setting GUI visibility from within the game?
Post by: Ashen on Wed 25/10/2006 13:09:47
You haven't missed anything -  it's not possible to alter a GUIs Visibilty type within the game, and I don't think this exact question has been asked before.

However, if you set the GUI to 'Normal' visibilty you can code behaviour similar to the 'Mouse Y-Pos' type (that should be around the forums, somewhere) and use a variable to track whether to use that, or leave the GUI always on. E.g.:


//Top of Global script
int GUIVis;

// In 'repeatedly_execute' function
  if (GUIVis == 1) { // If you want to use 'Mouse Y-Pos' style
    if (mouse.y < 20)
      gIconbar.Visible = true; // Turn Iconbar on when near top of screen
    if (gIconbar.Visible == true && GUI.GetAtScreenXY(mouse.x, mouse.y) != gIconbar)
      gIconbar.Visible = false;  // Turns Iconbar back off when the mouse is no longer over it
  }


Then have a Button (or two) somewhere to set GUIVis to 1 (for 'Mouse Y-Pos' functioning) or 0 (for 'Normal'). Depending on where that Button is, you might need to manually turn gIconbar on/off when you change type (e.g. when going back to 'Normal').
Title: Re: Setting GUI visibility from within the game?
Post by: auriond on Wed 25/10/2006 13:14:23
Oh... yes, I was afraid it might be something like that! I could probably implement that, sometime in the far future, but right now I'm afraid my newbie skills are not quite up to scratch yet. But thank you for the answer, and I hope this info is helpful to someone else in the meantime.