Cursor view whilst over a GUI and not just button

Started by steptoe, Fri 30/12/2011 11:16:06

Previous topic - Next topic

steptoe

Hi

EDIT: I have made a transparent button that covers the gui and it seems to do the trick. If there is a more acceptable way Id'e like to know.

--------------------------------------------------------------------------

the below script works for gui buttons which is fine. However, how do I make it remain the same view for when over a whole gui (ginfo)as well.

Like when the cursor comes off a button over a gui it changes to my default vies and does not change view until gui is closed, which I have done?

Code: ags

   function repeatedly_execute_always() 
  {
   GUIControl *gcat = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
   if ((gcat == null) || (gcat.AsButton == null)) mouse.UseDefaultGraphic();
   else mouse.UseModeGraphic(eModeInteract);

}


cheers for any assistance


Khris

You have code that changes the mouse graphic depending on whether it is over a GUI button or not.

Since you basically want to strike the word "button" in the above sentence, why not check the manual for the function to find out the GUI under the mouse?
Why go the awkward way of using a huge, transparent button? You seem to do this a lot, using awkward workarounds instead of straight solutions. I understand that it is hard for a beginner to always use the right tool for the job because there are so many, but since you know exactly which one you need, why not look if it's in the toolbox first?

Code: ags
function repeatedly_execute_always() 
{
  GUI*gat = GUI.GetAtScreenXY(mouse.x, mouse.y);
  if (gat != null) mouse.UseModeGraphic(eModeInteract);
  else mouse.UseDefaultGraphic();
}

steptoe

#2
Hi Khris

yes, as you say, I do tend to find a workaround which is why I was after a more 'proper' way.

As It only ever occurs on one GUI (ginfo), which is normally invisible, what I have will do but your post is duly noted for another time.

The 'Toolbox' is becoming more apparent with each game.

Thanks Khris  ;)

steptoe


monkey0506

Unless I'm mistaken, even if transparent, a clickable GUI is still returned by GUI.GetAtScreenXY. If it's not clickable (regardless of transparency), it won't.

SMF spam blocked by CleanTalk