Meine ersten eigenen Funktionen bin gerne verbesserungsbereit
Mit den Funktionen kann überprüft werden ob z.B. die obere Seite eines Objekts in einem Gui ein anderes Objekt berührt und vieles mehr
Und falls jemand noch ne idee für nen neuen befehl hat .. einfach melden
Spoiler anzeigen
#include <Array.au3>
;===========================================================================================================================================
;Name:_ObjectTouchUp
;Beschreibung: Überprüft ob die obere Seite eines Objekts ein anderes Objekt berührt.
;Parameter: $Stat_01: X Position von Objekt 1
; $Stat_02: Y Position von Objekt 1
; $Stat_03: Länge von Objekt 1
; $Stat_04: Höhe von Objekt 1
; $Stat2_01: X Position von Objekt 2
; $Stat2_02: Y Positon von Object 2
; $Stat2_03: Länge von Objekt 2
; $Stat2_04: Höhe von Objekt 2
;Return Values: Bei Berührung 1
; Ansonsten: 0
;Author:nof@ker
;===========================================================================================================================================
Func _ObjectTouchUp($Stat_01,$Stat_02,$Stat_03,$Stat_04,$Stat2_01,$Stat2_02,$Stat2_03,$Stat2_04)
$Ausmass1LeftStart=$Stat_01
$Ausmass1LeftEnd=$Stat_01+$Stat_03
$Ausmass1HeightStart=$Stat_02
$Ausmass1HeightEnd=$Stat_02+$Stat_04
$Ausmass2LeftStart=$Stat2_01
$Ausmass2LeftEnd=$Stat2_01+$Stat2_03
$Ausmass2HeightStart=$Stat2_02
$Ausmass2HeightEnd=$Stat2_02+$Stat2_04
$TouchLeft=False
$TouchHeight=False
For $i=$Ausmass1LeftStart to $Ausmass1LeftEnd
If $i=$Stat2_01 Then
$TouchLeft=True
EndIf
Next
For $i=$Ausmass1HeightStart to $Ausmass1HeightEnd
If $i=$Stat2_02 Then
$TouchHeight=True
EndIf
Next
If $TouchLeft=True and $TouchHeight=True Then
Return 1
Else
Return 0
EndIf
EndFunc
;===========================================================================================================================================
;Name:_ObjectTouchDown
;Beschreibung: Überprüft ob die untere Seite eines Objekts ein anderes Objekt berührt.
;Parameter: $Stat_01: X Position von Objekt 1
; $Stat_02: Y Position von Objekt 1
; $Stat_03: Länge von Objekt 1
; $Stat_04: Höhe von Objekt 1
; $Stat2_01: X Position von Objekt 2
; $Stat2_02: Y Positon von Object 2
; $Stat2_03: Länge von Objekt 2
; $Stat2_04: Höhe von Objekt 2
;Return Values: Bei Berührung 1
; Ansonsten: 0
;Author:nof@ker
;===========================================================================================================================================
Func _ObjectTouchDown($Stat_01,$Stat_02,$Stat_03,$Stat_04,$Stat2_01,$Stat2_02,$Stat2_03,$Stat2_04)
$Ausmass1LeftStart=$Stat_01
$Ausmass1LeftEnd=$Stat_01+$Stat_03
$Ausmass1HeightStart=$Stat_02
$Ausmass1HeightEnd=$Stat_02+$Stat_04
$Ausmass2LeftStart=$Stat2_01
$Ausmass2LeftEnd=$Stat2_01+$Stat2_03
$Ausmass2HeightStart=$Stat2_02
$Ausmass2HeightEnd=$Stat2_02+$Stat2_04
$TouchLeft=False
$TouchHeight=False
For $i=$Ausmass1LeftStart to $Ausmass1LeftEnd
If $i=$Stat2_01 Then
$TouchLeft=True
EndIf
Next
For $i=$Ausmass1HeightStart to $Ausmass1HeightEnd
If $i=$Ausmass2HeightEnd Then
$TouchHeight=True
EndIf
Next
If $TouchLeft=True and $TouchHeight=True Then
Return 1
Else
Return 0
EndIf
EndFunc
;===========================================================================================================================================
;Name:_ObjectTouchLeft
;Beschreibung: Überprüft ob die linke Seite eines Objekts ein anderes Objekt berührt.
;Parameter: $Stat_01: X Position von Objekt 1
; $Stat_02: Y Position von Objekt 1
; $Stat_03: Länge von Objekt 1
; $Stat_04: Höhe von Objekt 1
; $Stat2_01: X Position von Objekt 2
; $Stat2_02: Y Positon von Object 2
; $Stat2_03: Länge von Objekt 2
; $Stat2_04: Höhe von Objekt 2
;Return Values: Bei Berührung 1
; Ansonsten: 0
;Author:nof@ker
;===========================================================================================================================================
Func _ObjectTouchLeft($Stat_01,$Stat_02,$Stat_03,$Stat_04,$Stat2_01,$Stat2_02,$Stat2_03,$Stat2_04)
$Ausmass1LeftStart=$Stat_01
$Ausmass1LeftEnd=$Stat_01+$Stat_03
$Ausmass1HeightStart=$Stat_02
$Ausmass1HeightEnd=$Stat_02+$Stat_04
$Ausmass2LeftStart=$Stat2_01
$Ausmass2LeftEnd=$Stat2_01+$Stat2_03
$Ausmass2HeightStart=$Stat2_02
$Ausmass2HeightEnd=$Stat2_02+$Stat2_04
$TouchLeft=False
$TouchHeight=False
For $i=$Ausmass1LeftStart to $Ausmass1LeftEnd
If $i=$Ausmass2LeftStart Then
$TouchLeft=True
EndIf
Next
For $i=$Ausmass1HeightStart to $Ausmass1HeightEnd
For $j=$Ausmass2HeightStart to $Ausmass2HeightEnd
If $i=$j Then
$TouchHeight=True
EndIf
Next
Next
If $TouchLeft=True and $TouchHeight=True Then
Return 1
Else
Return 0
EndIf
EndFunc
;===========================================================================================================================================
;Name:_ObjectTouchRight
;Beschreibung: Überprüft ob die rechte Seite eines Objekts ein anderes Objekt berührt.
;Parameter: $Stat_01: X Position von Objekt 1
; $Stat_02: Y Position von Objekt 1
; $Stat_03: Länge von Objekt 1
; $Stat_04: Höhe von Objekt 1
; $Stat2_01: X Position von Objekt 2
; $Stat2_02: Y Positon von Object 2
; $Stat2_03: Länge von Objekt 2
; $Stat2_04: Höhe von Objekt 2
;Return Values: Bei Berührung 1
; Ansonsten: 0
;Author:nof@ker
;===========================================================================================================================================
Func _ObjectTouchRight($Stat_01,$Stat_02,$Stat_03,$Stat_04,$Stat2_01,$Stat2_02,$Stat2_03,$Stat2_04)
$Ausmass1LeftStart=$Stat_01
$Ausmass1LeftEnd=$Stat_01+$Stat_03
$Ausmass1HeightStart=$Stat_02
$Ausmass1HeightEnd=$Stat_02+$Stat_04
$Ausmass2LeftStart=$Stat2_01
$Ausmass2LeftEnd=$Stat2_01+$Stat2_03
$Ausmass2HeightStart=$Stat2_02
$Ausmass2HeightEnd=$Stat2_02+$Stat2_04
$TouchLeft=False
$TouchHeight=False
For $i=$Ausmass1LeftStart to $Ausmass1LeftEnd
If $i=$Ausmass2LeftEnd Then
$TouchLeft=True
EndIf
Next
For $i=$Ausmass1HeightStart to $Ausmass1HeightEnd
For $j=$Ausmass2HeightStart to $Ausmass2HeightEnd
If $i=$j Then
$TouchHeight=True
EndIf
Next
Next
If $TouchLeft=True and $TouchHeight=True Then
Return 1
Else
Return 0
EndIf
EndFunc
;===========================================================================================================================================
;Name:_ObjectinObject
;Beschreibung: Überprüft ob ein Objekt in einem anderen Objekt liegt.
;Parameter: $Stat_01: X Position von Objekt 1
; $Stat_02: Y Position von Objekt 1
; $Stat_03: Länge von Objekt 1
; $Stat_04: Höhe von Objekt 1
; $Stat2_01: X Position von Objekt 2
; $Stat2_02: Y Positon von Object 2
; $Stat2_03: Länge von Objekt 2
; $Stat2_04: Höhe von Objekt 2
;Return Values: Bei Ineinanderliegen 1
; Ansonsten: 0
;Author:nof@ker
;===========================================================================================================================================
Func _ObjectinObject($Stat_01,$Stat_02,$Stat_03,$Stat_04,$Stat2_01,$Stat2_02,$Stat2_03,$Stat2_04)
$Ausmass1LeftStart=$Stat_01
$Ausmass1LeftEnd=$Stat_01+$Stat_03
$Ausmass1HeightStart=$Stat_02
$Ausmass1HeightEnd=$Stat_02+$Stat_04
$Ausmass2LeftStart=$Stat2_01
$Ausmass2LeftEnd=$Stat2_01+$Stat2_03
$Ausmass2HeightStart=$Stat2_02
$Ausmass2HeightEnd=$Stat2_02+$Stat2_04
$TouchX=False
$TouchY=False
For $i=$Ausmass1LeftStart to $Ausmass1LeftEnd
For $j=$Ausmass2LeftStart to $Ausmass2LeftEnd
If $i=$j Then
$TouchX=True
EndIf
Next
Next
For $i=$Ausmass1HeightStart to $Ausmass1HeightEnd
For $j=$Ausmass2HeightStart to $Ausmass2HeightEnd
If $i=$j Then
$TouchY=True
EndIf
Next
Next
If $TouchX and $TouchY = True Then
Return 1
Else
Return 0
EndIf
EndFunc