Merge remote-tracking branch '360_wasd/master'
This commit is contained in:
commit
6dbace24f9
1 changed files with 64 additions and 0 deletions
64
360-stick.ahk
Normal file
64
360-stick.ahk
Normal file
|
@ -0,0 +1,64 @@
|
|||
#Persistent
|
||||
#SingleInstance Force
|
||||
Send {w up}
|
||||
Send {a up}
|
||||
Send {s up}
|
||||
Send {d up}
|
||||
|
||||
Deadzone := 0.6
|
||||
SetTimer Wax, 5
|
||||
return
|
||||
|
||||
Wax:
|
||||
GetKeyState JoyX, JoyX
|
||||
GetKeyState JoyY, JoyY
|
||||
JoyX := (JoyX - 50)/50
|
||||
JoyY := (JoyY - 50)/50
|
||||
Angle := ATan(JoyX/JoyY)*2/3.14159
|
||||
Angle := (JoyY > 0) ? Angle + 3: Angle + 1
|
||||
Length := Sqrt(JoyX**2 + JoyY**2)
|
||||
; 1 1 0
|
||||
; 2 - 0
|
||||
; 2 3 3
|
||||
|
||||
OldX = %HoldX%
|
||||
OldY = %HoldY%
|
||||
|
||||
if Length > %Deadzone%
|
||||
{
|
||||
if % Angle >= 1.2 && Angle < 2.7
|
||||
HoldX = a
|
||||
else if % Angle >= 3.2 || Angle < 0.7
|
||||
HoldX = d
|
||||
else
|
||||
HoldX =
|
||||
if % Angle >= 0.3 && Angle < 1.7
|
||||
HoldY = w
|
||||
else if % Angle >= 2.3 && Angle < 3.7
|
||||
HoldY = s
|
||||
else
|
||||
HoldY =
|
||||
} else
|
||||
{
|
||||
HoldX =
|
||||
HoldY =
|
||||
}
|
||||
|
||||
SetKeyDelay -1
|
||||
if OldX != %HoldX%
|
||||
{
|
||||
if HoldX
|
||||
Send {%HoldX% down}
|
||||
if OldX
|
||||
Send {%OldX% up}
|
||||
}
|
||||
if OldY != %HoldY%
|
||||
{
|
||||
if HoldY
|
||||
Send {%HoldY% down}
|
||||
if OldY
|
||||
Send {%OldY% up}
|
||||
}
|
||||
return
|
||||
|
||||
F10::ExitApp
|
Loading…
Reference in a new issue