Ffix for MouseXSpeed/MouseYSpeed BUG in B+ 1.3x

BlitzPlus Forums/BlitzPlus Programming/Ffix for MouseXSpeed/MouseYSpeed BUG in B+ 1.3x

Abazek(Posted 2004) [#1]
The fix for the MouseXSpeed/MouseYSpeed bug in BlitzPlus 1.36 and 1.37 (see my prior post, "Did update change MouseXSpeed and MouseYSpeed?", for details) is to add a call to MouseXSpeed and MouseYSpeed IMMEDIATELY after your call to MoveMouse to return the mouse to the center of the screen.


The following code illustrates this:


Graphics 640,480
SetBuffer BackBuffer()
x=320
y=240

; infinite mouse movement

Repeat
Cls
xs=MouseXSpeed() ; see how far the mouse has been moved
ys=MouseYSpeed()
MoveMouse 320,240 ;put the mouse back in the middle of the screen
;;
;; Extra call to MouseXSpeed/MouseYSpeed to overcome BUG in BlitzPlus 1.36 and 1.37:
;;
tmp=MouseXSpeed()
tmp=MouseYSpeed()

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

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

Text x,y,"X",True,True

Flip
Until KeyHit(1)
End


(this code came from the Blitz3D Help File, and works fine in Blitz3D. It also ran fine in BlitzPlus 1.11, but after I updated to BlitzPlus 1.36 (and later 1.37), you could no longer move the "X" with the mouse!! Adding the extra call to MouseXSpeed and MouseYSpeed (after MouseMove) fixes the problem. Refer to my previous post for more details).