Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: The Suitor on Thu 28/02/2008 02:41:09

Title: Pointer over gui
Post by: The Suitor on Thu 28/02/2008 02:41:09
When I put the cursor over the Iconbar, it turns to a pointer, which is okay.   But my problem is that when I move the mouse away from the GUI the cursor is still a pointer.  It's not locked or anything, i just want it to return to the last selected cursor.


function repeatedly_execute() {


GUI *theGui = GUI.GetAtScreenXY(mouse.x, mouse.y);
if (theGui == gStatusline) {
FadeGuiIn_NoBlock(gIconbar, 0, -20, 0);
SetCursorMode(eModePointer);
  }

else if (theGui == null) {
FadeGuiOut_NoBlock(gIconbar, 100, -20, 0);
  }

}



With out the SetCursorMode(eModePointer); it wont turn to a pointer when over the gui.

I also had to turn the Iconbar's visibility to normal in the gui controls. ( Just giving as much info as i can  ;))


(BTW... I'm using the fading things module by Lazarus & Ashen)
Title: Re: Pointer over gui
Post by: Khris on Thu 28/02/2008 04:52:19
int old_mode;

function repeatedly_execute() {
  GUI *theGui = GUI.GetAtScreenXY(mouse.x, mouse.y);
  if (theGui == gStatusline) {
    FadeGuiIn_NoBlock(gIconbar, 0, -20, 0);
    old_mode = mouse.Mode;
    mouse.Mode = eModePointer;
  }

  else if (gStatusline.Transparency == 0) {     // avoid running the block every loop
    FadeGuiOut_NoBlock(gIconbar, 100, -20, 0);
    mouse.Mode = old_mode;
  }
}


That should do the trick.
Title: Re: Pointer over gui
Post by: The Suitor on Thu 28/02/2008 06:08:44
Almost worked, I had to add the block you were talking about back because it would just flicker, even after i set the gStatusline to gIconbar (i'm sure that was just misread or somthing  :)).

aslo had these problems:

1. when I select a cursor mode from the icon bar, and move the mouse back off, it goes to the one I had before I "mouseovered" it.

2. It wont let me shift through the cursor modes after moving my mouse back off of the iconbar.
Title: Re: Pointer over gui
Post by: Khris on Thu 28/02/2008 13:01:17
Oh, looking at my code again, I indeed confused gStatusline and gIconbar. Ignore my post, it was late :)