Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom MouseMovement Example
#11
This works! It's jerky and not proportional, but it reports the x and y positions accurately. Setting the MOD below 9 kills the mouse movement for me. Setting the LIMIT to 20 makes the pointer behave pretty normally. Progress!
Reply
#12
Which just goes to showcase the issue.  Big Grin

Now we just need a dev to fix it.  Wink
Reply
#13
well! I didn't even know there was a '_mousemove' command. Smile in the games, when you have to rotate, I couldn't use the '_mousex,_mousey' commands, because if it goes off the screen, then there is no detection afterwards. _mousemovement is good, you just had to add a 'mouse sensitivity' multiplier, because the speed of the movement will be different on every computer. But since I know the mousemove command, this can be avoided.
Reply
#14
Cool, I thought I was stuck with only 5 rotations (desktop width of 1920 / 360 = 5.3) for my spinning ship, but with MasterGy's multiplier I can get many more rotations before hitting the end points. The mouse is more sensitive, but not by much. Thanks, MasterGy! Why didn't I think of that? EDIT: And then by reducing the mouse sensitivity with the OS this works much better for me...

Code: (Select All)
DO WHILE _MOUSEINPUT '  mouse controls
    IF _MOUSEMOVEMENTX THEN
        cX = cX - _MOUSEMOVEMENTX '
        ship.vector = ship.vector + cX * 1.6 '  << MasterGy concept, mouse movement multiplier
        IF ship.vector >= -1 THEN ship.vector = -1080 ' if vector goes positive avoid lockup
    END IF
    zX = zX + _MOUSEMOVEMENTX '   for the mouse range gauge
LOOP

gaugeVal = INT((zX / DTW) * _WIDTH) + 10 '   relative/corrected x value for mousemovement range
Reply
#15
this is still not the most accurate solution. _mousemovement is proportional to windows mouse sensitivity. Moreover, the value of _limit can also influence it.
Let's make the real displacement independent of any FPS rate (_LIMIT). And be independent of Windows mouse sensitivity!

Change the value of _LIMIT ! the displacement will be unchanged. The speed of the circle will remain the same even if you turn off the mouse sensitivity in Windows.

Code: (Select All)
'windows mouse sensitivity and mouse positioning depending on _LIMIT value

limit = 100
mouse_speed = 1500


mon = _NewImage(800, 800 / _DesktopWidth * _DesktopHeight, 32)
Screen mon: _MouseHide: _FullScreen


Do: _Limit limit


    mx = 0: my = 0:

    While _MouseInput: mx = mx + _MouseMovementX: my = my + _MouseMovementY: Wend

    od = Sqr(mx * mx + my * my) 'original displacement

    ratio = 1 / od / limit * mouse_speed 'the amount of real displacement, which will only result from the _LIMIT value and the specified mouse speed

    fx = mx * ratio
    fy = my * ratio

    'circle position
    If Sgn(od) Then
        cx = cx + fx
        cy = cy + fy
    End If

    If cx < 0 Then cx = 0
    If cx > _Width - 1 Then cx = _Width - 1

    If cy < 0 Then cy = 0
    If cy > _Height - 1 Then cy = _Height - 1

    Circle (cx, cy), 40

    _Display: Cls


Loop


Reply
#16
Just keep in mind guys:  What you're doing right now playing with limits and all is *just a band-aid* to patch the glitch.  When we fix it so that _MouseMove doesn't have that 250ms lockout, it might change whatever you're working on completely.

My personal advice?

1) Enjoy what's working for you now.

BUT

2) Keep in mind that we'll probably end up doing a patch of some sort for things in the future and that might mean you'll need to tweak your code to account for the new behavior.  Wink
Reply
#17
it will be very good if the machine does not freeze when using _mousemove. But the change in _mousexy will be proportional to the windows mouse sensitivity. It doesn't solve that. My idea is that if we want to specify a completely universal speed, which will move the same amount even if the _limit value is changed and even if the mouse sensitivity of the operating system is different. A standard speed that is beneficial when making games.
Reply
#18
That is very clever, MasterGy. I'll try using that for sure. Thanks!
Reply




Users browsing this thread: 2 Guest(s)