News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Draw straght line.

Started by towlerg, Apr 08, 2022, 11:59 AM

Previous topic - Next topic

towlerg

I've been looking for a utility the will force mouse moves to either horizontal and vertical. Shouldn't be too tough, each time you get a mouse move you reset either x or y to it's start value. A nice addon to that would be to draw a straight line at an arbitrary angle. Anybody know of such a beast?


shantanu@india

In drawing softwares like AutoCAD just press F8 for orthogonal mouse movement.
Are you talking about the entire screen of Windows?
Regards
Shantanu

towlerg

I was hoping to find a utiliy for use with several applications.

keytapper

In Linux there's the way to move the mouse by the keyboard input. Maybe some good fellow has ported this feature on Windows.

towlerg

Actually I think it already exists in Win but rely's on keyboard number pad and it's kindda clunky anyway.

Parmin

Mouse data packets have distinct location feedback for each axis of movement.
By parsing the packet and changing the singular axis data to 0 between the mouse and the computer, you can lock the input of a particular axis and in essence force it to draw a straight line either in the horizontal or vertical direction.

Below is the "older" style mouse data packet.
they came in 3 bytes of data

        D7      D6      D5      D4      D3      D2      D1      D0
 
1.      X       1       LB      RB      Y7      Y6      X7      X6
2.      X       0       X5      X4      X3      X2      X1      X0     
3.      X       0       Y5      Y4      Y3      Y2      Y1      Y0

LB is the state of the left button (1 means pressed down)
RB is the state of the right button (1 means pressed down)
X7-X0 movement in X direction since last packet (signed byte)
Y7-Y0 movement in Y direction since last packet (signed byte)
     

towlerg

Thanks Parmin, I think I know how to do it (apart from the line between to points) I was kindda hoping someone had already done it.