09-09-2023, 01:36 PM
Hi Terry,
I have thought a snippet all in QB64 code... but it seems that I have fallen in an issue about _MOUSEMOVEMENTX/Y
These functions seem to loose some data while they are running.
Here the snippet in QB64 that looses data during the run!
the issue is clear running the snippet
moving to left and to right the mouse cursor we calculate its position on the global screen... but after some attempts you can see that the position is quite different at any attempt.
This can be possible only if _MOUSEMOVEMENTX/Y check position of mouse each tick bigger than that used by _mouseinput.
what do you think about this?
I have thought a snippet all in QB64 code... but it seems that I have fallen in an issue about _MOUSEMOVEMENTX/Y
These functions seem to loose some data while they are running.
Here the snippet in QB64 that looses data during the run!
Code: (Select All)
Rem the goal: we want to detect if mouse is out or in window's area
Rem the idea is to evaluate the position of the mouse at starting of the run of the application
Rem if QB64 does not set mouse in an that area at run time, we can set position of mouse with related functions
Option _Explicit
Dim S As Long
Dim As Integer W, H, Xms, Yms, XM, YM, Wrange, Hrange
W = 800: H = 600
S = _NewImage(W, H, 32)
_MouseMove 1, 1
Wrange = 1 'W - 1
Hrange = 1 'H - 1
Do
Xms = _MouseInput
Xms = _MouseX
Yms = _MouseY
XM = _MouseMovementX
YM = _MouseMovementY
Wrange = Wrange + XM ' -XM
Hrange = Hrange + YM ' -YM
Print Xms; " "; Yms, XM; " "; YM, Wrange; " "; Hrange
' _Limit 200 ' _delay 0.001
Loop Until InKey$ <> ""
End
moving to left and to right the mouse cursor we calculate its position on the global screen... but after some attempts you can see that the position is quite different at any attempt.
This can be possible only if _MOUSEMOVEMENTX/Y check position of mouse each tick bigger than that used by _mouseinput.
what do you think about this?