Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: KodiakBehr on Sat 14/07/2012 03:47:21

Title: Mouseover Button Effect
Post by: KodiakBehr on Sat 14/07/2012 03:47:21
I want to set my GUI up so that when the cursor mouse-overs any button in the GUI, it switches to a pointing cursor, and when it moves off that button, it goes back to what it was.

So I figured the best was to go about it is to add in rep_exec :

GUIControl*gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if (gc == btnIconInv) mouse.UseModeGraphic(eModePointer);
else mouse.UseDefaultGraphic();

Problem is, now it's constantly calling the current cursor, resulting in the stuttering of the cursor animation.  Is there a better way to accomplish my objective?
Title: Re: Mouseover Button Effect
Post by: ThreeOhFour on Sat 14/07/2012 05:14:21
Have you tried adding a condition to your else?

Something like:

Code (ags) Select

GUIControl*gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if (gc == btnIconInv) mouse.UseModeGraphic(eModePointer);
else if (gc != btnIconInv && mouse.GetModeGraphic(eModeInteract) != 2389) mouse.UseDefaultGraphic();
Title: Re: Mouseover Button Effect
Post by: KodiakBehr on Sat 14/07/2012 05:59:27
There we go.  Thanks!
Title: Re: Mouseover Button Effect
Post by: ThreeOhFour on Sat 14/07/2012 06:41:18
Jolly good!  :)