Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom MouseMovement Example
#10
One of our Mac users could test this out, if they'd be so kind, and tell us how it performs for them:

Code: (Select All)
DIM SHARED AS LONG MouseMoveX, MouseMoveY, MouseX, MouseY

SCREEN _NEWIMAGE(800, 600, 32)
_SCREENMOVE _MIDDLE

Pointer = _NEWIMAGE(16, 8, 32)
COLOR -1, 0
_PRINTSTRING (0, 0), CHR$(24), Pointer



DO
    CLS
    Mouse
    TMMX = TMMX + MouseMoveX: TMMY = TMMY + MouseMoveY
    PRINT "Mouse x:"; MouseX
    PRINT "Mouse y:"; MouseY
    PRINT "MouseMoveX:"; MouseMoveX
    PRINT "MouseMoveY:"; MouseMoveY
    PRINT "Total MouseMoveX:"; TMMX
    PRINT "TOtal MouseMoveY:"; TMMY
    _LIMIT 30
    _PUTIMAGE (MouseX - 8, MouseY - 8)-STEP(32, 32), Pointer
    _DISPLAY
LOOP UNTIL _MOUSEBUTTON(2)
SYSTEM



SUB Mouse
    STATIC AS LONG CurrentX, CurrentY
    STATIC AS INTEGER Init, counter
    counter = (counter + 1) MOD 10
    WHILE _MOUSEINPUT: WEND 'catch up to the current mouse's position so we sync properly
    X = _MOUSEX: Y = _MOUSEY
    MouseMoveX = 0: MouseMoveY = 0

    IF Init = 0 THEN
        Init = -1
        CurrentX = _WIDTH \ 2: CurrentY = _HEIGHT \ 2
        _MOUSEHIDE
        _MOUSEMOVE _WIDTH \ 2, _HEIGHT \ 2
    ELSE
        IF X <> _WIDTH \ 2 OR Y <> _HEIGHT \ 2 THEN
            MouseMoveX = X - _WIDTH \ 2: MouseMoveY = Y - _HEIGHT \ 2
            CurrentX = CurrentX + MouseMoveX
            CurrentY = CurrentY + MouseMoveY
            IF CurrentX < 0 THEN CurrentX = 0
            IF CurrentX >= _WIDTH THEN CurrentX = _WIDTH - 1
            IF CurrentY < 0 THEN CurrentY = 0
            IF CurrentY >= _HEIGHT THEN CurrentY = _HEIGHT - 1
        END IF
    END IF
    IF counter = 0 THEN _MOUSEMOVE _WIDTH \ 2, _HEIGHT \ 2
    MouseX = CurrentX: MouseY = CurrentY
END SUB

This seems hyper-sensitive to me on Windows for some reason, but the idea here is that this _MouseMove statement *only* occcurs on every 10th pass.  (1/3rd of a second, while the _mousemove blocks input for 1/4th of a second.)  I'm thinking that with a longer delay than the lock, Mac should still be able to read mouse events and report them for us.  I'm not entriely certain how laggy/skippy it might be, and I wouldn't want to try and implement any actual program on Mac that uses _MouseMove right now.  Have a program move the mouse and lock out keyboard and mouse input??   No thanks!  What the heck type of glitch is that for glut??  And if it's not a glitch, then what the heck is its intended purpose?

This should just give some testable example of this glitch in action.  Lower the mod on the counter to decrease delay between mousemove calls (     counter = (counter + 1) MOD 10); increase it to increase the delay between mousemove calls.  Feel free to change it and see how it performs with various alterations to how fast mousemove is called.

I don't have a Mac for testing, so I'm kind of curious what type of results this will actually generate for us.  My mind is telling me what I'd *expect* to happen.  Now, whether or not that's actually happens, remains up to the OS to decide I guess.  LOL!  In the end, this still might not make any change to things with Mac, though I'd *think* that it should.  Wink
Reply


Messages In This Thread
Custom MouseMovement Example - by SMcNeill - 02-25-2024, 05:37 PM
RE: Custom MouseMovement Example - by NakedApe - 02-26-2024, 01:18 AM
RE: Custom MouseMovement Example - by SMcNeill - 02-26-2024, 03:29 AM
RE: Custom MouseMovement Example - by SMcNeill - 02-26-2024, 03:45 AM
RE: Custom MouseMovement Example - by NakedApe - 02-26-2024, 06:00 AM
RE: Custom MouseMovement Example - by NakedApe - 02-26-2024, 05:35 PM
RE: Custom MouseMovement Example - by SMcNeill - 02-27-2024, 07:15 AM
RE: Custom MouseMovement Example - by GareBear - 02-27-2024, 01:06 PM
RE: Custom MouseMovement Example - by SMcNeill - 02-27-2024, 01:28 PM
RE: Custom MouseMovement Example - by SMcNeill - 02-27-2024, 01:47 PM
RE: Custom MouseMovement Example - by NakedApe - 02-27-2024, 04:59 PM
RE: Custom MouseMovement Example - by SMcNeill - 02-27-2024, 05:06 PM
RE: Custom MouseMovement Example - by MasterGy - 02-27-2024, 05:18 PM
RE: Custom MouseMovement Example - by NakedApe - 02-27-2024, 07:17 PM
RE: Custom MouseMovement Example - by MasterGy - 02-27-2024, 08:53 PM
RE: Custom MouseMovement Example - by SMcNeill - 02-27-2024, 08:58 PM
RE: Custom MouseMovement Example - by MasterGy - 02-27-2024, 09:07 PM
RE: Custom MouseMovement Example - by NakedApe - 02-28-2024, 02:40 AM



Users browsing this thread: 2 Guest(s)