; MouseYSpeed Example ; ------------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; Hide the Windows pointer - we steer with movement deltas instead HidePointer aim_x#=320 aim_y#=240 While Not KeyDown(1) Cls ; MouseYSpeed returns how far the mouse moved vertically since ; the last call (MouseXSpeed is its horizontal partner). ys=MouseYSpeed() xs=MouseXSpeed() ; FPS-style aiming: re-centre the pointer every frame and steer ; the crosshair with the deltas - the pointer itself can never ; get stuck at the edge of the screen. MoveMouse 320,240 aim_x=aim_x+xs aim_y=aim_y+ys ; Wrap the crosshair at the window edges If aim_x<0 Then aim_x=aim_x+640 If aim_x>639 Then aim_x=aim_x-640 If aim_y<0 Then aim_y=aim_y+480 If aim_y>479 Then aim_y=aim_y-480 ; Crosshair Color 255,255,0 Oval aim_x-10,aim_y-10,20,20,False Line aim_x-14,aim_y,aim_x+14,aim_y Line aim_x,aim_y-14,aim_x,aim_y+14 Color 255,255,255 Text 0,0,"Move the mouse to drift the crosshair (no screen edges) Esc: exit" Text 0,20,"MouseYSpeed() this frame: "+ys Text 0,40,"MouseXSpeed() this frame: "+xs Flip Wend End