v10.057 mouse bug?

Previous topic - Next topic

FutureCow

I've just upgraded to v10 from v8 and I'm sure mouse function has either changed or has a bug (I'm going with the latter). The mouse now seems to be able to move past the edges of the screen/window without mousestate reflecting that.

It's a bit hard to explain clearly, but if you run the following code (on a windows XP box, not sure about other platforms), and move the mouse from coordinate 0,0 for example, 1000 pixels up, mousestate shows always my=0
But to move to coordinate 0,1 you now need to move 1001 pixels down, whereas before I'm sure you'd only have to move 1 pixel down.
The same goes for all the borders.

Example code :
Code (glbasic) Select
GLOBAL mx,my,mb1,mb2

WHILE TRUE
MOUSESTATE mx,my,mb1,mb2
PRINT mx,0,0
PRINT my,50,0
DRAWRECT mx,my,2,2,RGB(255,255,255)
SHOWSCREEN
WEND

MrTAToad

The mouse state shouldn't reflect movement outside the window as technically the program will have lost focus (or is about too), although currently the coordinates are updated depending on mouse movement, which I dont think should happen, although you could say it should until focus is lost.

It may be better though to be able to limit the system pointer to the windows coordinates.


Moebius

The problem is with "SYSTEMPOINTER FALSE".  Despite giving from 0 to width and 0 to height as the moose coords, it seems to let the virtual mouse move 'off' the screen...
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

FutureCow

I definately don't think it should work like that.

FutureCow

Damn, I'd forgotten there was a bug section. Excuse the double post people!

Moebius

This is actually very weird... try this code to see what I mean:
Code (glbasic) Select
LOCAL x%, y%, b1%, b2%

// With "system pointer" on or off the results are the same...
//SYSTEMPOINTER TRUE
SYSTEMPOINTER FALSE

WHILE TRUE
MOUSESTATE x, y, b1, b2
PRINT x + ", " + y, 10, 10
PRINT MOUSEAXIS(0) + ", " + MOUSEAXIS(1), 10, 40
SHOWSCREEN
WEND


Regardless of whether the system pointer is enabled:
- MOUSESTATE gives coordinates from (0, 0) to (width, height).
- MOUSEAXIS gives the amount off the screen the cursor is, rather than the velocity (which should be zero as MOUSESTATE seems to reset the values)
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

MrTAToad

MouseAxis needs to be read before MOUSESTATE (which as you said resets the values).  Swap the two lines around and its fine.

Moebius

I know that :P it's just interesting that with them the other way around you get the amount by which the cursor is off the screen...
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

MrTAToad

Indeed - could be useful!