Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: s0cket on Mon 31/05/2010 16:13:01

Title: How to check if mouse is moving or not? (SOLVED)
Post by: s0cket on Mon 31/05/2010 16:13:01
This will probably get me banned but I'm really in a hurry and need an answer  :-\ ..I want to make a..kind of a dynamic GUI.When mouse is not moving for a certain time,all GUI hides and when I move it again GUI shows up.When I discovered that there is no such property as "mouse.ismoving" i tried to do some stuff myself with counters,lot's of counters-and I got lost...Thanks in advance  :-\


VVVVVVVV will try when I get home,kthanks ;)
Title: Re: How to check if mouse is moving or not?
Post by: Gilbert on Mon 31/05/2010 16:25:03
Do something like this (quick idea):

int mousestopped, lastmx, lastmy;


In repeatedly_execute():

if (!gBlah.Visible) {
  if (mouse.x!=lastmx||mouse.y!=lastmy) { //mouse moved
    lastmx=mouse.x;  lastmy=mouse.y;  mousestopped=0;
    gBlah.Visible=true;
} else {
  if (mouse.x==lastmx&&mouse.y==lastmy) mousestopped++;
  else mousestopped=0;
  if (mousestopped>somevalue) gBlah.Visible=false;
  lastmx=mouse.x;  lastmy=mouse.y;
}

 


Title: Re: How to check if mouse is moving or not?
Post by: s0cket on Tue 01/06/2010 19:14:17
yup.it worked.With a bit of addition,but it did.Thanks a lot :)