How to check if mouse is moving or not? (SOLVED)

Started by s0cket, Mon 31/05/2010 16:13:01

Previous topic - Next topic

s0cket

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 ;)

Gilbert

Do something like this (quick idea):
Code: ags

int mousestopped, lastmx, lastmy;


In repeatedly_execute():
Code: ags

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;
}

 



s0cket

yup.it worked.With a bit of addition,but it did.Thanks a lot :)

SMF spam blocked by CleanTalk