Ich habs selbst geschafft ![]()
Hier mal die Lösung wenns einen interessiert:
Spoiler anzeigen
$joy = _JoyInit()
While 1
$coord = _GetJoy($joy, 0)
$coordX = Round($coord[0] / 255, 0)
$coordY = Round($coord[1] / 255, 0)
;~ MsgBox(0,"",$coordX&","&$coordY)
If $coordX > 110 And $coordX < 150 And $coordY > 110 And $coordY < 150 Then
;~ MsgBox(0,"","nix")
Send("{LEFT UP}")
Send("{UP UP}")
Send("{RIGHT UP}")
Send("{DOWN UP}")
EndIf
If $coordX < 90 And $coordY > 110 And $coordY < 180 Then
;~ MsgBox(0,"","Links")
Send("{LEFT DOWN}")
Send("{UP UP}")
Send("{RIGHT UP}")
Send("{DOWN UP}")
EndIf
If $coordX = 0 Or $coordX < 40 And $coordY > 220 Then
;~ MsgBox(0,"","Links-Unten")
Send("{LEFT DOWN}")
Send("{UP UP}")
Send("{RIGHT UP}")
Send("{DOWN DOWN}")
EndIf
If $coordX > 80 And $coordX < 170 And $coordY > 250 Then
;~ MsgBox(0,"","Unten")
Send("{LEFT UP}")
Send("{UP UP}")
Send("{RIGHT UP}")
Send("{DOWN DOWN}")
EndIf
If $coordX > 160 And $coordY > 200 Then
;~ MsgBox(0,"","Unten-Rechts")
Send("{LEFT UP}")
Send("{UP UP}")
Send("{RIGHT DOWN}")
Send("{DOWN DOWN}")
EndIf
If $coordX > 240 And $coordY > 110 And $coordY < 200 Then
;~ MsgBox(0,"","Rechts")
Send("{LEFT UP}")
Send("{UP UP}")
Send("{RIGHT DOWN}")
Send("{DOWN UP}")
EndIf
If $coordX > 180 And $coordY < 90 Then
;~ MsgBox(0,"","Oben-Rechts")
Send("{LEFT UP}")
Send("{UP DOWN}")
Send("{RIGHT DOWN}")
Send("{DOWN UP}")
EndIf
If $coordX > 80 And $coordX < 150 And $coordY < 60 Then
;~ MsgBox(0,"","Oben")
Send("{LEFT UP}")
Send("{UP DOWN}")
Send("{RIGHT UP}")
Send("{DOWN UP}")
EndIf
If $coordX < 60 And $coordX < 120 And $coordY < 110 Then
;~ MsgBox(0,"","Oben-Links")
Send("{LEFT DOWN}")
Send("{UP DOWN}")
Send("{RIGHT UP}")
Send("{DOWN UP}")
EndIf
WEnd
Func _GetJoy($lpJoy, $iJoy)
Local $coor, $ret
Dim $coor[8]
DllCall("Winmm.dll", "int", "joyGetPosEx", _
"int", $iJoy, _
"ptr", DllStructGetPtr($lpJoy))
If Not @error Then
$coor[0] = DllStructGetData($lpJoy, 1, 3)
$coor[1] = DllStructGetData($lpJoy, 1, 4)
$coor[2] = DllStructGetData($lpJoy, 1, 5)
$coor[3] = DllStructGetData($lpJoy, 1, 6)
$coor[4] = DllStructGetData($lpJoy, 1, 7)
$coor[5] = DllStructGetData($lpJoy, 1, ![]()
$coor[6] = DllStructGetData($lpJoy, 1, 11)
$coor[7] = DllStructGetData($lpJoy, 1, 9)
EndIf
Return $coor
EndFunc ;==>_GetJoy
Func _JoyInit()
Local $joy
Global $JOYINFOEX_struct = "dword[13]"
$joy = DllStructCreate($JOYINFOEX_struct)
If @error Then Return 0
DllStructSetData($joy, 1, DllStructGetSize($joy), 1);dwSize = sizeof(struct)
DllStructSetData($joy, 1, 255, 2) ;dwFlags = GetAll
Return $joy
EndFunc ;==>_JoyInit
Bin für verbesserungen noch offen ![]()