Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Thu 02/05/2013 08:38:12

Title: Button: cursor mode problem
Post by: Slasher on Thu 02/05/2013 08:38:12
Hi

I have a situation that to some may be acceptable but I don't and hope someone will assist me in this niggling problem.

I have scripted so that when the mouse is over the gStatusline (bottom of screen) the mouse changes to a pointer and when leaving the gStatusline it returns mouse.Mode=old_mode. This work fine, no problem.

Code (AGS) Select
GUI* theGui = GUI.GetAtScreenXY(mouse.x, mouse.y);
if (theGui == gStatusline && mouse.Mode != eModePointer)
{
old_mode=mouse.Mode;
mouse.ChangeModeGraphic (eModePointer, 2061);
mouse.Mode = eModePointer;
}


I also have the gIconbar Visible at all times at the top right of screen.

I have had to script the gIconbar so that the mouse acts like as gStatusline regarding cursor modes ie mouse changes to pointer when over gIconbar buttons.

Now, the problem is this: The mouse, when hovering over the close inventory button changes to a pointer. Once inventory is closed the mouse reverts to the inventory item if one was selected.

I know the reason is because I have this scripted for buttons:

Code (AGS) Select
GUIControl *gcat = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if ((gcat == null) || (gcat.AsButton == null)) mouse.UseDefaultGraphic();
else mouse.UseModeGraphic(eModePointer);
}


with also this:

Code (AGS) Select
if (theGui != gStatusline && mouse.Mode == eModePointer && mouse.GetModeGraphic(eModePointer) == 2061)
{
  mouse.Mode=old_mode;


What I am looking for is to keep mouse active inventory graphic mode showing when going to close the inventory gui yet still maintain cursor mode for the rest of the buttons. If that makes sense?

Help appreciated.

Meanwhile I'm going to try this:

Code (AGS) Select
   
if (gInventory.Visible==true && mouse.ChangeModeGraphic(eModeUseinv,2057 ))
{
mouse.Mode = eModeUseinv;




Title: Re: Button: cursor mode problem
Post by: Khris on Thu 02/05/2013 09:40:34
The last piece of code has the setter instead of the getter in the if condition.

I'm still too tired to map out the logic, but since you want to change the behavior for one button, changing this:
Code (ags) Select
if ((gcat == null) || (gcat.AsButton == null)) mouse.UseDefaultGraphic();
should do it.
Something like
Code (ags) Select
if (gcat == null || gcat.AsButton == null || gcat.AsButton == bCloseInventory) mouse.UseDefaultGraphic();