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

  • script bei mehreren fenstern

    • name22
    • 8. April 2010 um 20:08

    Das Bild wird nur ein mal angezeigt weil SplashImage nur ein mal aktiv sein kann. ;)
    Du müsstest eine andere Anzeigemethode wählen, wenn du das Bild in mehreren Fenstern sehen willst.
    z.B. Ein Fenster mit dem Stil $WS_POPUP, was einem SplashImage schon recht nahe kommt denke ich.

  • GDI+ Bildschirmschoner o.Ä.

    • name22
    • 8. April 2010 um 20:03

    Hier ist ein ganz einfaches GDI+ Script, welches einem Bildschrimschoner ähnelt...
    Ich habe die benötigte Schriftart mit der MemFont Methode ins Script gepackt.
    Hoffe es gefällt euch... ;)

    Ich musste das Script wegen der über 1MB großen Schriftart in ein zip packen. 8|

    Edit: Da das Script über 100000 Zeichen lang ist konnte ich es natürlich hier nicht spoilern. :D
    Edit2: Ich habe nun Ubuntus Version als Screensaver noch mit angehängt, wer ihn installieren will muss einfach nur das Script kompilieren und in .scr umbenennen ;).
    Edit3: Das Script lädt nun die mit ";" getrennten Wörter/Sätze aus einer Datei im Scriptverzeichnis und zeigt sie in zufälliger Reihenfolge an. 8)

  • Doodle Jump für Pc

    • name22
    • 8. April 2010 um 19:24

    So eine Explosion? Oder größer als die Platten selbst?

    Bilder

    • Explosion.png
      • 1,85 kB
      • 57 × 15
  • Captcha Competition Ostern bis Mitte April

    • name22
    • 8. April 2010 um 19:11

    Ich auch. Wenn du das selbst gemacht hast bin ich wirklich tief beeindruckt. :thumbup:

  • .txt per Script bearbeiten

    • name22
    • 8. April 2010 um 18:28
    Zitat

    immer wenn ich ini's verwende geht irgentwas schief


    Scheinbar brauchen wir jetzt auch noch ein gutes Ini Tutorial... :rolleyes::D
    Was meinst du denn mit "Etwas geht schief"? Vielleicht ist es ja etwas ganz banales bei dem man dir sofort helfen kann. :D

  • Bild bewegen

    • name22
    • 8. April 2010 um 18:25
    Zitat

    Danke, das funktioniert, nur wenn ich 1 töte, dann töte ich alle ausser 1 ^^


    Das hängt mit deinem Array zusammen ich hab im Moment leider keine Zeit mich damit zubeschäftigen. :(
    Schau dir mal an wie das 2 dimensionale Array von den Schüssen verwendet wird. ;)

  • Doodle Jump für Pc

    • name22
    • 8. April 2010 um 18:23

    Horizontal? Oh ich hab mich schon wieder verschrieben. :rofl:
    Ich meinte, dass bei den sich vertikal verschiebenden Platten der Doodle manchmal ein bisschen Höhenversetzt abspringt.

  • Doodle Jump für Pc

    • name22
    • 8. April 2010 um 18:14

    Die neue Version funktioniert bis auf die Horizontalen Platten echt Prima.
    Ich bin von diesem Projekt echt beeindruckt. Das ist ein absolutes Aushängeschild für AutoIt Spiele :thumbup:
    Das Spiel ist ja schon eine richtige Herausforderung geworden. :D

  • Label as Link

    • name22
    • 8. April 2010 um 17:59

    Das ist das gleiche was wir 3 vor dir schon geschrieben haben... :rolleyes:

  • Label as Link

    • name22
    • 8. April 2010 um 17:39

    So?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

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

    $Form1 = GUICreate("Form1", 165, 81, 192, 124)
    $Label1 = GUICtrlCreateLabel("AutoIt", 24, 8)
    $Label2 = GUICtrlCreateLabel("Google", 24, 32)
    $Label3 = GUICtrlCreateLabel("Youtube", 24, 56)
    GUISetState()

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Label1
    ShellExecute("http://www.autoit.de/")
    Case $Label2
    ShellExecute("http://www.google.de/")
    Case $Label3
    ShellExecute("http://www.youtube.com/")
    EndSwitch
    WEnd

    [/autoit]
  • Regexp Hidden Text

    • name22
    • 8. April 2010 um 17:23

    Wenn ich weiß wofür das ist helfe ich dir. :D
    1. Fehlt da ein EndIf.
    2. Macht man eine Zählschleife lieber mit For.
    3. Liess die Hilfe :P

  • Bild bewegen

    • name22
    • 8. April 2010 um 17:15

    Du könntest dir wenigstens ein bisschen mehr Mühe geben. :(
    Ich kann nicht ALLES für dich machen, es ist ja schließlich DEIN Projekt. :D

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <Misc.au3>
    #include <Array.au3>
    #include <GUIConstantsEx.au3>

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

    Opt("GUIOnEventMode", 1)

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

    $iGUIWidth = 400
    $iGUIHeight = 400
    $GUIColorBG = 0xFF000000

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

    $iShots = 0
    $iMaxShots = 5 + 1
    $iShotSpeed = 3
    $iCoolDownTime = 500
    $iTimerShot = $iCoolDownTime * - 1
    $iTimerGegner = TimerInit()

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

    $hU32DLL = DllOpen("User32.dll")

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

    $hWnd = GUICreate("Space Invaders", $iGUIWidth, $iGUIHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState()

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

    _GDIPlus_Startup()

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iGUIWidth, $iGUIHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)
    _GDIPlus_GraphicsClear($hGraphic, $GUIColorBG)

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

    $hImage_Enemy = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\gegner.jpg")
    $hImage_Ship = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Raumschiff.jpg")
    $hBrush_Shot = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)

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

    Dim $aGegner[2][2]
    For $i = 1 To 5
    _Array2DAdd($aGegner, 0 + (($i - 1) * 45) & "|" & 0)
    Next

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

    Dim $aShot[2][2]

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

    $iX_Ship = $iGUIWidth / 2 - 25
    $iY_Ship = $iGUIHeight - 30

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

    While 1
    If _IsPressed("27", $hU32DLL) And $iX_Ship < $iGUIWidth - 50 Then $iX_Ship += 2
    If _IsPressed("25", $hU32DLL) And $iX_Ship > 0 Then $iX_Ship -= 2
    If _IsPressed("20", $hU32DLL) And TimerDiff($iTimerShot) >= $iCoolDownTime And UBound($aShot) < $iMaxShots Then
    _Array2DAdd($aShot, $iX_Ship + 21 & "|" & $iY_Ship - 10)
    $iTimerShot = TimerInit()
    EndIf

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

    _GDIPlus_GraphicsClear($hBuffer, $GUIColorBG)
    For $i = 1 To UBound($aShot) - 1
    If $aShot[$i][1] <> "" Then
    _GDIPlus_GraphicsFillRect($hBuffer, $aShot[$i][0], $aShot[$i][1], 5, 10, $hBrush_Shot)
    $aShot[$i][1] -= $iShotSpeed
    EndIf
    Next
    For $i = 1 To UBound($aShot) - 1
    If $aShot[$i][1] <= 0 Then
    _Array2DDelete($aShot, $i)
    ExitLoop
    EndIf
    For $j = 2 To UBound($aGegner) - 1
    If $aShot[$i][1] <= $aGegner[$j][1] + 23 And $aShot[$i][0] >= $aGegner[$i][0] And $aShot[$i][0] <= $aGegner[$i][0] + 40 Then
    _Array2DDelete($aGegner, $j)
    ExitLoop
    EndIf
    Next
    Next
    If TimerDiff($iTimerGegner) >= 1000 Then
    For $i = 1 To UBound($aGegner) - 1
    If $aGegner[$i][0] + 40 >= $iGUIWidth Then
    $aGegner[$i][1] += 25
    $aGegner[$i][0] = 0
    Else
    $aGegner[$i][0] += 45
    EndIf
    Next
    $iTimerGegner = TimerInit()
    EndIf
    For $i = 1 To UBound($aGegner) - 1
    _GDIPlus_GraphicsDrawImageRect($hBuffer, $hImage_Enemy, $aGegner[$i][0], $aGegner[$i][1], 40, 23)
    Next
    _GDIPlus_GraphicsDrawImageRect($hBuffer, $hImage_Ship, $iX_Ship, $iY_Ship, 50, 30)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGUIWidth, $iGUIHeight)
    Sleep(20)
    WEnd

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

    Func _Exit()
    DllClose($hU32DLL)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_ImageDispose($hImage_Ship)
    _GDIPlus_BrushDispose($hBrush_Shot)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

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

    ;------------------------------------------------------------------------------------------------------------
    ;
    ; Function _Array2DAdd(ByRef $avArray, $sValue='')
    ;
    ; Description Redim Array Size and add an Array element at last position
    ; Works with any occurences in 2nd Dimension
    ; Works also with 1D-Array
    ;
    ; Parameter $avArray Given Array
    ; optional $sValue Value of new Element, parts must be seperate with '|'
    ;
    ; Return Succes -1
    ; Failure 0 and set @error
    ; @error = 1 given array is not array
    ; @error = 2 given parts of Element too less/much
    ;
    ; Author BugFix ([email='bugfix@autoit.de'][/email])
    ;------------------------------------------------------------------------------------------------------------
    Func _Array2DAdd(ByRef $avArray, $sValue = '')
    If (Not IsArray($avArray)) Then
    SetError(1)
    Return 0
    EndIf
    Local $i
    Local $UBound2nd = UBound($avArray, 2)
    If @error = 2 Then
    ReDim $avArray[UBound($avArray) + 1]
    $avArray[UBound($avArray) - 1] = $sValue
    Else
    Local $arValue
    ReDim $avArray[UBound($avArray) + 1][$UBound2nd]
    If $sValue = '' Then
    For $i = 0 To $UBound2nd - 2
    $sValue &= '|'
    Next
    EndIf
    $arValue = StringSplit($sValue, '|')
    If $arValue[0] <> $UBound2nd Then
    SetError(2)
    Return 0
    EndIf
    For $i = 0 To $UBound2nd - 1
    $avArray[UBound($avArray) - 1][$i] = $arValue[$i + 1]
    Next
    EndIf
    Return -1
    EndFunc ;==>_Array2DAdd

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

    ;----------------------------------------------------------------------------------------------------------------------
    ; Fuction _Array2DDelete(ByRef $ARRAY, $iDEL)
    ;
    ; Description Delete one row on a given index in an 1D/2D -Array
    ;
    ; Parameter $ARRAY the array, where one row will deleted
    ; $iDEL Row-Index to delete
    ;
    ; Return Succes -1 ByRef $ARRAY
    ; Failure 0 set @error = 1; given array are not array
    ; set @error = 2; index is out of range
    ;
    ; Author BugFix ([email='bugfix@autoit.de'][/email])
    ;----------------------------------------------------------------------------------------------------------------------
    Func _Array2DDelete(ByRef $ARRAY, $iDEL)
    If (Not IsArray($ARRAY)) Then
    SetError(1)
    Return 0
    EndIf
    If ($iDEL < 0) Or ($iDEL > UBound($ARRAY) - 1) Then
    SetError(2)
    Return 0
    EndIf
    Local $i, $k, $l
    Local $UBound2nd = UBound($ARRAY, 2)
    If @error = 2 Then
    Local $arTmp[UBound($ARRAY) - 1]
    $k = 0
    For $i = 0 To UBound($ARRAY) - 1
    If $i <> $iDEL Then
    $arTmp[$k] = $ARRAY[$i]
    $k += 1
    EndIf
    Next
    Else
    Local $arTmp[UBound($ARRAY) - 1][$UBound2nd]
    $k = 0
    For $i = 0 To UBound($ARRAY) - 1
    If $i <> $iDEL Then
    For $l = 0 To $UBound2nd - 1
    $arTmp[$k][$l] = $ARRAY[$i][$l]
    Next
    $k += 1
    EndIf
    Next
    EndIf
    $ARRAY = $arTmp
    Return -1
    EndFunc ;==>_Array2DDelete

    [/autoit]


    Müsste so funktionieren, ich hab's noch nicht wirklich getestet. :rolleyes:

  • Doodle Jump für Pc

    • name22
    • 8. April 2010 um 17:13

    Würdest du mir mal zuhören hättest du's hinbekommen :rofl: .
    Ich bin schon auf die nächste Version gespannt. :thumbup: Viel fehlt ja nicht bis zum Original. :D

  • Link senden ohne Rückmeldung

    • name22
    • 8. April 2010 um 16:22

    Den Botverdacht hatte ich nur weil ca. 5 Minuten vorher ein anderer Thread von Keane wegen einem Bot geclosed wurde.

  • Software sichern

    • name22
    • 8. April 2010 um 15:04
    Zitat

    Ich habe noch ein nettes Skript hier zu liegen ,das dein Programm schützen kann.


    Eben das ist aus oben genannten Gründen nicht möglich...
    Jeder "trottel" der einen Decompiler hat kann einfach deine exe zurück in ein Script verwandeln und diese Update Funktion entfernen.
    Oder er wartet einfach bis irgend ein anderer das gemacht hat und holt sich dann die Version ohne deinen Check. :P

    Ach ja, hier das Ergebnis der Forensuche. :rolleyes:

    MysticSun: Wieso stellst du denn dein Script nicht einfach hier rein?

  • Bild bewegen

    • name22
    • 8. April 2010 um 14:54

    Kann es sein, dass das ganze im OnEvent Mode besser ist? ?(

    Spoiler anzeigen
    [autoit]

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

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

    Opt("GUIOnEventMode", 1)

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

    $iGUIWidth = 400
    $iGUIHeight = 400
    $GUIColorBG = 0xFF000000

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

    $iShots = 0
    $iMaxShots = 5 + 1
    $iShotSpeed = 3
    $iCoolDownTime = 500
    $iTimerShot = $iCoolDownTime * - 1

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

    $hU32DLL = DllOpen("User32.dll")

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

    $hWnd = GUICreate("Space Invaders", $iGUIWidth, $iGUIHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState()

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

    _GDIPlus_Startup()

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iGUIWidth, $iGUIHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)
    _GDIPlus_GraphicsClear($hGraphic, $GUIColorBG)

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

    $hImage_Ship = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Raumschiff.jpg")
    $hBrush_Shot = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)

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

    Dim $aShot[2][2]

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

    $iX_Ship = $iGUIWidth / 2 - 25
    $iY_Ship = $iGUIHeight - 30

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

    While 1
    If _IsPressed("27", $hU32DLL) And $iX_Ship < $iGUIWidth - 50 Then $iX_Ship += 2
    If _IsPressed("25", $hU32DLL) And $iX_Ship > 0 Then $iX_Ship -= 2
    If _IsPressed("20", $hU32DLL) And TimerDiff($iTimerShot) >= $iCoolDownTime And UBound($aShot) < $iMaxShots Then
    _Array2DAdd($aShot, $iX_Ship + 23 & "|" & $iY_Ship - 10)
    $iTimerShot = TimerInit()
    EndIf

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

    _GDIPlus_GraphicsClear($hBuffer, $GUIColorBG)
    For $i = 1 To UBound($aShot) - 1
    If $aShot[$i][1] <> "" Then
    _GDIPlus_GraphicsFillRect($hBuffer, $aShot[$i][0], $aShot[$i][1], 5, 10, $hBrush_Shot)
    $aShot[$i][1] -= $iShotSpeed
    EndIf
    Next
    For $i = 1 To UBound($aShot) - 1
    If $aShot[$i][1] <= 0 Then
    _Array2DDelete($aShot, $i)
    ExitLoop
    EndIf
    Next
    _GDIPlus_GraphicsDrawImageRect($hBuffer, $hImage_Ship, $iX_Ship, $iY_Ship, 50, 30)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGUIWidth, $iGUIHeight)
    Sleep(20)
    WEnd

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

    Func _Exit()
    DllClose($hU32DLL)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_ImageDispose($hImage_Ship)
    _GDIPlus_BrushDispose($hBrush_Shot)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

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

    ;------------------------------------------------------------------------------------------------------------
    ;
    ; Function _Array2DAdd(ByRef $avArray, $sValue='')
    ;
    ; Description Redim Array Size and add an Array element at last position
    ; Works with any occurences in 2nd Dimension
    ; Works also with 1D-Array
    ;
    ; Parameter $avArray Given Array
    ; optional $sValue Value of new Element, parts must be seperate with '|'
    ;
    ; Return Succes -1
    ; Failure 0 and set @error
    ; @error = 1 given array is not array
    ; @error = 2 given parts of Element too less/much
    ;
    ; Author BugFix ([email='bugfix@autoit.de'][/email])
    ;------------------------------------------------------------------------------------------------------------
    Func _Array2DAdd(ByRef $avArray, $sValue = '')
    If (Not IsArray($avArray)) Then
    SetError(1)
    Return 0
    EndIf
    Local $i
    Local $UBound2nd = UBound($avArray, 2)
    If @error = 2 Then
    ReDim $avArray[UBound($avArray) + 1]
    $avArray[UBound($avArray) - 1] = $sValue
    Else
    Local $arValue
    ReDim $avArray[UBound($avArray) + 1][$UBound2nd]
    If $sValue = '' Then
    For $i = 0 To $UBound2nd - 2
    $sValue &= '|'
    Next
    EndIf
    $arValue = StringSplit($sValue, '|')
    If $arValue[0] <> $UBound2nd Then
    SetError(2)
    Return 0
    EndIf
    For $i = 0 To $UBound2nd - 1
    $avArray[UBound($avArray) - 1][$i] = $arValue[$i + 1]
    Next
    EndIf
    Return -1
    EndFunc ;==>_Array2DAdd

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

    ;----------------------------------------------------------------------------------------------------------------------
    ; Fuction _Array2DDelete(ByRef $ARRAY, $iDEL)
    ;
    ; Description Delete one row on a given index in an 1D/2D -Array
    ;
    ; Parameter $ARRAY the array, where one row will deleted
    ; $iDEL Row-Index to delete
    ;
    ; Return Succes -1 ByRef $ARRAY
    ; Failure 0 set @error = 1; given array are not array
    ; set @error = 2; index is out of range
    ;
    ; Author BugFix ([email='bugfix@autoit.de'][/email])
    ;----------------------------------------------------------------------------------------------------------------------
    Func _Array2DDelete(ByRef $ARRAY, $iDEL)
    If (Not IsArray($ARRAY)) Then
    SetError(1)
    Return 0
    EndIf
    If ($iDEL < 0) Or ($iDEL > UBound($ARRAY) - 1) Then
    SetError(2)
    Return 0
    EndIf
    Local $i, $k, $l
    Local $UBound2nd = UBound($ARRAY, 2)
    If @error = 2 Then
    Local $arTmp[UBound($ARRAY) - 1]
    $k = 0
    For $i = 0 To UBound($ARRAY) - 1
    If $i <> $iDEL Then
    $arTmp[$k] = $ARRAY[$i]
    $k += 1
    EndIf
    Next
    Else
    Local $arTmp[UBound($ARRAY) - 1][$UBound2nd]
    $k = 0
    For $i = 0 To UBound($ARRAY) - 1
    If $i <> $iDEL Then
    For $l = 0 To $UBound2nd - 1
    $arTmp[$k][$l] = $ARRAY[$i][$l]
    Next
    $k += 1
    EndIf
    Next
    EndIf
    $ARRAY = $arTmp
    Return -1
    EndFunc ;==>_Array2DDelete

    [/autoit]
  • Software sichern

    • name22
    • 8. April 2010 um 14:46

    So einen Thread gab es hier schon mal. Einfach die Forensuche nutzen.
    Abgesehen davon ist es dank Decompilern fast unmöglich seine Scripts irgendwie zu schützen. :S

  • Bild bewegen

    • name22
    • 8. April 2010 um 14:30

    UEZ meinst du nicht das ist ein wenig zu viel auf einmal für einen GDI+ Anfänger. 8|
    Obwohl es natürlich die absolute Musterlösung eines AutoIt Spiels darstellt. :D

  • Bild in GUI darstellen und Farbe ersetzen

    • name22
    • 8. April 2010 um 14:28

    Ein kleines Beispiel? Ich versuch's. ^^

    Spoiler anzeigen
    [autoit]

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

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

    _GDIPlus_Startup()

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

    $hBitmap = _GDIPlus_BitmapCreateFromFile(FileOpenDialog("Bild auswählen", @ScriptDir, "Bilder (*.jpg;*.png;*.bmp)", 3))
    $iWidth = _GDIPlus_ImageGetWidth($hBitmap)
    $iHeight = _GDIPlus_ImageGetHeight($hBitmap)

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

    MsgBox(64, "Farbe", "Zu suchende Farbe auswählen")
    $iSearchColor = StringTrimLeft(_ChooseColor(2), 2)
    MsgBox(64, "Farbe", "Füllfarbe auswählen")
    $iFillColor = StringTrimLeft(_ChooseColor(2), 2)

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

    For $iY = 0 To $iHeight
    For $iX = 0 To $iWidth
    If _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) = "0xFF" & $iSearchColor Then _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, "0xFF" & $iFillColor)
    Next
    Next

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

    _GDIPlus_ImageSaveToFile($hBitmap, FileSaveDialog("Bild speichern unter", @ScriptDir, "(*.png)", 18) & ".png")

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_BitmapGetPixel
    ; Description ...: Gets the color of a specified pixel in this bitmap
    ; Syntax.........: _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY)
    ; Parameters ....: $hBitmap - Pointer to the Bitmap object
    ; $iX - The X coordinate of the pixel
    ; $iY - The Y coordinate of the pixel
    ; Return values .: Success - Returns the pixel color of the bitmap
    ; Failure - 0 and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: None
    ; Related .......: _GDIPlus_BitmapSetPixel
    ; Link ..........; @@MsdnLink@@ GdipBitmapGetPixel
    ; Example .......; Yes
    ; ===============================================================================================================================
    Func _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapGetPixel", "hwnd", $hBitmap, "int", $iX, "int", $iY, "uint*", 0)

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

    If @error Then Return SetError(@error, @extended, 0)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[4]
    EndFunc ;==>_GDIPlus_BitmapGetPixel

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_BitmapSetPixel
    ; Description ...: Sets the color of a specified pixel in this bitmap
    ; Syntax.........: _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, $iARGB)
    ; Parameters ....: $hBitmap - Pointer to the Bitmap object
    ; $iX - The X coordinate of the pixel
    ; $iY - The Y coordinate of the pixel
    ; $iARGB - The new color of the pixel
    ; Return values .: Success - True
    ; Failure - False and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: None
    ; Related .......: _GDIPlus_BitmapGetPixel
    ; Link ..........; @@MsdnLink@@ GdipBitmapSetPixel
    ; Example .......; Yes
    ; ===============================================================================================================================
    Func _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, $iARGB)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapSetPixel", "hwnd", $hBitmap, "int", $iX, "int", $iY, "uint", $iARGB)

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

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_BitmapSetPixel

    [/autoit]
  • Bild bewegen

    • name22
    • 8. April 2010 um 13:51

    Ich hatte nur die zwei If Abfragen bei _IsPressed vertauscht :D
    So stimmt es und man kann nicht zur Seite raus:

    Spoiler anzeigen
    [autoit]

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

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

    $iGUIWidth = 400
    $iGUIHeight = 400
    $GUIColorBG = 0xFF000000

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

    $iShots = 0
    $iMaxShots = 5
    $iShotSpeed = 5
    $iCoolDownTime = 500
    $iTimerShot = $iCoolDownTime * - 1

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

    $hWnd = GUICreate("Test", $iGUIWidth, $iGUIHeight)
    GUISetState()

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

    _GDIPlus_Startup()

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iGUIWidth, $iGUIHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)
    _GDIPlus_GraphicsClear($hGraphic, $GUIColorBG)

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

    $hImage_Ship = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Raumschiff.jpg")
    $hBrush_Shot = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)

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

    Dim $aShot[2][2]

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

    $iX_Ship = $iGUIWidth / 2 - 25
    $iY_Ship = $iGUIHeight - 30

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

    AdlibRegister("_ReDraw", 20)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    AdlibUnRegister()
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_ImageDispose($hImage_Ship)
    _GDIPlus_BrushDispose($hBrush_Shot)
    _GDIPlus_Shutdown()
    Exit
    EndSwitch
    WEnd

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

    Func _ReDraw()
    If _IsPressed("27") And $iX_Ship < $iGUIWidth - 50 Then $iX_Ship += 2
    If _IsPressed("25") And $iX_Ship > 0 Then $iX_Ship -= 2
    If _IsPressed("20") And TimerDiff($iTimerShot) >= $iCoolDownTime And UBound($aShot) < $iMaxShots Then
    _Array2DAdd($aShot, $iX_Ship + 23 & "|" & $iY_Ship - 10)
    $iTimerShot = TimerInit()
    EndIf

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

    _GDIPlus_GraphicsClear($hBuffer, $GUIColorBG)
    For $i = 1 To UBound($aShot) - 1
    If $aShot[$i][1] <> "" Then
    _GDIPlus_GraphicsFillRect($hBuffer, $aShot[$i][0], $aShot[$i][1], 5, 10, $hBrush_Shot)
    $aShot[$i][1] -= $iShotSpeed
    EndIf
    Next
    For $i = 1 To UBound($aShot) - 1
    If $aShot[$i][1] <= 0 Then
    _Array2DDelete($aShot, $i)
    ExitLoop
    EndIf
    Next
    _GDIPlus_GraphicsDrawImageRect($hBuffer, $hImage_Ship, $iX_Ship, $iY_Ship, 50, 30)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGUIWidth, $iGUIHeight)
    EndFunc ;==>_ReDraw

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

    ;------------------------------------------------------------------------------------------------------------
    ;
    ; Function _Array2DAdd(ByRef $avArray, $sValue='')
    ;
    ; Description Redim Array Size and add an Array element at last position
    ; Works with any occurences in 2nd Dimension
    ; Works also with 1D-Array
    ;
    ; Parameter $avArray Given Array
    ; optional $sValue Value of new Element, parts must be seperate with '|'
    ;
    ; Return Succes -1
    ; Failure 0 and set @error
    ; @error = 1 given array is not array
    ; @error = 2 given parts of Element too less/much
    ;
    ; Author BugFix ([email='bugfix@autoit.de'][/email])
    ;------------------------------------------------------------------------------------------------------------
    Func _Array2DAdd(ByRef $avArray, $sValue='')
    If ( Not IsArray($avArray) ) Then
    SetError(1)
    Return 0
    EndIf
    Local $i
    Local $UBound2nd = UBound($avArray,2)
    If @error = 2 Then
    ReDim $avArray[UBound($avArray)+1]
    $avArray[UBound($avArray)-1] = $sValue
    Else
    Local $arValue
    ReDim $avArray[UBound($avArray)+1][$UBound2nd]
    If $sValue = '' Then
    For $i = 0 To $UBound2nd-2
    $sValue &= '|'
    Next
    EndIf
    $arValue = StringSplit($sValue, '|')
    If $arValue[0] <> $UBound2nd Then
    SetError(2)
    Return 0
    EndIf
    For $i = 0 To $UBound2nd-1
    $avArray[UBound($avArray)-1][$i] = $arValue[$i+1]
    Next
    EndIf
    Return -1
    EndFunc ;==>_Array2DAdd

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

    ;----------------------------------------------------------------------------------------------------------------------
    ; Fuction _Array2DDelete(ByRef $ARRAY, $iDEL)
    ;
    ; Description Delete one row on a given index in an 1D/2D -Array
    ;
    ; Parameter $ARRAY the array, where one row will deleted
    ; $iDEL Row-Index to delete
    ;
    ; Return Succes -1 ByRef $ARRAY
    ; Failure 0 set @error = 1; given array are not array
    ; set @error = 2; index is out of range
    ;
    ; Author BugFix ([email='bugfix@autoit.de'][/email])
    ;----------------------------------------------------------------------------------------------------------------------
    Func _Array2DDelete(ByRef $ARRAY, $iDEL)
    If ( Not IsArray($ARRAY) ) Then
    SetError(1)
    Return 0
    EndIf
    If ( $iDEL < 0 ) Or ( $iDEL > UBound($ARRAY)-1 ) Then
    SetError(2)
    Return 0
    EndIf
    Local $i, $k, $l
    Local $UBound2nd = UBound($ARRAY,2)
    If @error = 2 Then
    Local $arTmp[UBound($ARRAY)-1]
    $k = 0
    For $i = 0 To UBound($ARRAY)-1
    If $i <> $iDEL Then
    $arTmp[$k] = $ARRAY[$i]
    $k += 1
    EndIf
    Next
    Else
    Local $arTmp[UBound($ARRAY)-1][$UBound2nd]
    $k = 0
    For $i = 0 To UBound($ARRAY)-1
    If $i <> $iDEL Then
    For $l = 0 To $UBound2nd-1
    $arTmp[$k][$l] = $ARRAY[$i][$l]
    Next
    $k += 1
    EndIf
    Next
    EndIf
    $ARRAY = $arTmp
    Return -1
    EndFunc ;==>_Array2DDelete

    [/autoit]

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™