Es gibt gute Gründe für die zahlreichen negativen BF 3 Kritiken wie man sieht ;). Electronic Arts hat sich mal wieder selbst übertroffen.
Beiträge von name22
-
-
-
Du hast es also bereits getestet, aber es funktioniert nicht so wie du es dir vorstellst? Wie sahen denn deine bisherigen Versuche aus?
-
Was soll denn eine Server2Server Verbindung sein? Die Verbindungsanfrage kommt immer nur von einer Seite, also muss es immer einen Client und einen Server geben.
Und eine Server-Client Verbindung zwischen zwei Rechnern die beide auch Server sind funktioniert genauso wie eine "normale".
Vielleicht solltest du genauer erläutern welcher Funktion das ganze dient und was diese Server überhaupt machen sollen.
-
1. Du kannst deinen Beitrag übersichtlicher Gestalten, indem du deinen Code in AutoIt und/oder Spoiler Tags setzt.
[autoit]
2. Entferne mal alle eckigen Klammern aus deinem Aufruf von GUICreate, die Parameter nach "300" kannst du auch weglassen, weil du sie ja nicht verwendest.
Ergebnis:GUICreate("Bruch&Dalles Player", 400, 300)
[/autoit]
3. Das sind die größten Fehler in deinem Script, aber längst nicht alle. Ich würde dir empfehlen mal die Links in der Box "Wichtige Links" (am linken Seitenrand) durchzugehen. Dort findest du ein Tutorial, und ein Onlinebuch für Anfänger. -
-
Wie es der Zufall so will, hab ich so etwas schon mal geschrieben. Allerdings hab ich irgendwann damit herumexperimentiert und dabei das Script auf den Kopf gestellt. Hat mich einige Zeit gekostet es wieder zum Laufen zu bringen.
Spoiler anzeigen
[autoit]#include <WindowsConstants.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>; -Author: name22 (http://www.autoit.de)
[/autoit] [autoit][/autoit] [autoit]Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $hWnd, $hDC_Window, $hDC_Bitmap, $hDC_Background, $hBitmap, $hBitmap_BG, $hImage_BG, $hOldObj, $hOldObj2, $hGraphics, $hPath_Hole, $sFile_BG
[/autoit] [autoit][/autoit] [autoit]$sFile_BG = FileOpenDialog("Image Selection", "", "Images (*.*)")
[/autoit] [autoit][/autoit] [autoit]
If @error Then ExitGlobal $iWidth = 400
[/autoit] [autoit][/autoit] [autoit]
Global $iHeight = 400
Global $iRadiusHole = 80$hWnd = GUICreate("name22 example", $iWidth, $iHeight)
[/autoit] [autoit][/autoit] [autoit]
GUISetState()$hDC_Window = _WinAPI_GetDC($hWnd)
[/autoit] [autoit][/autoit] [autoit]
$hDC_Bitmap = _WinAPI_CreateCompatibleDC($hDC_Window)
$hBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Window, $iWidth, $iHeight)
$hOldObj = _WinAPI_SelectObject($hDC_Bitmap, $hBitmap)_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Bitmap)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)$hImage_BG = _GDIPlus_ImageLoadFromFile($sFile_BG)
[/autoit] [autoit][/autoit] [autoit]
$hBitmap_BG = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage_BG)
_GDIPlus_ImageDispose($hImage_BG)$hDC_Background = _WinAPI_CreateCompatibleDC($hDC_Window)
[/autoit] [autoit][/autoit] [autoit]
$hOldObj2 = _WinAPI_SelectObject($hDC_Background, $hBitmap_BG)$hPath_Hole = _GDIPlus_PathCreate()
[/autoit] [autoit][/autoit] [autoit]OnAutoItExitRegister("_Shutdown")
[/autoit] [autoit][/autoit] [autoit]
GUISetOnEvent($GUI_EVENT_CLOSE, "_Close")While Sleep(20)
[/autoit] [autoit][/autoit] [autoit]
_WinAPI_BitBlt($hDC_Bitmap, 0, 0, $iWidth, $iHeight, $hDC_Background, 0, 0, $SRCCOPY)_GDIPlus_PathReset($hPath_Hole)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathAddEllipse($hPath_Hole, _WinAPI_GetMousePosX(True, $hWnd) - $iRadiusHole, _WinAPI_GetMousePosY(True, $hWnd) - $iRadiusHole, $iRadiusHole * 2, $iRadiusHole * 2)
_GDIPlus_GraphicsSetClipPath($hGraphics, $hPath_Hole, 4)
_GDIPlus_GraphicsClear($hGraphics)
_GDIPlus_GraphicsResetClip($hGraphics)_WinAPI_BitBlt($hDC_Window, 0, 0, $iWidth, $iHeight, $hDC_Bitmap, 0, 0, $SRCCOPY)
[/autoit] [autoit][/autoit] [autoit]
WEndFunc _Close()
[/autoit] [autoit][/autoit] [autoit]
Exit
EndFuncFunc _Shutdown()
[/autoit] [autoit][/autoit] [autoit]
_WinAPI_SelectObject($hDC_Bitmap, $hOldObj)
_WinAPI_SelectObject($hDC_Background, $hOldObj2)
_WinAPI_ReleaseDC($hWnd, $hDC_Window)
_WinAPI_DeleteDC($hDC_Bitmap)
_WinAPI_DeleteDC($hDC_Background)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteObject($hBitmap_BG)_GDIPlus_GraphicsDispose($hGraphics)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathDispose($hPath_Hole)
_GDIPlus_Shutdown()
EndFunc; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _GDIPlus_PathCreate
; Description ...: Creates a GraphicsPath object and initializes the fill mode
; Syntax.........: _GDIPlus_PathCreate([$iFillMode = 0])
; Parameters ....: $iFillMode - Fill mode of the interior of the path figures:
; |0 - The areas are filled according to the even-odd parity rule
; |1 - The areas are filled according to the nonzero winding rule
; Return values .: Success - Pointer to a new GraphicsPath object
; Failure - 0 and either:
; |@error and @extended are set if DllCall failed
; |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: After you are done with the object, call _GDIPlus_PathDispose to release the object resources
; Related .......: _GDIPlus_PathCreate2, _GDIPlus_PathDispose
; Link ..........; @@MsdnLink@@ GdipCreatePath
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_PathCreate($iFillMode = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", $iFillMode, "int*", 0)If @error Then Return SetError(@error, @extended, 0)
[/autoit] [autoit][/autoit] [autoit]
$GDIP_STATUS = $aResult[0]
Return $aResult[2]
EndFunc ;==>_GDIPlus_PathCreate; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _GDIPlus_PathDispose
; Description ...: Releases a GraphicsPath object
; Syntax.........: _GDIPlus_PathDispose($hPath)
; Parameters ....: $hPath - Pointer to a GraphicsPath object
; 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_PathCreate
; Link ..........; @@MsdnLink@@ GdipDeletePath
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_PathDispose($hPath)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath)If @error Then Return SetError(@error, @extended, False)
[/autoit] [autoit][/autoit] [autoit]
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_PathDispose; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _GDIPlus_PathAddEllipse
; Description ...: Adds an ellipse to the current figure a path
; Syntax.........: _GDIPlus_PathAddEllipse($hPath, $nX, $nY, $nWidth, $nHeight)
; Parameters ....: $hPath - Pointer to a GraphicsPath object
; $nX - The X coordinate of the upper left corner of the rectangle that bounds the ellipse
; $nY - The Y coordinate of the upper left corner of the rectangle that bounds the ellipse
; $nWidth - The width of the rectangle that bounds the ellipse
; $nHeight - The height of the rectangle that bounds the ellipse
; 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 .......: None
; Link ..........; @@MsdnLink@@ GdipAddPathEllipse
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_PathAddEllipse($hPath, $nX, $nY, $nWidth, $nHeight)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipAddPathEllipse", "hwnd", $hPath, "float", $nX, "float", $nY, "float", $nWidth, "float", $nHeight)If @error Then Return SetError(@error, @extended, False)
[/autoit] [autoit][/autoit] [autoit]
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_PathAddEllipse; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _GDIPlus_PathReset
; Description ...: Empties a path and sets the fill mode to alternate (0)
; Syntax.........: _GDIPlus_PathReset($hPath)
; Parameters ....: $hPath - Pointer to a GraphicsPath object
; 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 .......: None
; Link ..........; @@MsdnLink@@ GdipResetPath
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_PathReset($hPath)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipResetPath", "hwnd", $hPath)If @error Then Return SetError(@error, @extended, False)
[/autoit] [autoit][/autoit] [autoit]
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_PathReset; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _GDIPlus_GraphicsSetClipPath
; Description ...: Updates the clipping region of this Graphics object to a region that is the combination of itself and the
; +region specified by a graphics path
; Syntax.........: _GDIPlus_GraphicsSetClipPath($hGraphics, $hPath[, $iCombineMode = 0])
; Parameters ....: $hGraphics - Pointer to a Graphics object
; $hPath - Pointer to a GraphicsPath object that specifies the region to be combined with the clipping
; +region of the Graphics object
; $iCombineMode - Regions combination mode:
; |0 - The existing region is replaced by the new region
; |1 - The existing region is replaced by the intersection of itself and the new region
; |2 - The existing region is replaced by the union of itself and the new region
; |3 - The existing region is replaced by the result of performing an XOR on the two regions
; |4 - The existing region is replaced by the portion of itself that is outside of the new region
; |5 - The existing region is replaced by the portion of the new region that is outside of the existing region
; 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 .......: If a figure in the path is not closed, this method treats the nonclosed figure as if it were closed by a
; +straight line that connects the figure's starting and ending points
; Related .......: None
; Link ..........; @@MsdnLink@@ GdipSetClipPath
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_GraphicsSetClipPath($hGraphics, $hPath, $iCombineMode = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetClipPath", "hwnd", $hGraphics, "hwnd", $hPath, "int", $iCombineMode)If @error Then Return SetError(@error, @extended, False)
[/autoit] [autoit][/autoit] [autoit]
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_GraphicsSetClipPath; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _GDIPlus_GraphicsResetClip
; Description ...: Sets the clipping region of a Graphics object to an infinite region
; Syntax.........: _GDIPlus_GraphicsResetClip($hGraphics)
; Parameters ....: $hGraphics - Pointer to a Graphics object
; 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 .......: None
; Link ..........; @@MsdnLink@@ GdipResetClip
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_GraphicsResetClip($hGraphics)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipResetClip", "hwnd", $hGraphics)If @error Then Return SetError(@error, @extended, False)
[/autoit]
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_GraphicsResetClip
Das Script sieht vermutlich komplizierter aus, als es ist. Eigentlich muss man nur eine beliebige Form als Pfad-Objekt erstellen und damit per _GDIPlus_GraphicsSetClipPath den Bereich beschränken in dem gezeichnet werden darf. Wenn du nun eine Ellipse um den Mauszeiger als Form wählst, wird nur außerhalb (oder innerhalb, je nach Modus) dieser Ellipse gezeichnet. Ich habe Modus 5 genommen mit welchem alle folgenden Funktiopnen nur außerhalb der Ellipse zeichnen. Dann hab ich alles (außer der Ellipse ;)) schwarz gefärbt.
Man kann es auch andersrum machen und den Modus 0 verwenden. Dann wird innerhalb der Ellipse gezeichnet, und man kann dann einfach das gewollte Bild wie gewohnt auf die GUI zeichnen.
Falls du durch das (nicht sehr sauber geschriebene) Beispiel nicht durchblickst, dann sag Bescheid ^^. -
Alles Gute zum Geburtstag Sprenger
! Ich wünsch dir nen schönen Tag mit allem was zum feiern dazugehört ;). -
Zitat
Ich nutze einen Skin für den script (V-touch.skf) Kann es vielleicht daran liegen?
Möglicherweise. Probier es mal ohne Skin aus.ZitatUnd welches format müssen die Bilder haben? Habe Gif, png und Bmp probiert.
Du kannst alle genannten Formate verwenden. PNG ist aber natürlich das einzige, das (richige) Transparenz unterstützt. -
-
Suchst du zufällig etwas wie es in diesem Thread beschrieben wird? Diese Funktion könnte man auch leicht umbauen, so dass sie die Dateien direkt kopiert und nicht erst ein Array zurückgibt.
-
Das Bild ohne den GUI Hintergrund anzuzeigen geht mit mehrschichtigen Fenstern.
Spoiler anzeigen
[autoit]#include <WinAPI.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GDIPlus.au3>
#include <WindowsConstants.au3>HotKeySet("{ESC}", "_ExitView") ;Zum Verlassen des Bildes
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$tSize = DllStructCreate($tagSIZE)
[/autoit] [autoit][/autoit] [autoit]
$pSize = DllStructGetPtr($tSize)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", 255)
DllStructSetData($tBlend, "Format", 1)$hGUI = GUICreate("TestWindow", 200, 200)
[/autoit] [autoit][/autoit] [autoit]
$hDisplayImg1 = GUICtrlCreateButton("Bild 1", 0, 0, 200, 100)
$hDisplayImg2 = GUICtrlCreateButton("Bild 2", 0, 100, 200, 100)
GUISetState()Local $hPicGUI
[/autoit] [autoit][/autoit] [autoit]While True
[/autoit] [autoit][/autoit] [autoit]
$iMsg = GUIGetMsg()
Switch $iMsg
Case $hDisplayImg1
$hPicGUI = _DisplayPictureMid(@ScriptDir & "\files\image1.png")
Case $hDisplayImg2
$hPicGUI = _DisplayPictureMid(@ScriptDir & "\files\image1.png")
Case -3 ;GUI_EVENT_CLOSE
Exit
EndSwitch
WEndFunc _DisplayPictureMid($sPath)
[/autoit] [autoit][/autoit] [autoit]
$hImage = _GDIPlus_ImageLoadFromFile($sPath)
$iWidth = _GDIPlus_ImageGetWidth($hImage)
$iHeight = _GDIPlus_ImageGetHeight($hImage)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage, 0)DllStructSetData($tSize, "X", $iWidth)
[/autoit] [autoit][/autoit] [autoit]
DllStructSetData($tSize, "Y", $iHeight)$hGUI = GUICreate("", $iWidth, $iHeight, Default, Default, 0, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED, $WS_EX_TOOLWINDOW))
[/autoit] [autoit][/autoit] [autoit]
GUISetState()$hDC_Wnd = _WinAPI_GetDC($hGUI)
[/autoit] [autoit][/autoit] [autoit]
$hDC_Bmp = _WinAPI_CreateCompatibleDC($hDC_Wnd)
$hOldObj = _WinAPI_SelectObject($hDC_Bmp, $hBitmap)_WinAPI_UpdateLayeredWindow($hGUI, $hDC_Wnd, 0, $pSize, $hDC_Bmp, $pSource, 0, $pBlend, $ULW_ALPHA)
[/autoit] [autoit][/autoit] [autoit]_WinAPI_SelectObject($hDC_Bmp, $hOldObj)
[/autoit] [autoit][/autoit] [autoit]
_WinAPI_ReleaseDC($hGUI, $hDC_Wnd)
_WinAPI_DeleteDC($hDC_Bmp)
_WinAPI_DeleteObject($hBitmap)_GDIPlus_ImageDispose($hImage)
[/autoit] [autoit][/autoit] [autoit]Return $hGUI
[/autoit] [autoit][/autoit] [autoit]
EndFunc ;==>_DisplayPictureMidFunc _ExitView()
[/autoit]
GUIDelete($hPicGUI)
EndFunc ;==>_ExitView -
Du solltest allerdings vorher mit StringIsDigit überprüfen, ob der String auch wirklich eine Zahl ist. Sonst versucht AutoIt einen gewöhnlichen String wie "AutoIt" in eine Zahl umzuwandeln.
-
Zusammen mit deinem ersten Thread erscheint mir das doch sehr verdächtig. Wenn es sich nicht um einen Bot für "Die Stämme" handelt, was ist es denn dann?
-
Geht es denn hier überhaupt um den Wettbewerb? Ich lese nämlich nichts dergleichen in Facemixs Beiträgen.
Facemix Ich habe vor einiger Zeit mal versucht ein Script zu schreiben, bei dem Schneeflocken in einer GUI runtersegeln. Jetzt hab ich das ganze mal überarbeitet und ausgebaut. So siehst du zumindest wie man die Schneeflocken als eine Art Partikelsystem umsetzen kann.
Spoiler anzeigen
[autoit]#include <WindowsConstants.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>; -Author: name22 (http://www.autoit.de)
[/autoit] [autoit][/autoit] [autoit]Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global Const $nTau = ACos(-1) * 2
[/autoit] [autoit][/autoit] [autoit]Global $iWidth = 400
[/autoit] [autoit][/autoit] [autoit]
Global $iHeight = 400Global $iARGB_BG = 0xFF505050
[/autoit] [autoit][/autoit] [autoit]
Global $iARGB_Snow = 0xFFFFFFFFGlobal $iFlakeCount = 40
[/autoit] [autoit][/autoit] [autoit]
Global $iMinFallingSpeed = 0.5, $iMaxFallingSpeed = 2
Global $iMinOscillations = 2, $iMaxOscillations = 5
Global $iMinOscillationDist = 0.5, $iMaxOscillationDist = 2
Global $iMinRadius = 1, $iMaxRadius = 3Global $iBlastRadius = 100
[/autoit] [autoit][/autoit] [autoit]
Global $iBlastAccell = 10
Global $nAirFriction = 0.95Global $aFlakes[$iFlakeCount + 1][8] = [[$iFlakeCount]]
[/autoit] [autoit][/autoit] [autoit]
Global $hWnd, $hDC_Window, $hDC_Bitmap, $hBitmap, $hGraphics, $hOldObjFor $i = 1 To $aFlakes[0][0]
[/autoit] [autoit][/autoit] [autoit]
$aFlakes[$i][0] = Random(10, $iWidth - 10, 1)
$aFlakes[$i][1] = Random(-$iHeight, 0, 1)
$aFlakes[$i][2] = 0
$aFlakes[$i][3] = 0
$aFlakes[$i][4] = Random($iMinRadius, $iMaxRadius, 1)
$aFlakes[$i][5] = Random($iMinFallingSpeed, $iMaxFallingSpeed)
$aFlakes[$i][6] = Random($iMinOscillations, $iMaxOscillations, 1)
$aFlakes[$i][7] = Random($iMinOscillationDist, $iMaxOscillationDist) * (-1) ^ Random(1, 2, 1)
Next$hWnd = GUICreate("name22 - Snowflakes", $iWidth, $iHeight)
[/autoit] [autoit][/autoit] [autoit]
GUISetState()$hDC_Window = _WinAPI_GetDC($hWnd)
[/autoit] [autoit][/autoit] [autoit]
$hDC_Bitmap = _WinAPI_CreateCompatibleDC($hDC_Window)
$hBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Window, $iWidth, $iHeight)
$hOldObj = _WinAPI_SelectObject($hDC_Bitmap, $hBitmap)_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Bitmap)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)$hBrush_Snow = _GDIPlus_BrushCreateSolid($iARGB_Snow)
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_GraphicsClear($hGraphics, $iARGB_BG)
[/autoit] [autoit][/autoit] [autoit]
_Redraw()OnAutoItExitRegister("_Shutdown")
[/autoit] [autoit][/autoit] [autoit]
GUIRegisterMsg($WM_PAINT, "_Redraw")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Close")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_Click")While Sleep(12)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsClear($hGraphics, $iARGB_BG)
For $i = 1 To $aFlakes[0][0]
If $aFlakes[$i][1] + $aFlakes[$i][3] > $iHeight Or $aFlakes[$i][0] < -20 Or $aFlakes[$i][0] > $iWidth + 20 Then
$aFlakes[$i][0] = Random(10, $iWidth - 10, 1)
$aFlakes[$i][1] = Random(-$iHeight, 0, 1)
$aFlakes[$i][2] = 0
$aFlakes[$i][3] = 0
$aFlakes[$i][4] = Random($iMinRadius, $iMaxRadius, 1)
$aFlakes[$i][5] = Random($iMinFallingSpeed, $iMaxFallingSpeed)
$aFlakes[$i][6] = Random($iMinOscillations, $iMaxOscillations, 1)
$aFlakes[$i][7] = Random($iMinOscillationDist, $iMaxOscillationDist)
EndIf
$aFlakes[$i][1] += $aFlakes[$i][5] + $aFlakes[$i][3]
$aFlakes[$i][0] += Sin($aFlakes[$i][1] / $iHeight * $nTau * $aFlakes[$i][6]) * $aFlakes[$i][7] + $aFlakes[$i][2]
$aFlakes[$i][2] *= $nAirFriction
$aFlakes[$i][3] *= $nAirFriction
_GDIPlus_GraphicsFillEllipse($hGraphics, $aFlakes[$i][0] - $aFlakes[$i][4] / 2, $aFlakes[$i][1] - $aFlakes[$i][4] / 2, $aFlakes[$i][4] * 2, $aFlakes[$i][4] * 2, $hBrush_Snow)
Next
_WinAPI_BitBlt($hDC_Window, 0, 0, $iWidth, $iHeight, $hDC_Bitmap, 0, 0, $SRCCOPY)
WEndFunc _Click()
[/autoit] [autoit][/autoit] [autoit]
Local $tMousePos = _WinAPI_GetMousePos(True, $hWnd)
For $i = 1 To $aFlakes[0][0]
$iX_Dist = ($aFlakes[$i][0] - $aFlakes[$i][4]) - DllStructGetData($tMousePos, "X")
$iY_Dist = ($aFlakes[$i][1] - $aFlakes[$i][4]) - DllStructGetData($tMousePos, "Y")
$iDist = Sqrt($iX_Dist ^ 2 + $iY_Dist ^ 2)
If $iDist = 0 Then ContinueLoop
If $iDist < $iBlastRadius Then
$aFlakes[$i][2] = (1 - $iDist / $iBlastRadius) * ($iX_Dist / $iDist) * $iBlastAccell
$aFlakes[$i][3] = (1 - $iDist / $iBlastRadius) * ($iY_Dist / $iDist) * $iBlastAccell
EndIf
Next
EndFuncFunc _Redraw()
[/autoit] [autoit][/autoit] [autoit]
_WinAPI_BitBlt($hDC_Window, 0, 0, $iWidth, $iHeight, $hDC_Bitmap, 0, 0, $SRCCOPY)
EndFuncFunc _Close()
[/autoit] [autoit][/autoit] [autoit]
Exit
EndFuncFunc _Shutdown()
[/autoit] [autoit][/autoit] [autoit]
_WinAPI_SelectObject($hDC_Bitmap, $hOldObj)
_WinAPI_ReleaseDC($hWnd, $hDC_Window)
_WinAPI_DeleteDC($hDC_Bitmap)
_WinAPI_DeleteObject($hBitmap)_GDIPlus_GraphicsDispose($hGraphics)
[/autoit]
_GDIPlus_BrushDispose($hBrush_Snow)
_GDIPlus_Shutdown()
EndFunc
Am Scriptanfang sind jede Menge globale Variablen die diverse Einstellmöglichkeiten bieten.
Kleine extra Spielerei: Klick mal irgendwo in die GUI ;). -
Das geht mit AdlibRegister. Dafür brauchst du keine parallel laufenden Schleifen (was technisch gesehen sowieso nicht in der Art möglich ist ;)).
Spoiler anzeigen
[autoit]AdlibRegister("_Holz", 5000)
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
HauptU()
EndSwitch
WEndFunc _Holz()
[/autoit]
$HolzR += 100
GUICtrlSetData($Label12,$HolzR)
EndFuncPS: Bitte verwende doch in Zukunft, um Scripte zu posten, einen anderen Browser oder lass dir was anderes einfallen, das kann doch kein Mensch lesen :D. Nicht jeder hat Lust und Zeit da wieder Zeilenumbrüche an die richtige Position reinzufriemeln ;).
-
Alles Gute zum Geburtstag Forum!

-
Ich weiß nicht, ob ein Beispiel für _GDIPlus_BitmapCreateGraphics so sinnvoll ist. Die Funktion wird sicher auch in anderen Beispielen oft verwendet und lässt sich eigentlich nicht demonstrieren ohne einige andere GDI+ Funktionen.

Ich habe dennoch mal Versucht ein möglichst einfaches Beispiel zu schreiben:_GDIPlus_BitmapCreateFromGraphics
[autoit]#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]Global $iWidth = 400, $iHeight = 400
[/autoit] [autoit][/autoit] [autoit]
Global $hWnd, $hGraphics, $hBitmap, $hBitmapContext, $hBrush_Yellow, $hBrush_Blue$hWnd = GUICreate("GDI+ Bitmap Beispiel", 400, 400)
[/autoit] [autoit][/autoit] [autoit]
GUISetState()_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;Grafik für die GUI erzeugen
[/autoit] [autoit][/autoit] [autoit]
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) ;Bitmap aus der Grafik erzeugen (Inhalt der Grafik wird nicht kopiert!)
$hBitmapContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;Grafik für die Bitmap erzeugen, den Inhalt verändern zu können$hBrush_Yellow = _GDIPlus_BrushCreateSolid(0xFFFFFF00) ;Gelbes Brush-Object erzeugen
[/autoit] [autoit][/autoit] [autoit]
$hBrush_Blue = _GDIPlus_BrushCreateSolid(0xFF0000FF) ;Blaues Brush-Object erzeugen_GDIPlus_GraphicsClear($hBitmapContext, 0xFFFFFFFF) ;Gesamte Bitmap weiß färben
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsFillRect($hBitmapContext, 50, 50, 200, 200, $hBrush_Blue) ;Zeichnet ein Blau ausgefülltes Rechteck auf die Bitmap (nicht die GUI!)
_GDIPlus_GraphicsFillEllipse($hBitmapContext, 150, 150, 200, 300, $hBrush_Yellow) ;Zeichnet eine gelbe Ellipse auf die Bitmap_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iWidth, $iHeight) ;Zeichnet die Bitmap mit ihrem Inhalt auf die GUI
[/autoit] [autoit][/autoit] [autoit];Ressourcen aufräumen!
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_GraphicsDispose($hBitmapContext)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_BrushDispose($hBrush_Yellow)
_GDIPlus_BrushDispose($hBrush_Blue)
_GDIPlus_Shutdown()While GUIGetMsg() <> -3
[/autoit]
WEnd
Und hier noch ein Beispiel für _GDIPlus_SetSmoothingMode und _GDIPlus_GetSmoothingMode. Das Beispiel ergibt aber leider wohl nur wenig Sinn, weil die Funktion sich überhaupt nicht verhält wie es in der Hilfe beschrieben wird. Google spuckt auch nicht all zu viel Hilfreiches aus, aber vielleicht weiß ja einer unser GDI+ Experten weiter ;)._GDIPlus_GraphicsSet/GetSmoothingMode
[autoit]#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]Global $iWidth = 400, $iHeight = 400
[/autoit] [autoit][/autoit] [autoit]
Global $hWnd, $hGraphics$hWnd = GUICreate("GDI+ Smoothing Beispiel", 400, 400)
[/autoit] [autoit][/autoit] [autoit]
GUISetState()_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;Grafik für die GUI erzeugen
[/autoit] [autoit][/autoit] [autoit];- Ohne Kantenglättung:
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 0)
_GDIPlus_GraphicsFillEllipse($hGraphics, 20, 100, 160, 200) ;Zeichnet eine schwarze Ellipse auf die GUI [links]
ConsoleWrite("Aktueller Kantenglättungsmodus: " & _GDIPlus_GraphicsGetSmoothingMode($hGraphics) & @CRLF);- Mit Kantenglättung:
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)
_GDIPlus_GraphicsFillEllipse($hGraphics, 220, 100, 160, 200) ;[rechts]
ConsoleWrite("Aktueller Kantenglättungsmodus: " & _GDIPlus_GraphicsGetSmoothingMode($hGraphics) & @CRLF);Ressourcen aufräumen!
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()While GUIGetMsg() <> -3
[/autoit]
WEnd -
Witzige Idee :D. Auf meinem uralten Ubuntu Laptop mit Wine braucht das Script sagenhafte 36s zum buffern
. Ich teste es nochmal wenn ich nach Hause komme.
Sieht auf jeden Fall der Youtube Version zum verwechseln ähnlich
. -
Happy Birthday ihr beiden
!