Hat das wieder etwas mit deinem NosBot zu tun?
Das wäre jetzt das 4te Mal, dass wir dich auf die Forenregeln hinweisen....
Beiträge von name22
-
-
Zitat
wow es braucht keine gdip.au3

Ich hab mich zurückgehalten...
-
Ich bin mir nicht ganz sicher was das sein könnte (daher auch der seltsame Name), aber es ist irgendwie ganz lustig.
Mit der linken Maustaste verändert ihr die Position des Kreises.
Die Zahlen von 1 - 0 verändern die Positionen der Bezugspunkte.
Mit Strg + s öffnet ihr das Einstellungsmenü.
Alle Einstellungen werden in einer Datei gespeichert.
Hoffe es gefällt euch.
Spoiler anzeigen
[autoit]#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]$iGUIColorBG = 0xFFFFFFFF
[/autoit] [autoit][/autoit] [autoit]
$iGUIWidth = 400
$iGUIHeight = 400$hWndMain = GUICreate("Springy by name22 (autoit.de)", $iGUIWidth, $iGUIHeight)
[/autoit] [autoit][/autoit] [autoit]
GUISetState()$hWndSettings = GUICreate("Einstellungen", 190, 180, 192, 124)
[/autoit] [autoit][/autoit] [autoit]
$cSpringNr = GUICtrlCreateInput("Feder Nr", 8, 8, 81, 21, 0x2000)
GUICtrlSetLimit($cSpringNr, 2, 1)
$cSpringNrUD = GUICtrlCreateUpdown($cSpringNr)
GUICtrlSetLimit($cSpringNrUD, 10, 1)
$cLabel1 = GUICtrlCreateLabel("Farbe:", 8, 48, 34, 17)
$cColorShow = GUICtrlCreateLabel("", 8, 72, 71, 25)
$cState = GUICtrlCreateCheckbox("Aktiv", 136, 16, 49, 17)
$cStrength = GUICtrlCreateInput("", 8, 136, 81, 21, 0x2000)
GUICtrlSetLimit($cStrength, 3, 1)
$cLabel2 = GUICtrlCreateLabel("Stärke:", 8, 112, 36, 17)_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWndMain)
[/autoit] [autoit][/autoit] [autoit]
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iGUIWidth, $iGUIHeight, $hGraphic)
$hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)$hFormatNumber = _GDIPlus_StringFormatCreate()
[/autoit] [autoit][/autoit] [autoit]
$hFamilyNumbers = _GDIPlus_FontFamilyCreate("Arial")
$hFontNumbers = _GDIPlus_FontCreate($hFamilyNumbers, 14)$hBrushNumbers = _GDIPlus_BrushCreateSolid(0xFF000000)
[/autoit] [autoit][/autoit] [autoit]GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hWndMain)
[/autoit] [autoit][/autoit] [autoit]
GUISetOnEvent($GUI_EVENT_RESTORE, "WM_PAINT", $hWndMain)GUIRegisterMsg($WM_PAINT, "WM_PAINT")
[/autoit] [autoit][/autoit] [autoit]$iX = 200
[/autoit] [autoit][/autoit] [autoit]
$iY = 200
$vX = 0
$vY = 0
$Resistance = 0.93If FileExists(@ScriptDir & "\Data") Then
[/autoit] [autoit][/autoit] [autoit]
$aSpringCoords = _LoadFromFile()
Else
Global $aSpringCoords[11][5]
$aSpringCoords[0][0] = 10For $i = 1 To $aSpringCoords[0][0]
[/autoit] [autoit][/autoit] [autoit]
$aSpringCoords[$i][0] = Random(0, $iGUIWidth, 1)
$aSpringCoords[$i][1] = Random(0, $iGUIHeight, 1)
$aSpringCoords[$i][2] = _GDIPlus_PenCreate(0xFF000000, 2)
$aSpringCoords[$i][3] = True
$aSpringCoords[$i][4] = 30
Next
EndIfHotKeySet("^s", "_ShowSettings")
[/autoit] [autoit][/autoit] [autoit]While Sleep(10)
[/autoit] [autoit][/autoit] [autoit]
$iX += $vX
$iY += $vY
$vX *= $Resistance
$vY *= $Resistance_GDIPlus_GraphicsClear($hBuffer, $iGUIColorBG)
[/autoit] [autoit][/autoit] [autoit]$aMousePos = GUIGetCursorInfo($hWndMain)
[/autoit] [autoit][/autoit] [autoit]
If _IsPressed("01") Then
$iX = $aMousePos[0]
$iY = $aMousePos[1]
EndIf
For $i = 30 To 39
If _IsPressed($i) Then
$aSpringCoords[$i - 29][0] = $aMousePos[0]
$aSpringCoords[$i - 29][1] = $aMousePos[1]
EndIf
Next
For $i = 1 To $aSpringCoords[0][0]
If $aSpringCoords[$i][3] Then
$vX += ($aSpringCoords[$i][0] - $iX) / (100 - $aSpringCoords[$i][4])
$vY += ($aSpringCoords[$i][1] - $iY) / (100 - $aSpringCoords[$i][4])
_GDIPlus_GraphicsDrawLine($hBuffer, $aSpringCoords[$i][0], $aSpringCoords[$i][1], $iX, $iY, $aSpringCoords[$i][2])
$aInfo = _GDIPlus_GraphicsMeasureString($hBuffer, $i - 1, $hFontNumbers, _GDIPlus_RectFCreate(), $hFormatNumber)
$iWidthTmp = DllStructGetData($aInfo[0], "width")
$iHeightTmp = DllStructGetData($aInfo[0], "height")
Select
Case $aSpringCoords[$i][0] <= $iX And $aSpringCoords[$i][1] <= $iY
$tRectF = _GDIPlus_RectFCreate($aSpringCoords[$i][0] - $iWidthTmp, $aSpringCoords[$i][1] - $iHeightTmp)
Case $aSpringCoords[$i][0] >= $iX And $aSpringCoords[$i][1] <= $iY
$tRectF = _GDIPlus_RectFCreate($aSpringCoords[$i][0], $aSpringCoords[$i][1] - $iHeightTmp)
Case $aSpringCoords[$i][0] <= $iX And $aSpringCoords[$i][1] >= $iY
$tRectF = _GDIPlus_RectFCreate($aSpringCoords[$i][0] - $iWidthTmp, $aSpringCoords[$i][1])
Case $aSpringCoords[$i][0] >= $iX And $aSpringCoords[$i][1] >= $iY
$tRectF = _GDIPlus_RectFCreate($aSpringCoords[$i][0], $aSpringCoords[$i][1])
EndSelect
_GDIPlus_GraphicsDrawStringEx($hBuffer, $i - 1, $hFontNumbers, $tRectF, $hFormatNumber, $hBrushNumbers)
_GDIPlus_GraphicsDrawRect($hBuffer, DllStructGetData($tRectF, "x"), DllStructGetData($tRectF, "y"), $iWidthTmp, $iHeightTmp, $aSpringCoords[$i][2])
EndIf
Next_GDIPlus_GraphicsFillEllipse($hBuffer, $iX - 20, $iY - 20, 40, 40)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGUIWidth, $iGUIHeight)
WEndFunc _ShowSettings()
[/autoit] [autoit][/autoit] [autoit]
Opt("GUIOnEventMode", 0)
GUISetState(@SW_SHOW, $hWndSettings)
$iSpringNrTmp = 1While 1
[/autoit] [autoit][/autoit] [autoit]
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Opt("GUIOnEventMode", 1)
GUISetState(@SW_HIDE, $hWndSettings)
Return _SaveToFile()
Case $cSpringNr
$iSpringNrTmp = GUICtrlRead($cSpringNr)
Select
Case $iSpringNrTmp > 10
$iSpringNrTmp = 10
Case $iSpringNrTmp < 1
$iSpringNrTmp = 1
EndSelect
GUICtrlSetBkColor($cColorShow, StringTrimLeft(Hex(_GDIPlus_PenGetColor($aSpringCoords[$iSpringNrTmp][2])), 3))
GUICtrlSetData($cStrength, $aSpringCoords[$iSpringNrTmp][4])
If $aSpringCoords[$iSpringNrTmp][3] Then
GUICtrlSetState($cState, $GUI_CHECKED)
Else
GUICtrlSetState($cState, $GUI_UNCHECKED)
EndIf
Case $cColorShow
$iColorRGB = StringTrimLeft(_ChooseColor(2), 2)
_GDIPlus_PenSetColor($aSpringCoords[$iSpringNrTmp][2], "0xFF" & $iColorRGB)
GUICtrlSetBkColor($cColorShow, "0x" & $iColorRGB)
Case $cState
If $aSpringCoords[$iSpringNrTmp][3] Then
$aSpringCoords[$iSpringNrTmp][3] = False
Else
$aSpringCoords[$iSpringNrTmp][3] = True
EndIf
Case $cStrength
$iStrengthTmp = GUICtrlRead($cStrength)
Select
Case $iStrengthTmp > 80
$iStrengthTmp = 80
Case $iStrengthTmp < 1
$iStrengthTmp = 1
EndSelect
GUICtrlSetData($cStrength, $iStrengthTmp)
$aSpringCoords[$iSpringNrTmp][4] = $iStrengthTmp
EndSwitch
WEnd
EndFunc ;==>_ShowSettingsFunc WM_PAINT()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGUIWidth, $iGUIHeight)
EndFunc ;==>WM_PAINTFunc _LoadFromFile()
[/autoit] [autoit][/autoit] [autoit]
$sText = FileRead(@ScriptDir & "\Data")
$aSplitTmp = StringSplit($sText, "|")Local $aReturn[$aSplitTmp[0] + 1][5]
[/autoit] [autoit][/autoit] [autoit]
$aReturn[0][0] = $aSplitTmp[0]For $i = 1 To $aSplitTmp[0]
[/autoit] [autoit][/autoit] [autoit]
$aSplitTmp2 = StringSplit($aSplitTmp[$i], ",", 2)
$aReturn[$i][0] = $aSplitTmp2[0]
$aReturn[$i][1] = $aSplitTmp2[1]
$aReturn[$i][2] = "0x" & Hex(_GDIPlus_PenCreate($aSplitTmp2[2], 2))
Switch $aSplitTmp2[3]
Case "True"
$aReturn[$i][3] = True
Case "False"
$aReturn[$i][3] = False
EndSwitch
$aReturn[$i][4] = $aSplitTmp2[4]
Next
Return $aReturn
EndFunc ;==>_LoadFromFileFunc _SaveToFile()
[/autoit] [autoit][/autoit] [autoit]
$sString = ""For $i = 1 To $aSpringCoords[0][0]
[/autoit] [autoit][/autoit] [autoit]
$sString &= $aSpringCoords[$i][0] & "," & $aSpringCoords[$i][1] & "," & _GDIPlus_PenGetColor($aSpringCoords[$i][2]) & "," & $aSpringCoords[$i][3] & "," & $aSpringCoords[$i][4] & "|"
Next
$hFile = FileOpen(@ScriptDir & "\Data", 2)
FileWrite($hFile, StringTrimRight($sString, 2))
FileClose($hFile)
EndFuncFunc _Exit()
[/autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_GraphicsDispose($hBuffer)
_GDIPlus_BitmapDispose($hBitmap)
For $i = 1 To $aSpringCoords[0][0]
_GDIPlus_PenDispose($aSpringCoords[$i][2])
Next
_GDIPlus_StringFormatDispose($hFormatNumber)
_GDIPlus_FontDispose($hFontNumbers)
_GDIPlus_FontFamilyDispose($hFamilyNumbers)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit -
Das ist wirklich eine prima Idee, nur habe ich gerade recht viel zu tun.
Dieser Thread hilft dir mit Sicherheit weiter.
Falls du es nicht kannst und sonst niemand Lust hat musst du warten bis ich Zeit habe :P. -
Zitat
Frage mich ob man das so "umbauen" könnte das dieses Programm ohne (zumindest sichtbare) GUI auskommt und damit direkt auf den Desktop zeichnet, also als "mouse - effekt"...quasi wie bei Linux Compiz?
Ja, das würde gehen :P. -
Ich hab auch mal sowas gemacht :). (Damals kannte ich die GDIP.au3 noch nicht)
Spoiler anzeigen
[autoit]Func _GDIPlus_RotateImage($hImage, $iAngle = 0)
[/autoit] [autoit][/autoit] [autoit]
Local $iWidth = _GDIPlus_ImageGetWidth($hImage)
Local $iHeight = _GDIPlus_ImageGetHeight($hImage)
If @error Then Return SetError(@error, 0, 0)
Local $hImageGraphicsTmp = _GDIPlus_ImageGetGraphicsContext($hImage)
Local $hBitmapReturn = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hImageGraphicsTmp)
Local $hBitmapGraphicsTmp = _GDIPlus_ImageGetGraphicsContext($hBitmapReturn)Local $hRotateMatrix = _GDIPlus_MatrixCreate()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_MatrixTranslate($hRotateMatrix, $iWidth / 2, $iHeight / 2)
_GDIPlus_MatrixRotate($hRotateMatrix, $iAngle)
_GDIPlus_GraphicsSetTransform($hBitmapGraphicsTmp, $hRotateMatrix)_GDIPlus_GraphicsDrawImageRect($hBitmapGraphicsTmp, $hImage, - $iWidth / 2, - $iHeight / 2, $iWidth, $iHeight)
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_GraphicsDispose($hImageGraphicsTmp)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hBitmapGraphicsTmp)
_GDIPlus_ImageDispose($hImage)Return $hBitmapReturn
[/autoit]
EndFunc
Allerdings finde ich es besser, die Rotationsmatrix direkt auf die Grafik anzuwenden in die man das Bild zeichnen möchte.
Aber für Anfänger Top!
-
Zitat
Es muss aber wirkich 5 heißen!
Bitte ließ dir mal ein Array Tut durch...
5 ist nur ein Wert den du in diesem Fall dem 4.Element deines Arrays zuweist! Das ganze beginnt aber immer noch bei 0!Spoiler anzeigen
[autoit]#include <Array.au3>
[/autoit]
Dim $liste[5] = [1,2,"test",5,"test2"]
_ArrayDisplay($liste)
Das was du willst geht entweder über _ArrayAdd oder mit StringSplit. -
Zitat
Die verbindung geht manchmal verloren
Dann sag doch bitte mal woran man das erkennen kann.
Sonst können wir auch nur raten. -
So was meinst du? Muss natürlich optimiert werden ;).
Spoiler anzeigen
[autoit]#include <GUIConstants.au3>
[/autoit] [autoit][/autoit] [autoit]$hWnd = GUICreate("Test", 400, 400)
[/autoit] [autoit][/autoit] [autoit]
$cList = GUICtrlCreateList("", 0, 0, 340, 400)
$cButtonMin = GUICtrlCreateButton("Minimieren", 345, 10, 50, 25)
GUISetState()$aWinList = WinList()
[/autoit] [autoit][/autoit] [autoit]$sStringTmp = ""
[/autoit] [autoit][/autoit] [autoit]For $i = 1 To $aWinList[0][0]
[/autoit] [autoit][/autoit] [autoit]
If $aWinList[$i][0] <> "" Then $sStringTmp &= $aWinList[$i][0] & "|"
NextGUICtrlSetData($cList, $sStringTmp)
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit]
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $cButtonMin
WinSetState(GUICtrlRead($cList), "", @SW_MINIMIZE)
EndSwitch
WEnd -
Ein Array ist immer 0 basiert, das heißt in deinem Fall beträgt der Index des 1.Elements 0 und der des letzten 4 ;).
-
Zitat
Man könnte auch Mathe verwenden, dadurch wäre es dann noch schneller

Stimmt, aber ursprünglich wollte ich damit auch Teile/Parikel eines Bildes drehen, und da helfen mir meine Mathekenntnisse recht wenig, weswegen ich wieder auf Matrizen zurückgreife :P. -
Zitat
jetzt versteh ichs!aber im letzen script war das doch so gräulich und nun grün?
Wenn du immer noch einen Brush für _GDIPlus_GraphicsClear verwendest müsste die Farbe jedesmal bis zu einem gewissen Grad zufällig sein.
-
Zitat
In meinem Kopf schwirrt immer noch die Implementierung eines Feuerwerks rum :wacko: Mal sehen, wann ich es umsetzen kann...
Das wollte ich eigentlich auch machen... Aber für so viele Partikel ist AutoIt zu langsam.
Man muss auf jeden Fall ein bisschen Tricksen.
Dein Script sieht auch cool aus.
Und ist dank fehlender Rotation um einiges schneller als meins. 
-
Du musst einfach eine Farbe mit einem anderen Alpha Channel als FF verwenden z.B. 0xA0FF0000 für einen Rotton ;).
Das ist auch der Grund wieso dein Script überhaupt so eine Art Kometenschweif produziert... Außerdem habe ich dir das schon vorhin gesagt...
-
Zitat
i wie kommts mir so vor als ob du die ganze gdip.au3 einmal durchmachst

...
Da wäre ich eine ganze Zeit lang beschäftigt.
-
Schon mal vorab: Es ist nichts besonderes! Und ich habe nicht vor das irgendwie weiter zu verbessern.
Dennoch hoffe ich es bringt irgendjemandem etwas.
Am Anfang des Scripts sind ein paar Variablen für die Einstellungen. Viel Spaß.Spoiler anzeigen
[autoit]#include <GDIP.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstants.au3>Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $iParticleCount = 40 ;Anzahl der Partikel (bitte nicht übertreiben ;))
[/autoit] [autoit][/autoit] [autoit]
Global $iMaxRotationSpeed = 10 ;Maximale Rotationsgeschwindigkeit der Partikel
Global $iMaxSpeedX = 10 ;Maximale X - Geschwindigkeit der Partikel
Global $iMaxSpeedY = 10 ;Maximale Y - Geschwindigkeit der Partikel
Global $iMinSize = 1 ;Minimale Größe der Partikel
Global $iMaxSize = 3 ;Maximale Größe der Partikel
Global $iResistance = 0.95 ;Luftwiederstand (Wert zwischen 0 und 1, 1 = keine Reibung)$hWnd = GUICreate("Particles", 400, 400)
[/autoit] [autoit][/autoit] [autoit]
GUISetState()_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
[/autoit] [autoit][/autoit] [autoit]
$hBitmap = _GDIPlus_BitmapCreateFromGraphics(400, 400, $hGraphic)
$hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)Global $aMousePos[2]
[/autoit] [autoit][/autoit] [autoit]
$aMousePos[0] = 200
$aMousePos[1] = 200Global $aParticles[$iParticleCount + 1][8]
[/autoit] [autoit][/autoit] [autoit]
$aParticles[0][0] = $iParticleCount$hBrush_Explosion = _GDIPlus_PathBrushCreatePie(-25, -25, 50, 50, 0, 361, 0xFFFF0F00, 0x00000000)
[/autoit] [autoit][/autoit] [autoit]For $i = 1 To $aParticles[0][0]
[/autoit] [autoit][/autoit] [autoit]
$aParticles[$i][0] = 200
$aParticles[$i][1] = 200
$aParticles[$i][2] = Random($iMinSize, $iMaxSize, 1)
$aParticles[$i][3] = Random(0, 359, 1)
$aParticles[$i][4] = _GDIPlus_BrushCreateSolid("0xFF" & Hex(Random(200, 255, 1), 2) & Hex(Random(0, 100, 1), 2) & Hex(Random(0, 100, 1), 2))
$aParticles[$i][5] = Random(-$iMaxSpeedX, $iMaxSpeedX)
$aParticles[$i][6] = Random(-$iMaxSpeedY, $iMaxSpeedY)
$aParticles[$i][7] = Random(-$iMaxRotationSpeed, $iMaxRotationSpeed)
NextGUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
[/autoit] [autoit][/autoit] [autoit]
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_Restart")$iTimerExplosion = TimerInit()
[/autoit] [autoit][/autoit] [autoit]While Sleep(20)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsClear($hBuffer)
For $i = 1 To $aParticles[0][0]
$aParticles[$i][0] += $aParticles[$i][5]
$aParticles[$i][1] += $aParticles[$i][6]
$aParticles[$i][3] += $aParticles[$i][7]
$aParticles[$i][5] *= $iResistance
$aParticles[$i][6] *= $iResistance
$aParticles[$i][7] *= $iResistance
_GDIPlus_GraphicsFillRectWithAngle($hBuffer, $aParticles[$i][0], $aParticles[$i][1], $aParticles[$i][2], $aParticles[$i][2], $aParticles[$i][3], $aParticles[$i][4])
Next
If TimerDiff($iTimerExplosion) < 50 Then
_GDIPlus_GraphicsTranslateTransform($hBuffer, $aMousePos[0], $aMousePos[1])
_GDIPlus_GraphicsFillRect($hBuffer, -25, -25, 50, 50, $hBrush_Explosion)
_GDIPlus_GraphicsResetTransform($hBuffer)
EndIf
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, 400, 400)
WEndFunc _Exit()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_GraphicsDispose($hBuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_BrushDispose($hBrush_Explosion)
For $i = 1 To $aParticles[0][0]
_GDIPlus_BrushDispose($aParticles[$i][4])
Next
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_ExitFunc _Restart()
[/autoit] [autoit][/autoit] [autoit]
$aMousePos = GUIGetCursorInfo($hWnd)
For $i = 1 To $aParticles[0][0]
$aParticles[$i][0] = $aMousePos[0]
$aParticles[$i][1] = $aMousePos[1]
$aParticles[$i][2] = Random($iMinSize, $iMaxSize, 1)
$aParticles[$i][3] = Random(0, 359, 1)
_GDIPlus_BrushSetSolidColor($aParticles[$i][4], "0xFF" & Hex(Random(200, 255, 1), 2) & Hex(Random(0, 100, 1), 2) & Hex(Random(0, 100, 1), 2))
$aParticles[$i][5] = Random(-$iMaxSpeedX, $iMaxSpeedX)
$aParticles[$i][6] = Random(-$iMaxSpeedY, $iMaxSpeedY)
$aParticles[$i][7] = Random(-$iMaxRotationSpeed, $iMaxRotationSpeed)
Next
$iTimerExplosion = TimerInit()
EndFunc ;==>_RestartFunc _GDIPlus_GraphicsFillRectWithAngle($hGraphics, $iX, $iY, $iWidth, $iHeight, $iAngle, $hBrush = 0)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsTranslateTransform($hGraphics, $iX - $iWidth / 2, $iY - $iHeight / 2)
_GDIPlus_GraphicsRotateTransform($hGraphics, $iAngle)
_GDIPlus_GraphicsFillRect($hGraphics, -$iWidth / 2, -$iHeight / 2, $iWidth, $iHeight, $hBrush)
_GDIPlus_GraphicsResetTransform($hGraphics)
EndFunc ;==>_GDIPlus_GraphicsFillRectWithAngle; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _GDIPlus_PathBrushCreatePie
; Beschreibung ..: Erstellt einen Farbverlauf in Form eines "Kuchens" (Teil eines Kreises) mit 2 Farben eine beginnend in der Mitte der Ellipse aus der der "Kuchen" erstellt wird und eine die auf dem Umkreis der Ellipse verläuft.
; Syntax.........: _GDIPlus_PathBrushCreatePie($iX, $iY, $iWidth, $iHeight, $iStartAngle, $iSweepAngle, $ARGB_Center, $ARGB_Surround, [$iWrapMode = 4])
; Parameter .....: $iX - X - Koordinate der linken oberen Ecke des Rechtecks aus dem die Ellipse des Kuchenstücks erstellt wird
; $iY - Y - Koordinate der linken oberen Ecke des Rechtecks aus dem die Ellipse des Kuchensstücks erstellt wird
; $iWidth - Breite der Ellipse
; $iHeight - Höhe der Ellipse
; $iStartAngle - Startwinkel des Kuchenstücks
; $iSweepAngle - Winkel der zum Startwinkel addiert wird und den Endwinkel bestimmt (Ein negativer Wert bedeutet eine "Rotation" nach links)
; $ARGB_Center - Farbe für den Mittelpunkt der Ellipse
; $ARGB_Surround - Farbe für den Umkreis der Ellipse
; $iWrapMode - Wrap mode der die Aufteilung und die Spiegelung des Brushes definiert (Standard 4):
; |0 - Teilen ohne spiegeln
; |1 - Teile werden horizontal gespiegelt wenn die Größe des Brush in X Richtung überschritten wird
; |2 - Teile werden vertikal gespiegelt wenn die Größe des Brush in Y Richtung überschritten wird
; |3 - Kombination aus 1 und 2
; |4 - Keine Teilung
; Rückgabewerte .: Success - Pointer zu einem neuen Brush Objekt
; Failure - -1 und setzt @error:
; |1 - $iSweepAngle ist = 0
; Bemerkungen ...: Um die Ressourcen für den Brush freizugeben, muss _GDIPlus_BrushDispose aufgerufen werden
; Autor .........: name22 @ http://www.autoit.de/
; ===============================================================================================================================
Func _GDIPlus_PathBrushCreatePie($iX, $iY, $iWidth, $iHeight, $iStartAngle, $iSweepAngle, $ARGB_Center, $ARGB_Surround, $iWrapMode = 4)
Local Const $Pi_Div_180 = ACos(-1) / 180If $iStartAngle <= 0 Then $iStartAngle = 1
[/autoit] [autoit][/autoit] [autoit]
If $iSweepAngle = 0 Then Return SetError(1, 0, -1)
If $iSweepAngle < 0 Then
$iSweepAngle *= -1
$iStartAngle = 360 - $iSweepAngle + $iStartAngle
EndIfDim $aPoints_Path[$iSweepAngle + 2][2]
[/autoit] [autoit][/autoit] [autoit]
$aPoints_Path[0][0] = $iSweepAngle + 1
$iI = 1
For $i = $iStartAngle To $iStartAngle + $iSweepAngle - 1
$aPoints_Path[$iI][0] = $iX + $iWidth / 2 + Cos(($i - 90) * $Pi_Div_180) * $iWidth / 2
$aPoints_Path[$iI][1] = $iY + $iHeight / 2 + Sin(($i - 90) * $Pi_Div_180) * $iHeight / 2
$iI += 1
Next
$aPoints_Path[UBound($aPoints_Path) - 1][0] = $iX + $iWidth / 2
$aPoints_Path[UBound($aPoints_Path) - 1][1] = $iY + $iHeight / 2Dim $aColors_Path[$iSweepAngle + 1]
[/autoit] [autoit][/autoit] [autoit]
$aColors_Path[0] = $iSweepAngle
$iI = 1
For $i = $iStartAngle To $iStartAngle + $iSweepAngle - 1
$aColors_Path[$iI] = $ARGB_Surround
$iI += 1
Next$hBrush_Pie = _GDIPlus_PathBrushCreate($aPoints_Path, $iWrapMode)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathBrushSetCenterPoint($hBrush_Pie, $iX + $iWidth / 2, $iY + $iHeight / 2)
_GDIPlus_PathBrushSetCenterColor($hBrush_Pie, $ARGB_Center)
_GDIPlus_PathBrushSetSurroundColorsWithCount($hBrush_Pie, $aColors_Path)Return $hBrush_Pie
[/autoit]
EndFunc ;==>_GDIPlus_PathBrushCreatePie
Für das Script wird allerdings wieder die GDIP.au3 benötigt ;). (alles im Anhang)Edit: Habe mal eine Screensaver Version angehängt, wer ihn installieren will: Einfach kompilieren und in .scr umbenennen ;).
-
Alizame Ich weiß wo das Problem liegt und es kostet mich ein paar Sekunden dein Script zu korrigieren, aber wenn du es dann immer noch nicht verstehst lernst du nichts dabei.
GDI+ lernt man auch durch Erfahrung und Herumprobieren.
-
Wuuhuu ich stehe mit drin!


-
@EM Wie oft muss man dir eigentlich einen Tipp geben damit du ihn wahrnimmst? Ich hab dir schon oft geraten mit etwas leichtem anzufangen...

-
Zitat
wie baue ich das ein?
[autoit]
Indem du nicht eine einzige Veriable für die Geschwindigkeit hast, sondern mehrere ;).
Hier mal im PseudoCode$iX = 50 ;X Koordinate
[/autoit]
$iY = 50 ;Y Koordinate
$vX = 2 ;X Geschwindigkeit
$vY = 3 ;Y Geschwindigkeit
[autoit]
Und dann machst du bei jedem Schleifendurchgang (Frame) das hier:$iX += $vX
[/autoit]
$iY += $vY
[autoit]
Wenn du jetzt feststellst, dass der Ball eine bestimmte Grenze überschritten hat z.B. so:If $iX >= 350 Then
[/autoit]
[autoit]
Führst du eine Multiplikation mit -1 durch.$iX *= -1
[/autoit]
Ist doch nicht so schwer...