dxMouseYSpeed%()

Parameters

None.

Description

Often you'd like to find the difference between where the mouse WAS to where it is NOW. You can use this command and dxMouseYSpeed() in pairs to find out the changes in the mouse location between calls.

You really have to use these commands TWICE to get anything out of them. Each call you make returns the difference in location since the LAST time you called it.

In this example it's called every loop and therefore allows you to have infinite mouse movement without the screen size restrictions.

See also: dxMouseXSpeed.

Example

Graphics 640,480

dxSetBuffer dxBackBuffer()

x=320
y=240

; infinite mouse movement

Repeat
dxCls

xs=dxMouseXSpeed() ; see how far the mouse has been moved
ys=dxMouseYSpeed()
dxMoveMouse 320,240 ;put the mouse back in the middle of the screen

x=x+xs ;adjust mouse co-ords
y=y+ys

If x>dxGraphicsWidth()-1 Then x=x-dxGraphicsWidth() ;wrap screen
If x<0 Then x=x+dxGraphicsWidth()
If y<0 Then y=y+dxGraphicsHeight()
If y>dxGraphicsHeight()-1 Then y=y-dxGraphicsHeight()

dxText x,y,"X",True,True

dxFlip

Until dxKeyHit(1)

End

Index