1
2
In response to Flysbad
|
|
Here's my current method for tracking the mouse. The mouse position tracking code is much improved, if you compare the new SetMouseScreenLoc() with the old MousePosition().
#ifndef TILE_WIDTH Aiming If you want to get a vector from your character to the mouse (e.g. aiming), there are certain complications to deal with, but it usually comes down to this kind of subtraction: client For example, if your camera doesn't move, you just subtract your position from the mouse's position, because the mouse's position is effectively a position on the map: client.UpdateMouseDelta(Cx(), Cy()) If your camera is always centered on your character, then you have to keep track of the camera's size: var view_width = ... // in pixels And as an added bonus, I'll mention that you can calculate the magnitude and angle of a vector, such as that mouse delta, using these handy dandy math functions: proc client.UpdateMouseDelta(FromX, FromY) edit: 8 September 2015 You can also detect the movement of the mouse per frame. client |
1
2
Similarly, I don't need the mouse events to be changed in order for them to work how I want them to, because I have this super short and simple snippet that handles everything for me. I don't have to look it at all if all I need to use are the mouse_x and mouse_y variables, because it just works.