playMaker

Author Topic: Check if mouse is moving  (Read 3425 times)

VascBogdan

  • Full Member
  • ***
  • Posts: 118
Check if mouse is moving
« on: April 18, 2015, 02:12:54 AM »
How can I check if the mouse is moving ? I need it for a rub, first I check if mouse is holded down then if it is moving. Is there a way ?

TheBadFeeling

  • Junior Playmaker
  • **
  • Posts: 66
Re: Check if mouse is moving
« Reply #1 on: April 18, 2015, 03:30:03 AM »
How about getting the mouseX and Y when you register the mouse button down and storing them in variables -- and then comparing them to new mouseX and Y coordinates every frame until the mouse is released?

If the differences are larger or smaller than any tolerance you specify, then the "rub" happened.

/Bad
The Force is with you, young Playmaker – but you are not a C# senpai yet.

VascBogdan

  • Full Member
  • ***
  • Posts: 118
Re: Check if mouse is moving
« Reply #2 on: April 18, 2015, 03:37:58 AM »
Sounds a bit complicated but I am going to try it now. I will reply with the result.

VascBogdan

  • Full Member
  • ***
  • Posts: 118
Re: Check if mouse is moving
« Reply #3 on: April 18, 2015, 03:48:42 AM »
I actually made it work :) Thank you very much .

TheBadFeeling

  • Junior Playmaker
  • **
  • Posts: 66
Re: Check if mouse is moving
« Reply #4 on: April 18, 2015, 08:18:05 AM »
You're very welcome!  8)

/Bad
The Force is with you, young Playmaker – but you are not a C# senpai yet.