Hey, hab letztens in der SB gelesen das jmd versucht etwas darzustellen was immer in Richtung Maus guckt. Hab mich kurz drangesetzt und was geschrieben, ist nur ein Beispiel vllt kann trotzdem jmd was mit anfangen
Spoiler anzeigen
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=..\..\..\Desktop\Eyes.exe
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GDIPlus.au3>
#include <WinApi.au3>
Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $nWidth = 700, $nHeight = 700
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]#region Auge
[/autoit] [autoit][/autoit] [autoit];; Array/Eyes
Dim $aEyes[5][5][3]
;; Variablen/Eyes
Global $nEyeWidth = $nWidth / UBound($aEyes, 1)
Global $nEyeHeight = $nHeight / UBound($aEyes, 2)
For $y = 0 To UBound($aEyes, 2) - 1 ;; Y
For $x = 0 To UBound($aEyes, 1) - 1 ;; X
$aEyes[$x][$y][0] = $nEyeWidth / 2 * (2 * ($x)) ;; X
$aEyes[$x][$y][1] = $nEyeHeight / 2 * (2 * ($y)) ;; Y
$aEyes[$x][$y][2] = 0 ; Zwinkern True/False
Next
Next
;~ (0.0)|(0.1)...
;~ (1.0)|(1.1)...
;~ ...
;; Array/Iris
Dim $aIris[UBound($aEyes, 1)][UBound($aEyes, 2)][2]
For $y = 0 To UBound($aEyes, 2) - 1
For $x = 0 To UBound($aEyes, 1) - 1
$aIris[$x][$y][0] = ($x * ($nEyeWidth)) + ($nEyeWidth / 2) ;; X
$aIris[$x][$y][1] = ($y * ($nEyeHeight)) + ($nEyeHeight / 2) ;; Y
Next
Next
#endregion Auge
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$hWnd = GUICreate("Test", $nWidth, $nHeight, -1, -1, 0x80000000)
GUISetOnEvent(-3, "_Exit")
GUISetState()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$hDC = _WinAPI_GetDC($hWnd)
$hDC_Buffer = _WinAPI_CreateCompatibleDC($hDC)
$hGDI_Bitmap = _WinAPI_CreateCompatibleBitmap($hDC, $nWidth, $nHeight)
_WinAPI_SelectObject($hDC_Buffer, $hGDI_Bitmap)
_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Buffer)
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)
$hBrush_Eye = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
$hBrush_Iris = _GDIPlus_BrushCreateSolid(0xFFAAAAFF)
$hPen_Klick = _GDIPlus_PenCreate(0xFF000000, 4)
[/autoit] [autoit][/autoit] [autoit]$FPSTimer = TimerInit()
[/autoit] [autoit][/autoit] [autoit]While Sleep(20)
_GDIPlus_GraphicsClear($hGraphics, 0xFFAAAAAA)
$aMouse = GUIGetCursorInfo($hWnd);
For $y = 0 To UBound($aEyes, 2) - 1
For $x = 0 To UBound($aEyes, 1) - 1
If $aEyes[$x][$y][2] = 0 Then
$aNewPos = _IrisGetNewPos($aMouse[0], $aMouse[1], $aIris[$x][$y][0], $aIris[$x][$y][1], $nEyeWidth, $nEyeHeight, $aEyes, $x, $y, $aMouse[2])
_GDIPlus_GraphicsFillEllipse($hGraphics, $aEyes[$x][$y][0], $aEyes[$x][$y][1], $nEyeWidth, $nEyeHeight, $hBrush_Eye)
_GDIPlus_GraphicsFillEllipseMiddle($hGraphics, $aNewPos[0], $aNewPos[1], $nEyeWidth / 2, $nEyeHeight / 2, $hBrush_Iris)
_GDIPlus_GraphicsFillEllipseMiddle($hGraphics, $aNewPos[0], $aNewPos[1], $nEyeWidth / 4.5, $nEyeHeight / 4.5)
Else
_GDIPlus_GraphicsFillEllipse($hGraphics, $aEyes[$x][$y][0], $aEyes[$x][$y][1], $nEyeWidth, $nEyeHeight, $hBrush_Eye)
_GDIPlus_GraphicsDrawArc($hGraphics, $aEyes[$x][$y][0], $aEyes[$x][$y][1] - $nEyeHeight / 3, $nEyeWidth / 1, $nEyeHeight / 1, 50, 80, $hPen_Klick)
EndIf
Next
Next
_GDIPlus_GraphicsDrawString($hGraphics, "FPS:" & 1000 / TimerDiff($FPSTimer), $nWidth - 47, 3)
$FPSTimer = TimerInit()
_WinAPI_BitBlt($hDC, 0, 0, $nWidth, $nHeight, $hDC_Buffer, 0, 0, 0x00CC0020)
WEnd
Func _IrisGetNewPos($_MouseX, $_MouseY, $_IrisX, $_IrisY, $_Width, $_Height, ByRef $_Eyes, $_x, $_y, $_MouseClick)
Local $fSteigung_X, $fSteigung_Y, $fLength;
$fLength = Sqrt(($_IrisX - $_MouseX) ^ 2 + ($_IrisY - $_MouseY) ^ 2)
[/autoit] [autoit][/autoit] [autoit]If $fLength <= $_Width / 4 And $fLength <= $nHeight / 4 Then
If $_MouseClick = 1 Then
$aEyes[$_x][$_y][2] = 1;
EndIf
Dim $aNewPos[2] = [$_MouseX, $_MouseY]
Return $aNewPos
EndIf
$fSteigung_X = ($_IrisX - $_MouseX) / $fLength
$fSteigung_Y = ($_IrisY - $_MouseY) / $fLength
$NewPos_X = $_IrisX - $fSteigung_X * $_Width / 4
$NewPos_Y = $_IrisY - $fSteigung_Y * $_Height / 4
Dim $NewPos[2] = [$NewPos_X, $NewPos_Y]
[/autoit] [autoit][/autoit] [autoit]Return $NewPos
EndFunc ;==>_IrisGetNewPos
Func _GDIPlus_GraphicsFillEllipseMiddle($_Graphic, $_x, $_y, $_Width, $_Height, $_Brush = 0)
_GDIPlus_GraphicsFillEllipse($_Graphic, $_x - $_Width / 2, $_y - $_Height / 2, $_Width, $_Height, $_Brush)
EndFunc ;==>_GDIPlus_GraphicsFillEllipseMiddle
Func _Exit()
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_DeleteDC($hDC_Buffer)
_WinAPI_DeleteObject($hGDI_Bitmap)
_GDIPlus_BrushDispose($hBrush_Eye)
_GDIPlus_BrushDispose($hBrush_Iris)
_GDIPlus_PenDispose($hPen_Klick)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit