Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: barefoot on Sat 19/03/2011 04:56:45

Title: SOLVED: The mouse cursor change to the hand icon when over any GUI button..
Post by: barefoot on Sat 19/03/2011 04:56:45
Hi

I'm wondering. mainly because I would like to do this, is it possible to have the mouse cursor change to the hand icon when over any GUI button?

cheers

barefoot



Title: Re: The mouse cursor change to the hand icon when over any GUI button..
Post by: monkey0506 on Sat 19/03/2011 05:07:40
Yes, yes it is possible:

// GlobalScript.asc

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


That's a bit a bit selfish as it doesn't directly interoperate nicely with other scripts, but it fits the task at hand, and with a bit of tweaking could be made to work with other scripts where you may be using the UseModeGraphic function.
Title: Re: The mouse cursor change to the hand icon when over any GUI button..
Post by: barefoot on Sat 19/03/2011 05:09:20
Thanks very much Monkey.. I'll give it a go..

cheers  :=

barefoot
Title: Re: The mouse cursor change to the hand icon when over any GUI button..
Post by: barefoot on Sat 19/03/2011 05:29:22
Yep.. this works for me  :=


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


cheers Monkey.. Thanks a million...

barefoot

Title: Re: SOLVED: The mouse cursor change to the hand icon when over any GUI button..
Post by: monkey0506 on Sat 19/03/2011 07:01:38
Can I ask why you would want to use an arbitrary number in place of the cursor's name (by way of the eMode enumerated value)? From a technical standpoint the two are completely equatable within AGS, but I don't understand why that would be preferable to you (as a human..you are human, right? :o)
Title: Re: SOLVED: The mouse cursor change to the hand icon when over any GUI button..
Post by: barefoot on Sat 19/03/2011 08:16:33
Hi Monkey

the reason is because an error comes up when i use (eModeHand); for some reason...

Iv'e since discovered that using (eModeInteract); actually works the same as the number you so rightly pointed out to me..  :=

And yes, I am human.. I think  (but not too hard)  ;D  

barefoot