Author Topic: v10.057 mouse bug?  (Read 2898 times)

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
v10.057 mouse bug?
« on: 2011-Aug-07 »
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
« Last Edit: 2011-Aug-09 by Moru »

MrTAToad

  • Guest
Re: v10.057 mouse bug?
« Reply #1 on: 2011-Aug-07 »
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.


Offline Moebius

  • Dr. Type
  • ****
  • Posts: 315
    • View Profile
Re: v10.057 mouse bug?
« Reply #2 on: 2011-Aug-08 »
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

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
Re: v10.057 mouse bug?
« Reply #3 on: 2011-Aug-08 »
I definately don't think it should work like that.

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
Re: v10.057 mouse bug?
« Reply #4 on: 2011-Aug-09 »
Damn, I'd forgotten there was a bug section. Excuse the double post people!

Offline Moebius

  • Dr. Type
  • ****
  • Posts: 315
    • View Profile
Re: v10.057 mouse bug?
« Reply #5 on: 2011-Aug-12 »
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

  • Guest
Re: v10.057 mouse bug?
« Reply #6 on: 2011-Aug-12 »
MouseAxis needs to be read before MOUSESTATE (which as you said resets the values).  Swap the two lines around and its fine.

Offline Moebius

  • Dr. Type
  • ****
  • Posts: 315
    • View Profile
Re: v10.057 mouse bug?
« Reply #7 on: 2011-Aug-13 »
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

  • Guest
Re: v10.057 mouse bug?
« Reply #8 on: 2011-Aug-13 »
Indeed - could be useful!