1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. name22

Beiträge von name22

  • Dll Inject frage..

    • name22
    • 14. Mai 2010 um 00:13

    Hat das wieder etwas mit deinem NosBot zu tun? :rolleyes:
    Das wäre jetzt das 4te Mal, dass wir dich auf die Forenregeln hinweisen....

  • GDI+ "Springy"

    • name22
    • 13. Mai 2010 um 23:27
    Zitat

    wow es braucht keine gdip.au3 :D


    Ich hab mich zurückgehalten... :P

  • GDI+ "Springy"

    • name22
    • 13. Mai 2010 um 23:23

    Ich bin mir nicht ganz sicher was das sein könnte (daher auch der seltsame Name), aber es ist irgendwie ganz lustig. :D
    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. :thumbup:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <Misc.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    $iGUIColorBG = 0xFFFFFFFF
    $iGUIWidth = 400
    $iGUIHeight = 400

    [/autoit] [autoit][/autoit] [autoit]

    $hWndMain = GUICreate("Springy by name22 (autoit.de)", $iGUIWidth, $iGUIHeight)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    $hWndSettings = GUICreate("Einstellungen", 190, 180, 192, 124)
    $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)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWndMain)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iGUIWidth, $iGUIHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)

    [/autoit] [autoit][/autoit] [autoit]

    $hFormatNumber = _GDIPlus_StringFormatCreate()
    $hFamilyNumbers = _GDIPlus_FontFamilyCreate("Arial")
    $hFontNumbers = _GDIPlus_FontCreate($hFamilyNumbers, 14)

    [/autoit] [autoit][/autoit] [autoit]

    $hBrushNumbers = _GDIPlus_BrushCreateSolid(0xFF000000)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hWndMain)
    GUISetOnEvent($GUI_EVENT_RESTORE, "WM_PAINT", $hWndMain)

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($WM_PAINT, "WM_PAINT")

    [/autoit] [autoit][/autoit] [autoit]

    $iX = 200
    $iY = 200
    $vX = 0
    $vY = 0
    $Resistance = 0.93

    [/autoit] [autoit][/autoit] [autoit]

    If FileExists(@ScriptDir & "\Data") Then
    $aSpringCoords = _LoadFromFile()
    Else
    Global $aSpringCoords[11][5]
    $aSpringCoords[0][0] = 10

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aSpringCoords[0][0]
    $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
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet("^s", "_ShowSettings")

    [/autoit] [autoit][/autoit] [autoit]

    While Sleep(10)
    $iX += $vX
    $iY += $vY
    $vX *= $Resistance
    $vY *= $Resistance

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsClear($hBuffer, $iGUIColorBG)

    [/autoit] [autoit][/autoit] [autoit]

    $aMousePos = GUIGetCursorInfo($hWndMain)
    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

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsFillEllipse($hBuffer, $iX - 20, $iY - 20, 40, 40)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGUIWidth, $iGUIHeight)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _ShowSettings()
    Opt("GUIOnEventMode", 0)
    GUISetState(@SW_SHOW, $hWndSettings)
    $iSpringNrTmp = 1

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    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 ;==>_ShowSettings

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_PAINT()
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGUIWidth, $iGUIHeight)
    EndFunc ;==>WM_PAINT

    [/autoit] [autoit][/autoit] [autoit]

    Func _LoadFromFile()
    $sText = FileRead(@ScriptDir & "\Data")
    $aSplitTmp = StringSplit($sText, "|")

    [/autoit] [autoit][/autoit] [autoit]

    Local $aReturn[$aSplitTmp[0] + 1][5]
    $aReturn[0][0] = $aSplitTmp[0]

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aSplitTmp[0]
    $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 ;==>_LoadFromFile

    [/autoit] [autoit][/autoit] [autoit]

    Func _SaveToFile()
    $sString = ""

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aSpringCoords[0][0]
    $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)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _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

    [/autoit]

    Dateien

    GDI+ Springy.au3 7,25 kB – 341 Downloads
  • Win DO

    • name22
    • 13. Mai 2010 um 21:51

    Das ist wirklich eine prima Idee, nur habe ich gerade recht viel zu tun. ;)
    Dieser Thread hilft dir mit Sicherheit weiter. :thumbup:
    Falls du es nicht kannst und sonst niemand Lust hat musst du warten bis ich Zeit habe :P.

  • GDI+ Partikelexplosion

    • name22
    • 13. Mai 2010 um 18:20
    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.

  • GDI+ Bild-dreh UDF

    • name22
    • 13. Mai 2010 um 17:29

    Ich hab auch mal sowas gemacht :). (Damals kannte ich die GDIP.au3 noch nicht)

    Spoiler anzeigen
    [autoit]

    Func _GDIPlus_RotateImage($hImage, $iAngle = 0)
    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)

    [/autoit] [autoit][/autoit] [autoit]

    Local $hRotateMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hRotateMatrix, $iWidth / 2, $iHeight / 2)
    _GDIPlus_MatrixRotate($hRotateMatrix, $iAngle)
    _GDIPlus_GraphicsSetTransform($hBitmapGraphicsTmp, $hRotateMatrix)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawImageRect($hBitmapGraphicsTmp, $hImage, - $iWidth / 2, - $iHeight / 2, $iWidth, $iHeight)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDispose($hImageGraphicsTmp)
    _GDIPlus_GraphicsDispose($hBitmapGraphicsTmp)
    _GDIPlus_ImageDispose($hImage)

    [/autoit] [autoit][/autoit] [autoit]

    Return $hBitmapReturn
    EndFunc

    [/autoit]


    Allerdings finde ich es besser, die Rotationsmatrix direkt auf die Grafik anzuwenden in die man das Bild zeichnen möchte. :D
    Aber für Anfänger Top! :thumbup:

  • Liste erstellen

    • name22
    • 13. Mai 2010 um 16:08
    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>
    Dim $liste[5] = [1,2,"test",5,"test2"]
    _ArrayDisplay($liste)

    [/autoit]


    Das was du willst geht entweder über _ArrayAdd oder mit StringSplit.

  • Besteht Verbindung?

    • name22
    • 13. Mai 2010 um 15:33
    Zitat

    Die verbindung geht manchmal verloren


    Dann sag doch bitte mal woran man das erkennen kann. :rolleyes:
    Sonst können wir auch nur raten.

  • Liste mit offenen Fenstern in einer GUI anzeigen

    • name22
    • 13. Mai 2010 um 15:26

    So was meinst du? Muss natürlich optimiert werden ;).

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd = GUICreate("Test", 400, 400)
    $cList = GUICtrlCreateList("", 0, 0, 340, 400)
    $cButtonMin = GUICtrlCreateButton("Minimieren", 345, 10, 50, 25)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    $aWinList = WinList()

    [/autoit] [autoit][/autoit] [autoit]

    $sStringTmp = ""

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aWinList[0][0]
    If $aWinList[$i][0] <> "" Then $sStringTmp &= $aWinList[$i][0] & "|"
    Next

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetData($cList, $sStringTmp)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit
    Case $cButtonMin
    WinSetState(GUICtrlRead($cList), "", @SW_MINIMIZE)
    EndSwitch
    WEnd

    [/autoit]
  • Liste erstellen

    • name22
    • 13. Mai 2010 um 15:15

    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 ;).

  • GDI+ Partikelexplosion

    • name22
    • 13. Mai 2010 um 15:11
    Zitat

    Man könnte auch Mathe verwenden, dadurch wäre es dann noch schneller :P


    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.

  • GDI+ Kometenschweif

    • name22
    • 13. Mai 2010 um 15:07
    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. :S

  • GDI+ Partikelexplosion

    • name22
    • 13. Mai 2010 um 15:03
    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. :S
    Man muss auf jeden Fall ein bisschen Tricksen. :D
    Dein Script sieht auch cool aus. :thumbup: Und ist dank fehlender Rotation um einiges schneller als meins. :(

  • GDI+ Kometenschweif

    • name22
    • 13. Mai 2010 um 15:01

    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... :huh:

  • GDI+ Partikelexplosion

    • name22
    • 13. Mai 2010 um 01:44
    Zitat

    i wie kommts mir so vor als ob du die ganze gdip.au3 einmal durchmachst :D


    :whistling: ...
    Da wäre ich eine ganze Zeit lang beschäftigt. ^^

  • GDI+ Partikelexplosion

    • name22
    • 13. Mai 2010 um 01:01

    Schon mal vorab: Es ist nichts besonderes! Und ich habe nicht vor das irgendwie weiter zu verbessern. :P
    Dennoch hoffe ich es bringt irgendjemandem etwas. :D
    Am Anfang des Scripts sind ein paar Variablen für die Einstellungen. Viel Spaß.

    Spoiler anzeigen
    [autoit]

    #include <GDIP.au3>
    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $iParticleCount = 40 ;Anzahl der Partikel (bitte nicht übertreiben ;))
    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)

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd = GUICreate("Particles", 400, 400)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics(400, 400, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)

    [/autoit] [autoit][/autoit] [autoit]

    Global $aMousePos[2]
    $aMousePos[0] = 200
    $aMousePos[1] = 200

    [/autoit] [autoit][/autoit] [autoit]

    Global $aParticles[$iParticleCount + 1][8]
    $aParticles[0][0] = $iParticleCount

    [/autoit] [autoit][/autoit] [autoit]

    $hBrush_Explosion = _GDIPlus_PathBrushCreatePie(-25, -25, 50, 50, 0, 361, 0xFFFF0F00, 0x00000000)

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aParticles[0][0]
    $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)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_Restart")

    [/autoit] [autoit][/autoit] [autoit]

    $iTimerExplosion = TimerInit()

    [/autoit] [autoit][/autoit] [autoit]

    While Sleep(20)
    _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)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _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 ;==>_Exit

    [/autoit] [autoit][/autoit] [autoit]

    Func _Restart()
    $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 ;==>_Restart

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_GraphicsFillRectWithAngle($hGraphics, $iX, $iY, $iWidth, $iHeight, $iAngle, $hBrush = 0)
    _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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; 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) / 180

    [/autoit] [autoit][/autoit] [autoit]

    If $iStartAngle <= 0 Then $iStartAngle = 1
    If $iSweepAngle = 0 Then Return SetError(1, 0, -1)
    If $iSweepAngle < 0 Then
    $iSweepAngle *= -1
    $iStartAngle = 360 - $iSweepAngle + $iStartAngle
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Dim $aPoints_Path[$iSweepAngle + 2][2]
    $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 / 2

    [/autoit] [autoit][/autoit] [autoit]

    Dim $aColors_Path[$iSweepAngle + 1]
    $aColors_Path[0] = $iSweepAngle
    $iI = 1
    For $i = $iStartAngle To $iStartAngle + $iSweepAngle - 1
    $aColors_Path[$iI] = $ARGB_Surround
    $iI += 1
    Next

    [/autoit] [autoit][/autoit] [autoit]

    $hBrush_Pie = _GDIPlus_PathBrushCreate($aPoints_Path, $iWrapMode)
    _GDIPlus_PathBrushSetCenterPoint($hBrush_Pie, $iX + $iWidth / 2, $iY + $iHeight / 2)
    _GDIPlus_PathBrushSetCenterColor($hBrush_Pie, $ARGB_Center)
    _GDIPlus_PathBrushSetSurroundColorsWithCount($hBrush_Pie, $aColors_Path)

    [/autoit] [autoit][/autoit] [autoit]

    Return $hBrush_Pie
    EndFunc ;==>_GDIPlus_PathBrushCreatePie

    [/autoit]


    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 ;).

    Dateien

    Particle Explosion + GDIP.zip 97,41 kB – 372 Downloads Particle Explosion (SCR).au3 10,1 kB – 345 Downloads
  • GDI+ Kometenschweif

    • name22
    • 12. Mai 2010 um 22:45

    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. ;)

  • Doodle Jump für Pc

    • name22
    • 12. Mai 2010 um 22:13

    Wuuhuu ich stehe mit drin! 8):D

  • Letzte Erinnerung - Die Rache der verlorenen Seelen [2D-RPG]

    • name22
    • 12. Mai 2010 um 21:44

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

  • GDI+ Kometenschweif

    • name22
    • 12. Mai 2010 um 21:35
    Zitat

    wie baue ich das ein?


    Indem du nicht eine einzige Veriable für die Geschwindigkeit hast, sondern mehrere ;).
    Hier mal im PseudoCode

    [autoit]

    $iX = 50 ;X Koordinate
    $iY = 50 ;Y Koordinate
    $vX = 2 ;X Geschwindigkeit
    $vY = 3 ;Y Geschwindigkeit

    [/autoit]


    Und dann machst du bei jedem Schleifendurchgang (Frame) das hier:

    [autoit]

    $iX += $vX
    $iY += $vY

    [/autoit]


    Wenn du jetzt feststellst, dass der Ball eine bestimmte Grenze überschritten hat z.B. so:

    [autoit]

    If $iX >= 350 Then

    [/autoit]


    Führst du eine Multiplikation mit -1 durch.

    [autoit]

    $iX *= -1

    [/autoit]


    Ist doch nicht so schwer... :P

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™