Skip to content

Instantly share code, notes, and snippets.

@YellowAfterlife
Created September 22, 2014 14:23
Show Gist options
  • Save YellowAfterlife/2e821339a333dab772df to your computer and use it in GitHub Desktop.
Save YellowAfterlife/2e821339a333dab772df to your computer and use it in GitHub Desktop.
/// Create:
globalvar mouse_x0, mouse_y0, mouse_x1, mouse_y1, mouse_dx, mouse_dy;
mouse_x1 = mouse_x
mouse_y1 = mouse_y
mouse_dx = 0
mouse_dy = 0
/// Step:
mouse_x0 = mouse_x1; mouse_x1 = mouse_x
mouse_y0 = mouse_y1; mouse_y1 = mouse_y
mouse_dx = (mouse_x1 - mouse_x0)
mouse_dy = (mouse_y1 - mouse_y0)
/// Example of use:
if (mouse_dx != 0) || (mouse_dy != 0) {
// mouse moved.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment