Skip to content

Commit

Permalink
v1.1 (#3)
Browse files Browse the repository at this point in the history
* Update TPMouse.au3

* Update TPMouse.au3

* Update README.md

* Update README.md

* Update README.md

* Update TPMouse.au3

* Update README.md
  • Loading branch information
user726687 authored Oct 21, 2022
1 parent 19ac9d5 commit 7f0dee4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ Inspired by [rvaiya/warpd](https://github.com/rvaiya/warpd).
## Inertia Mode
![image](https://user-images.githubusercontent.com/98432183/196675010-b380b898-6e97-4aa9-baf4-c35e0fb185fe.png)

1. Press `Alt` `Shift` `C` to activate inertia mode. You'll see your main cursor switched to a crosshair.
2. Use `I`/`J`/`K`/`L` to move the cursor, hold `Shift` to apply brakes for slower/more precise movement, release `Shift` to reset velocity. Hold `CapsLk` to scroll vertically/horizontally.
1. Press `LShift` `RShift` `C` to activate inertia mode. You'll see your main cursor switched to a crosshair.
2. Use `I`/`J`/`K`/`L` to move the cursor. Hold `Shift` to brake for more precise movement, hold `CapsLk` to scroll vertically/horizontally.
3. Press `F`/`E`/`R` to left/right/middle click at the cursor position.
4. Press `Esc` to quit mode.


## Grid Mode
![image](https://user-images.githubusercontent.com/98432183/196675614-28eff1a1-c074-48a5-9ebe-ae8bf969e853.png)

1. Press `Alt` `Shift` `G` to activate overlay. You'll see your main cursor switched to a crosshair, and a thin grey border surrounding your screen.
1. Press `LShift` `RShift` `G` to activate overlay. You'll see your main cursor switched to a crosshair, and a thin grey border surrounding your screen.
2. Press `I`/`J`/`K`/`L` to bisect the warp region and move your cursor to its center.
3. Press `F`/`E`/`R` to left/right/middle click at the cursor position.
4. Press `Esc` to quit mode.
Expand All @@ -25,9 +25,12 @@ Inspired by [rvaiya/warpd](https://github.com/rvaiya/warpd).

### Inertia Mode

https://user-images.githubusercontent.com/98432183/196684128-eadbc7df-fec6-48e6-a283-36c4c8c0cde8.mp4
https://user-images.githubusercontent.com/98432183/197256799-fe5e3e8d-9a2e-4c41-bd52-31b4a287499c.mp4



### Grid Mode

https://user-images.githubusercontent.com/98432183/196685474-30aa53ad-60a1-45b8-8d82-21a3b0aa0819.mp4

https://user-images.githubusercontent.com/98432183/197257714-67d517bf-c344-434c-a5cb-0c25db4bb2d4.mp4

29 changes: 14 additions & 15 deletions TPMouse.au3
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ _Singleton('TPMouse',0)
Opt('GUICloseOnESC',False)
Opt('TrayMenuMode',3)
Opt('TrayOnEventMode',1)
TrayItemSetOnEvent(TrayCreateItem('Exit'),Quit)
TrayItemSetOnEvent(TrayCreateItem('Quit TPMouse'),Quit)
TraySetIcon('%windir%\Cursors\aero_link_xl.cur')
TraySetToolTip('TPMouse - Inactive')
Global $user32 = DllOpen('user32.dll')
Expand Down Expand Up @@ -69,7 +69,7 @@ Func ProcessKeypress($struct)
If SingletonInertia() Then SingletonInertia('deactivate')
SingletonOverlay('activate')
DllCall($user32, "bool", "SetSystemCursor", "handle", CopyIcon($hCursors[2]), "dword", 32512)
TraySetIcon("%windir%\Cursors\aero_move_xl.cur")
TraySetIcon("%windir%\Cursors\aero_pin_xl.cur")
TraySetToolTip('TPMouse - Grid')
EndIf
EndIf
Expand All @@ -79,7 +79,7 @@ Func ProcessKeypress($struct)
If SingletonOverlay() Then SingletonOverlay('deactivate')
SingletonInertia('activate')
DllCall($user32, "bool", "SetSystemCursor", "handle", CopyIcon($hCursors[1]), "dword", 32512)
TraySetIcon("%windir%\Cursors\aero_pen_xl.cur")
TraySetIcon("%windir%\Cursors\aero_person_xl.cur")
TraySetToolTip('TPMouse - Inertia')
EndIf
EndIf
Expand All @@ -98,10 +98,9 @@ Func ProcessKeypress($struct)
Case 0x52 ; R
SingletonMoupress('mb3',Not BitAnd(0x0001,$struct.Flags))
Case 0x10 ; shift
If BitAnd(0x0001,$struct.Flags) Then SingletonInertia('clip',15)
If BitAnd(1,$struct.Flags) Then SingletonInertia('clip',15)
Case 0x14 ; caps
SingletonInertia('lock',Not BitAnd(0x0001,$struct.Flags))
If $struct.MakeCode = 0x36 Then SingletonInertia('lock',Not BitAnd(0x0001,$struct.Flags))
EndSwitch
EndFunc

Expand Down Expand Up @@ -295,13 +294,13 @@ Func SingletonKeyState($vKey=Null, $make=Null, $flag=Null)
Local $after = Not BitAnd(1,$flag)
Switch $vKey
Case 0x10 ; shift
If $change Then $self[($make=0x36?0xA1:0xA0)]=$after ; (vkey,e0,mk) of lshift is (0xA0,0x00,0x2A), of rshift is (0xA1,0x00,0x36)
If $change Then $self[($make=0x36?0xA1:0xA0)]=$after ; (vkey,e0,mk) of lshift is (0xA0,0x00,0x2A), of rshift is (0xA1,0x00,0x36)
Return ( $self[0xA0] or $self[0xA1] )
Case 0x11 ; ctrl
If $change Then $self[(BitAnd(2,$flag)?0xA3:0xA2)]=$after ; (vkey,e0,mk) of lctrl is (0xA2,0x00,0x1D), of rctrl is (0xA3,0xE0,0x1D)
If $change Then $self[(BitAnd(2,$flag)?0xA3:0xA2)]=$after ; (vkey,e0,mk) of lctrl is (0xA2,0x00,0x1D), of rctrl is (0xA3,0xE0,0x1D)
Return ( $self[0xA2] or $self[0xA3] )
Case 0x12 ; alt
If $change Then $self[(BitAnd(2,$flag)?0xA5:0xA4)]=$after ; (vkey,e0,mk) of lalt is (0xA4,0x00,0x38), of ralt is (0xA5,0xE0,0x38)
If $change Then $self[(BitAnd(2,$flag)?0xA5:0xA4)]=$after ; (vkey,e0,mk) of lalt is (0xA4,0x00,0x38), of ralt is (0xA5,0xE0,0x38)
Return ( $self[0xA4] or $self[0xA5] )
Case Else
If $vKey Then
Expand Down Expand Up @@ -509,37 +508,37 @@ Func DisableHotKeys()
HotKeySet('+r')
EndFunc
func i()
Local $struct = DllStructCreate('ushort Flags;ushort VKey')
Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;')
$struct.Vkey = 0x49
ProcessKeypress($struct)
endfunc
func j()
Local $struct = DllStructCreate('ushort Flags;ushort VKey')
Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;')
$struct.Vkey = 0x4A
ProcessKeypress($struct)
endfunc
func k()
Local $struct = DllStructCreate('ushort Flags;ushort VKey')
Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;')
$struct.Vkey = 0x4B
ProcessKeypress($struct)
endfunc
func l()
Local $struct = DllStructCreate('ushort Flags;ushort VKey')
Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;')
$struct.Vkey = 0x4C
ProcessKeypress($struct)
endfunc
func f()
Local $struct = DllStructCreate('ushort Flags;ushort VKey')
Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;')
$struct.Vkey = 0x46
ProcessKeypress($struct)
endfunc
func e()
Local $struct = DllStructCreate('ushort Flags;ushort VKey')
Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;')
$struct.Vkey = 0x45
ProcessKeypress($struct)
endfunc
func r()
Local $struct = DllStructCreate('ushort Flags;ushort VKey')
Local $struct = DllStructCreate('ushort MakeCode;ushort Flags;ushort VKey;')
$struct.Vkey = 0x52
ProcessKeypress($struct)
endfunc

0 comments on commit 7f0dee4

Please sign in to comment.