Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can _MOUSEMOVEMENTX & Y be used for something like this?
#2
I think a lot of folks misunderstand what MouseMovementX and MouseMovementY are for.  

First thing to note:  They're NOT for tracking your mouse's absolute position on the screen.  There's _MouseX and _MouseY for that.

So what are they for??

Let's move our thinking from QB64PE out to just playing some game.  Now, in this game, you're in a spaceship flying through outer space.  To control your ship, it's set up to use a simple scroll ball as the navigation tool.

Scroll that ball right, and the ship turns right.
Scroll that ball left, and the ship turns left.
Scroll that ball up, and the ship flys down.  (The arse end goes up, the nose goes down.)
Scroll that ball down, and the ship flys up.  (The arse end goes down, the nose goes up.)

Now, tracking mouse position in this situation is just foolish.  You scroll right.... right... right.... right.... Hit the edge of the screen with the mouse, and BOOM!!  Your ship can no longer rotate to the right in outer space!!

See the problem with trying to use _MouseX in this situation?   You can turn right and go around in circles till the end of time.  Your mouse cursor, however, is going to stop at the edge of your screen.

So, how to track this "ball rotated right" event??    _MouseMovementX.    Even if the mouse is at the right edge of the screen, you can scroll that mouseball on your desk endlessly to the right.  It won't move the mouse pointer -- it's already at the limit -- but _MouseMovementX will record that rotation and report it to you.

MouseMovementX  simply tells you if your mouseball has rotated left or right.
MouseMovementY tells you if that mouseball has rotated up or down.

It has nothing to do with screen coordinates.  Just mouse wheel scrolling itself.
Reply


Messages In This Thread
RE: Can _MOUSEMOVEMENTX & Y be used for something like this? - by SMcNeill - 10-15-2023, 11:28 PM



Users browsing this thread: 1 Guest(s)