MouseMoveX
Xdistance = MouseMoveX()
 
Parameters: NONE
Returns:

    Xdistance = The move distance along the X axis of the mouse pointer
 

      The MouseMoveX() function will return the change in X position of the mouse pointer from the last call of the function.



FACTS:


      * You shouldn't call this function more than once per update.

      The reason for this, is that each time you call a MouseMove function, it calculates the distance moved from where the mouse currently is and where it was the last time you asked.

      So requesting the move distance various times without allowing ample time between calls, will mean that your trying to read mouse faster than what the user can move it.




Mini Tutorial:


      This example simply should how to display the change in the mouse position.

  
  
; Tell PB to limit this programs speed to 10 frames per second
  SetFPS 10
  
; Start an infinite D0-LOOp
  Do
     
   ; Clear the screen to black RGB(0,0,0)
     Cls RGB(0,0,0)
     
   ; Read How far (in pixels) the mouse has moved
   ; since the last update.
     MovedDistanceX=MouseMoveX()
     MovedDistanceY=MouseMoveY()
     
   ; Read How Far the Mouse Wheel Has moved
   ; since the last update
     MovedDistanceZ=MouseMoveZ()
     
     
   ; Display the change in the Mouse X & Y position
     Print MovedDistanceX
     Print MovedDistanceY
     Print MovedDistanceZ
     
     
   ; Display the screen
     Sync
     
   ; Loop back to the DO statement
  Loop
  
  




 
Related Info: MouseButton | MouseMoveY | MouseMoveZ | MouseX | MouseY | MouseZ | SetMouse | SetMouseX | SetMouseY :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com