Du kannt auch den Font in GDI+ benutzen ohne ihn zu installieren -> http://www.autoitscript.com/forum/index.php?showtopic=94679
Gruß,
UEZ
Du kannt auch den Font in GDI+ benutzen ohne ihn zu installieren -> http://www.autoitscript.com/forum/index.php?showtopic=94679
Gruß,
UEZ
Du musst deinen Font installieren -> selektiere Font -> rechte Maustaste -> installieren.
$hFamily = _GDIPlus_FontFamilyCreate ("Arial") ;-> Arial ist der TTF Font. Du kannst auch "Times", "Georgia", usw. oder deinen Font nehmen!
Gruß,
UEZ
Liest denn niemand die Hilfe? Dort sind solche Beispiele vorhanden! ![]()
Hier das Beispiel aus der Hilfe:
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]_Main()
[/autoit] [autoit][/autoit] [autoit]Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout
; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()
; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0x7F00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main
[/autoit]Gruß,
UEZ
Bei mir stürzt das Skript ab:
Problemsignatur:
Problemereignisname: APPCRASH
Anwendungsname: AutoIt3.exe
Anwendungsversion: 3.3.4.0
Anwendungszeitstempel: 4b509352
Fehlermodulname: GDIPlus.dll
Fehlermodulversion: 5.2.6002.18005
Fehlermodulzeitstempel: 49e036f1
Ausnahmecode: c0000005
Ausnahmeoffset: 000464c9
Betriebsystemversion: 6.0.6002.2.2.0.256.4 -> Vista x32
Gebietsschema-ID: 1031
Zusatzinformation 1: 5a39
Zusatzinformation 2: cdfd3cb33466d6ffbb26c3edc7aaf68f
Zusatzinformation 3: 54f0
Zusatzinformation 4: 2de12d5a49c981685da61adf0664ddf7
Liegt an der Zeile 24: $reflect = _GDIPlus_BitmapCloneArea($backbuffer, 0, 0, 700, 700, $GDIP_PXF64PARGB) -> auskommentieren, dann läuft das Skript wieder!
Gruß,
UEZ
In der Tat gibt es noch eine andere Möglichkeit, die Ressourcen einzubinden und direkt aus dem Speicher zu nutzen!
Schaue dir mal Resources.au3 an: http://www.autoitscript.com/forum/index.php?showtopic=51103
Gruß,
UEZ
Hallo Forum.
Ich bin (noch) neu hier im Forum und auch noch relativ neu bei AutoIt selbst. Bin allerdings schon seit langem in VB und Derivaten in div. Ausprägungen aktiv.
Eben von VB kenne ich die Möglichkeit, einer EXE Aufrufparameter mitzugeben - und suche diese Möglichkeit nun auch in AutoIt.
Geht das überhaupt?
Die Hilfe spuckt mir hierzu nichts aus, auch im Web wird man nicht wirklich fündig...Danke schon mal für Eure Hilfe!
Viele Grüße, Alex
Geht auch in AutoIt -> suche mal in der Hilfe nach $CmdLine
Gruß,
UEZ
Update auf v1.1 (siehe 1. Post)!
UEZ
Na siehste, war doch gar nicht so schwer ![]()
Wenn du willst, kannst du hier mal reinschauen und dein Programm erweitern: [ gelöst ] GDI+ Zeichnen und als Bild speichern.
Weiter so!
UEZ
Klasse gemacht, UEZ!
Wenn die Ränder (beim Stopuhr-PNG) jetzt noch nicht ganz so "ausgefranst" aussehen würden (Anti-Aliasing), wäre es perfekt!
Ist aber nur ein kleiner "Mangel". Nur, falls Du das im PNG beheben kannst (selbst erstellt oder irgendwo gedownloadet?).
Ansonsten aber wirklich super!
Danke,
die Stoppuhr und den Ball habe ich seperat herunter geladen und mit Gimp "vereint"
Ein besseres Anti-Anliasing habe ich nicht hinbekommen, da ich mich in Gimp eigentlich überhaupt nicht auskenne!
Wer talentiert ist, kann ja das besser machen und mir zukommen lassen (siehe Anhang -> GIMP Format) ![]()
Danke auch an Schnitzel und Sprenger120 für die "Blumen"!
Gruß,
UEZ
Kann es sein, dass nicht alle Funktionsnamen in Kürzere umgewandelt werden?
Z.B. der Code hier: GDI+: Fussball Chronograph Build 2010-02-09
Gruß,
UEZ
Danke für die Blumen!
Das Ganze ist aus diesem Thread heraus entstanden: Stoppuhr für Fußball
Gruß,
UEZ
Ich weiß nicht, wo für das gut sein soll, aber ich habe es einfach mal programmiert, nach dem SEuBO, Andy, Oscar und Progandy ihren Beitrag zu diesem Thema geleistet haben!
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_Run_After=del /f /q "Fussball Chronograph_Obfuscated.au3"
#AutoIt3Wrapper_Res_Description=Fussball Chronograph v1.4 by (c) UEZ 2010
#AutoIt3Wrapper_Res_Fileversion=1.4
#AutoIt3Wrapper_Res_LegalCopyright=UEZ 2010
#AutoIt3Wrapper_Res_Language=1031
#AutoIt3Wrapper_Res_Field=Coded by|UEZ
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Icon="Images\Fussball Chronograph.ico"
;~ #AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"
#AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#Region includes
#include <ButtonConstants.au3>
#include <FontConstants.au3>
#include <GDIplus.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <Sound.au3>
#include <StaticConstants.au3>
#Include <String.au3>
#include <WindowsConstants.au3>
#EndRegion
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
#Region Dateien Check
If Not FileExists(@ScriptDir & "\Images\Hintergrund.jpg") Then
MsgBox(16, "Error", "Datei 'Images\Hintergrund.jpg' nicht gefunden!" & @CRLF & @CRLF & _
"Programm wird beendet!", 15)
Exit
EndIf
If Not FileExists(@ScriptDir & "\Images\Stoppuhr.png") Then
MsgBox(16, "Error", "Datei 'Images\Stoppuhr.png' nicht gefunden!" & @CRLF & @CRLF & _
"Programm wird beendet!", 15)
Exit
EndIf
If Not FileExists(@ScriptDir & "\Audio\Whistle_Start.mp3") Then
MsgBox(16, "Error", "Datei 'Audio\Whistle_Start.mp3' nicht gefunden!" & @CRLF & @CRLF & _
"Programm wird beendet!", 15)
Exit
EndIf
If Not FileExists(@ScriptDir & "\Audio\Whistle_End.mp3") Then
MsgBox(16, "Error", "Datei 'Audio\Whistle_End.mp3' nicht gefunden!" & @CRLF & @CRLF & _
"Programm wird beendet!", 15)
Exit
EndIf
#EndRegion
#Region General parameters
Local $titel = "Fussball Chronograph v1.4"
Local $build = " Build 2010-03-09"
Local $coder = "by UEZ 2010"
Local $os = @OSBuild
Switch $os
Case 0 To 3790
Local $StatusBar_Text = $titel & " " & $coder & "......................................................................................."
Local $SB_i = 160, $SB_j = 1, $SB_i_limes = 79, $space_string = "."
Case Else
Local $StatusBar_Text = $titel & " " & $coder
Local $SB_i = 195, $SB_j = 1, $SB_i_limes = 101, $space_string = " "
EndSwitch
Local $StatusBar_checked = False
Local $audio = True
Local $zeit_puffer1, $zeit_puffer2, $zeit_puffer3, $zeit_puffer4, $zeit_netto, $zeiger
Local $limes = 59
Local $halbzeit = 0
Local $status = 1 ;"Anpfiff"
#EndRegion
#Region Ini
Local $AoT, $audio
Local $ini = @ScriptDir & "\Fussball Chronograph.ini"
If Not FileExists($ini) Then
Create_Ini(1)
Else
$AoT = IniRead($ini, "Einstellungen", "AoT", "1")
$audio = IniRead($ini, "Einstellungen", "Audio", "1")
EndIf
#EndRegion
#region GUI About Initialisierung
Local $hGUI_About, $hGraphic_About, $hDC, $hCDC, $hTheme
Local $hbackground, $hDIBBmp, $hOldBmp, $hFont_About, $hOldFont, $hBrush
Local $pBitmapData, $tBmpInfo, $tDTTOptions, $pDTTOptions, $tClientRect, $pClientRect
Local $hBMP_About, $hImage_About, $hBitmap_About, $hBackbuffer_About, $hScrDC, $hDC_backbuffer, $DC_obj, $hBackbuffer_About
Local $iXX = 900, $iYY = 400
Local $fHigh = 50, $fWidth = 30, $fESC = 0, $fOrient = 0, $fWeight = 500
Local $fItalic = 0, $fUnderline = 0, $fStrikeout = 0
Local $fCharset = $DEFAULT_CHARSET, $fOutputPrec = $OUT_DEFAULT_PRECIS, $fClipPrec = $CLIP_DEFAULT_PRECIS, $fQuality = $PROOF_QUALITY
Local $fPitch = $DEFAULT_PITCH, $fFace = 'Courier New'
Local $fGlowsize = 16
Local $atext = @CRLF & $titel & $build & @CRLF & @CRLF & "by UEZ 2010"
#endregion
#Region GUI Initialisierung
Local Const $iX = 518
Local Const $iY = 732
Local $hWnd = GUICreate($titel & $build, $iX, $iY, -1, -1, $WS_SYSMENU)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Ende")
Local $MenuItem1, $MenuItem2, $MenuItem3, $MenuItem4, $MenuItem5, $MenuItem6, $MenuItem7, $MenuItem8
$MenuItem1 = GUICtrlCreateMenu("&?")
$MenuItem3 = GUICtrlCreateMenu("Einstellungen", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Always on top", $MenuItem3)
If $AoT = 1 Then
GUICtrlSetState(-1, $GUI_CHECKED)
WinSetOnTop($hwnd, "", True)
EndIf
GUICtrlSetOnEvent(-1, "Settings_GUI")
$MenuItem7 = GUICtrlCreateMenuItem("Audio", $MenuItem3)
If $audio = 1 Then GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetOnEvent(-1, "Settings_Audio")
$MenuItem8 = GUICtrlCreateMenuItem("Reset", $MenuItem1, -1 , 0)
GUICtrlSetOnEvent(-1, "Reset2")
$MenuItem2 = GUICtrlCreateMenuItem("Über", $MenuItem1, -1 , 0)
GUICtrlSetOnEvent(-1, "About")
$MenuItem5 = GUICtrlCreateMenuItem("", $MenuItem1, -1 , 1)
$MenuItem6 = GUICtrlCreateMenuItem("Ende", $MenuItem1, -1 , 0)
GUICtrlSetOnEvent(-1, "_Ende")
Local $Progress1 = GUICtrlCreateProgress(20, 22, 34, 352, $PBS_SMOOTH + $PBS_VERTICAL + $WS_BORDER)
GUICtrlSetData(-1, 0)
Local $Progress2 = GUICtrlCreateProgress(458, 22, 34, 352, $PBS_SMOOTH + $PBS_VERTICAL + $WS_BORDER)
GUICtrlSetData(-1, 0)
Local $Pic1 = GUICtrlCreatePic("Images\Hintergrund.jpg", 0, -15, $iX, $iY, $WS_GROUP + $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, 128)
Local $Button = GUICtrlCreateButton("&Anpfiff", 12, 568, 488, 57, -1, -1)
GUICtrlSetState(-1, $GUI_ENABLE)
GUICtrlSetFont(-1, 32, 400, 0, "Arial")
Local $timer_start, $timer, $zeit = "00:00"
GUICtrlSetOnEvent(-1, "Check_Status")
Local $Checkbox = GUICtrlCreateCheckbox("", 12, 639, 14, 14)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent($Checkbox, "Check_Checkbox")
Local $Label2 = GUICtrlCreateLabel("Verlängerung", 28, 639, 70, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBKColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Local $StatusBar = _GUICtrlStatusBar_Create($hWnd)
[/autoit] [autoit][/autoit] [autoit]Local $Group1 = GUICtrlCreateGroup("", 12, 384, 488, 166)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
Display_Rotated_Text($hWnd, "1. Halbzeit", 6, 373, 90, 800)
Display_Rotated_Text($hWnd, "2. Halbzeit", 506, 319, 270, 800)
#EndRegion
#Region GDI+ Initialisation
_GDIPlus_Startup()
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
Local $hBitmap_clock = _GDIPlus_BitmapCreateFromGraphics(352, 348, $hGraphics)
Local $hBackbuffer_clock = _GDIPlus_ImageGetGraphicsContext($hBitmap_clock)
Local $hBitmap_time = _GDIPlus_BitmapCreateFromGraphics(433, 156, $hGraphics)
Local $hBackbuffer_time = _GDIPlus_ImageGetGraphicsContext($hBitmap_time)
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer_time, 2)
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer_clock, 2)
Local $hImage = _GDIPlus_BitmapCreateFromFile("Images\Stoppuhr.png")
Local Const $cX = _GDIPlus_ImageGetWidth($hImage)
Local Const $cY = _GDIPlus_ImageGetHeight($hImage)
Local $hBackround = _GDIPlus_BitmapCreateFromFile("Images\Hintergrund.jpg")
Local $hPen1 = _GDIPlus_PenCreate(0xFF101030, 5) ;grosser Zeiger Hintergrund
Local $hPen2 = _GDIPlus_PenCreate(0xFFC0C080, 1) ;grosser Zeiger Vordergrund
Local $hPen3 = _GDIPlus_PenCreate(0xFF101060, 3) ;kleiner Zeiger
Local $hPen4 = _GDIPlus_PenCreate(0xFF302040, 7) ;Knopf in der Mitte
Local $hPen5 = _GDIPlus_PenCreate(0xFF808020, 2) ;Licht auf Knopf
Local $hBrush_font = _GDIPlus_BrushCreateSolid(0xFF000000)
Local $hBrush_clock_g = _GDIPlus_BrushCreateSolid(0x8000E000)
Local $hBrush_clock_r = _GDIPlus_BrushCreateSolid(0x80D00000)
Local $hFormat = _GDIPlus_StringFormatCreate ()
Local $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
Local $hFont = _GDIPlus_FontCreate ($hFamily, 110, 0)
Local $tLayout = _GDIPlus_RectFCreate (0, 0, 433, 156)
Local $hPath, $hCustomLineCap, $avCaps, $GDIP_STATUS
Local Const $LineCapTriangle = 3, $LineCapRound = 2, $DashCapFlat = 0
$hPath = _GDIPlus_PathCreate()
$hCustomLineCap = _GDIPlus_CustomLineCapCreate(0, $hPath)
_GDIPlus_CustomLineCapSetStrokeCaps($hCustomLineCap, $LineCapRound, $LineCapTriangle)
$avCaps = _GDIPlus_CustomLineCapGetStrokeCaps($hCustomLineCap)
_GDIPlus_PenSetLineCap($hPen1, $avCaps[0], $avCaps[1], $DashCapFlat)
Local Const $small_needle_radius = 50
Local Const $small_needle_x = 177
Local Const $small_needle_y = 113
Local Const $big_needle_diameter = 325
Local Const $big_needle_radius1 = 50
Local Const $big_needle_radius2 = $big_needle_diameter / 2 - 6
Local Const $big_needle_x = $cX / 2
Local Const $big_needle_y = $cY / 2
Local Const $big_needle_button = 8
Local Const $pie_size = 13
Local Const $pi_div_180 = 4 * ATan(1) / 180
Draw_GDIp(0, 0)
#EndRegion
Local $pfeife_start = _SoundOpen("Audio\Whistle_Start.mp3")
Local $pfeife_ende = _SoundOpen("Audio\Whistle_End.mp3")
AdlibRegister("Move_Text", 200)
[/autoit] [autoit][/autoit] [autoit]GUIRegisterMsg($WM_PAINT, "Redraw_GUI")
[/autoit] [autoit][/autoit] [autoit]While Sleep(100000)
WEnd
Func Check_Status()
Switch $status
Case 1 ;"Anpfiff"
If $audio = 1 Then _SoundPlay($pfeife_start, 0)
$timer_start = TimerInit()
AdlibRegister("Timer", 1000)
GUICtrlSetData($Button, "&Ende 1. Halbzeit")
$status = 2 ;"Halbzeit"
Case 2 ;"Halbzeit"
AdlibUnRegister("Timer")
$zeit_puffer1 = $zeit
Display_Rotated_Text($hWnd, $zeit_puffer1, 54, 372, 90, 800)
If $audio = 1 Then _SoundPlay($pfeife_ende, 0)
$halbzeit = 45
GUICtrlSetData($Button, "&Start 2. Halbzeit")
$status = 3
Case 3 ;"2. Halbzeit"
Reset_Zeiger()
If $audio = 1 Then _SoundPlay($pfeife_start, 0)
$timer_start = TimerInit()
AdlibRegister("Timer", 1000)
GUICtrlSetData($Button, "&Ende 2. Halbzeit")
$status = 4
Case 4 ;"Ende"
AdlibUnRegister("Timer")
$zeit_puffer2 = $zeit_netto
Display_Rotated_Text($hWnd, $zeit_puffer2, 458, 345, 270, 800)
If $audio = 1 Then _SoundPlay($pfeife_ende, 0)
GUICtrlSetState($Checkbox, $GUI_ENABLE)
GUICtrlSetData($Button, "&Ende")
$status = 5
Case 5;"1. Verlängerung"
If GUICtrlRead($Button) <> "&Ende" Then
Switch GUICtrlRead($Checkbox)
Case 1
GUICtrlSendMsg($Progress1, 0x0410, 1, 0)
GUICtrlSetState($Checkbox, $GUI_DISABLE)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Progress2, 0)
Reset_Zeiger()
If $audio = 1 Then _SoundPlay($pfeife_start, 0)
$halbzeit = 90
$limes = 30
$timer_start = TimerInit()
AdlibRegister("Timer", 1000)
GUICtrlSetData($Button, "&Ende 1. Verlängerung")
$status = 6
EndSwitch
Else
Reset()
EndIf
Case 6 ;"Halbzeit Verlängerung"
AdlibUnRegister("Timer")
$zeit_puffer3 = $zeit_netto
Display_Rotated_Text($hWnd, $zeit_puffer3, 54, 337, 90, 800)
If $audio = 1 Then _SoundPlay($pfeife_ende, 0)
GUICtrlSetData($Button, "&Verlängerung 2. Halbzeit")
$status = 7
Case 7 ;"2. Verlängerung"
GUICtrlSendMsg($Progress2, 0x0410, 1, 0)
Reset_Zeiger()
If $audio = 1 Then _SoundPlay($pfeife_start, 0)
$halbzeit = 105
$timer_start = TimerInit()
AdlibRegister("Timer", 1000)
GUICtrlSetData($Button, "&Ende 2. Verlängerung")
$status = 8
Case 8 ;"Spiel Ende"
AdlibUnRegister("Timer")
$zeit_puffer4 = $zeit_netto
Display_Rotated_Text($hWnd, $zeit_puffer4, 458, 310, 270, 800)
If $audio = 1 Then _SoundPlay($pfeife_ende, 0)
GUICtrlSetData($Button, "&Neustart")
$status = 9
Case 9 ;Neustart
Reset()
EndSwitch
EndFunc
Func Reset_Zeiger($schlafe = 5)
Local $i
GUICtrlSetState($Button, $GUI_DISABLE)
For $i = Int($zeiger) To 0 Step - 1
Draw_GDIp(0, $i)
Sleep($schlafe)
Next
GUICtrlSetState($Button, $GUI_ENABLE)
EndFunc
Func Timer()
Local $sec, $min, $t = TimerDiff($timer_start) ;* 88 ;Turbo Zeit zum Testen ![]()
$sec = Floor(Mod($t / 1000, 60))
$min = Floor($t / (1000 * 60)) + $halbzeit
$zeit_netto = StringFormat("%02d:%02d", $min - $halbzeit, $sec)
$zeit = StringFormat("%02d:%02d", $min, $sec)
If $min - $halbzeit <= $limes Then
Switch $status
Case 2
If $min > 45 Then GUICtrlSendMsg($Progress1, 0x0410, 2, 0)
GUICtrlSetData($Progress1, $min * 1.66666667)
Case 6
$min -= $halbzeit
If $min > 15 Then GUICtrlSendMsg($Progress1, 0x0410, 2, 0)
GUICtrlSetData($Progress1, $min * 1.66666667)
Case 4, 8
$min -= $halbzeit
If $min > 45 And $status = 4 Then GUICtrlSendMsg($Progress2, 0x0410, 2, 0)
If $min > 15 And $status = 8 Then GUICtrlSendMsg($Progress2, 0x0410, 2, 0)
GUICtrlSetData($Progress2, $min * 1.66666667)
EndSwitch
$zeiger = $min + $sec / 60
Draw_GDIp($sec, $zeiger)
Else
AdlibUnRegister("Timer")
EndIf
EndFunc
Func Check_Checkbox()
If BitAND(GUICtrlRead($Checkbox), $GUI_CHECKED) Then
GUICtrlSetData($Button, "&Start Verlängerung")
Else
GUICtrlSetData($Button, "&Ende")
EndIf
EndFunc
Func Draw_GDIp($angle_small, $angle_big)
Local $x1, $x2, $y1, $y2
Local $xx1, $xx2, $yy1, $yy2
$angle_small -= 270
_GDIPlus_GraphicsClear($hBackbuffer_clock, 0x00000000)
_GDIPlus_GraphicsDrawImage($hBackbuffer_clock, $hImage, 0, 0) ;zeichne Uhr, damit die Zeiger gelöscht werden
_GDIPlus_GraphicsDrawImageRectRect($hBackbuffer_time, $hBackround, 36, 394, 433, 156, 0, 0, 433, 156) ;zeichne Stadion, damit die Zeiger gelöscht werden
_GDIPlus_GraphicsDrawLine($hBackbuffer_clock, $small_needle_x, $small_needle_y, _ ;zeichne kleinen Zeiger
$small_needle_x + $small_needle_radius * Sin($angle_small * -6 * $Pi_Div_180), _
$small_needle_y + $small_needle_radius * Cos($angle_small * -6 * $Pi_Div_180), $hPen3)
Switch $status ;zeichne Kreisdiagramm
Case 2, 4
Switch $angle_big
Case 45 To 60
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, -90, 45 * 6, $hBrush_clock_g)
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, -180, ($angle_big - 45) * 6, $hBrush_clock_r)
Case Else
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, -90, $angle_big * 6, $hBrush_clock_g)
EndSwitch
Case 6, 8
Switch $angle_big
Case 15 To 30
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, -90, 15 * 6, $hBrush_clock_g)
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, 0, ($angle_big - 15) * 6, $hBrush_clock_r)
Case Else
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, -90, $angle_big * 6, $hBrush_clock_g)
EndSwitch
EndSwitch
$x1 = $big_needle_x - $big_needle_radius1 * Sin(($angle_big - 210) * -6 * $Pi_Div_180)
$y1 = $big_needle_y - $big_needle_radius1 * Cos(($angle_big - 210) * -6 * $Pi_Div_180)
$x2 = $big_needle_x + $big_needle_radius2 * Sin(($angle_big - 30) * -6 * $Pi_Div_180)
$y2 = $big_needle_y + $big_needle_radius2 * Cos(($angle_big - 30) * -6 * $Pi_Div_180)
$xx1 = $big_needle_x - ($big_needle_radius1 - 2 )* Sin(($angle_big - 210) * -6 * $Pi_Div_180)
$yy1 = $big_needle_y - ($big_needle_radius1 - 2 ) * Cos(($angle_big - 210) * -6 * $Pi_Div_180)
$xx2 = $big_needle_x + ($big_needle_radius2 - 3) * Sin(($angle_big - 30) * -6 * $Pi_Div_180)
$yy2 = $big_needle_y + ($big_needle_radius2 - 3) * Cos(($angle_big - 30) * -6 * $Pi_Div_180)
_GDIPlus_GraphicsDrawLine($hBackbuffer_clock, $x1, $y1, $x2, $y2, $hPen1) ;zeichne großen Zeiger
_GDIPlus_GraphicsDrawLine($hBackbuffer_clock, $xx1, $yy1, $xx2, $yy2, $hPen2) ;zeichne Linie auf großen Zeiger
_GDIPlus_GraphicsDrawEllipse($hBackbuffer_clock, $big_needle_x - $big_needle_button * 0.5, $big_needle_y - $big_needle_button * 0.5, _ ;Knopf
$big_needle_button, $big_needle_button, $hPen4)
_GDIPlus_GraphicsDrawArc ($hBackbuffer_clock, $big_needle_x - $big_needle_button * 0.5, $big_needle_y - $big_needle_button * 0.5, _ ;Licht auf Knopf
$big_needle_button, $big_needle_button, 50, -180, $hPen5)
_GDIPlus_GraphicsDrawStringEx ($hBackbuffer_time, $zeit, $hFont, $tLayout, $hFormat, $hBrush_font) ;zeichne Spielzeit
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap_time, 38, 392, 433, 156) ;kopiere Spielzeit in die GUI
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap_clock, 80, 24, 352, 348) ;kopiere Uhr in die GUI
EndFunc
Func Reset()
$zeit = "00:00"
$limes = 60
$halbzeit = 0
GUICtrlSetData($Button, "&Anpfiff")
GUICtrlSetState($Checkbox, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox, $GUI_DISABLE)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Progress2, 0)
$zeit = "00:00"
Reset_Zeiger()
$status = 1
GUICtrlSendMsg($Progress1, 0x0410, 1, 0)
GUICtrlSendMsg($Progress2, 0x0410, 1, 0)
_WinAPI_RedrawWindow($hWnd, "", "", $RDW_INVALIDATE)
EndFunc
Func Reset2()
Local $chk
WinSetOnTop($hwnd, "", False)
$chk = MsgBox(4, "Reset", "Wirklich alles resetten?")
If $chk = 6 Then
AdlibUnRegister("Timer")
Reset()
EndIf
If BitAND(GUICtrlRead($MenuItem4), $GUI_CHECKED) = $GUI_CHECKED Then WinSetOnTop($hwnd, "", True)
EndFunc
Func _Ende()
$AoT = BitAND(GUICtrlRead($MenuItem4), $GUI_CHECKED)
$audio = BitAND(GUICtrlRead($MenuItem7), $GUI_CHECKED)
WinSetOnTop($hwnd, "", False)
Local $box = MsgBox(36, "Ende", "Soll das Programm wirklich geschlossen werden?")
If $box = 7 Then
If $AoT = $GUI_CHECKED Then WinSetOnTop($hwnd, "", True)
Return
EndIf
Create_Ini(0, $AoT, $audio)
_SoundClose($pfeife_start)
_SoundClose($pfeife_ende)
AdlibUnRegister("Timer")
GUIRegisterMsg($WM_PAINT, "")
_GDIPlus_CustomLineCapDispose($hCustomLineCap)
_GDIPlus_PathDispose($hPath)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_PenDispose($hPen1)
_GDIPlus_PenDispose($hPen2)
_GDIPlus_PenDispose($hPen3)
_GDIPlus_PenDispose($hPen4)
_GDIPlus_PenDispose($hPen5)
_GDIPlus_BrushDispose($hBrush_clock_g)
_GDIPlus_BrushDispose($hBrush_clock_r)
_GDIPlus_BrushDispose($hBrush_font)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ImageDispose($hBackround)
_GDIPlus_BitmapDispose($hBitmap_clock)
_GDIPlus_GraphicsDispose($hBackbuffer_clock)
_GDIPlus_BitmapDispose($hBitmap_time)
_GDIPlus_GraphicsDispose($hBackbuffer_time)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
AdlibUnRegister("Move_Text")
GUIDelete($hwnd)
Exit
EndFunc
Func Move_Text()
Local $txt
$txt = _StringRepeat($space_string, $SB_i) & $StatusBar_Text
_GUICtrlStatusBar_SetText($StatusBar, $txt)
$SB_i -= $SB_j
If $SB_i = 0 Or ($SB_i = $SB_i_limes And $StatusBar_checked) Then
$SB_j *= -1
$StatusBar_checked = True
EndIf
EndFunc
;danke an BugFix für das Beispiel
Func Display_Rotated_Text($hGUI, $text, $px, $py, $angle = 90, $tw = 400, $th = 12, $tcolor = 0x000000, $bcolor = 0xF0F0F0, $font = 'Arial', $transparent = True)
Local $tRect, $rotate, $RotateMe, $rFont, $hDC
; Create RECT-structure, fill data
$tRect = DllStructCreate ($tagRECT)
DllStructSetData ($tRect, 'Left', $px)
DllStructSetData ($tRect, 'Top', $py)
; Set rotation
$rotate = $angle * 10
; Create structure for rotate text, fill data
$RotateMe = DllStructCreate ($tagLOGFONT)
DllStructSetData ($RotateMe, 'Escapement', $rotate)
DllStructSetData ($RotateMe, 'Weight', $tw)
DllStructSetData ($RotateMe, 'Height', $th)
DllStructSetData ($RotateMe, 'FaceName', $font)
; Creates a logical font that has specific characteristics
$rFont = _WinAPI_CreateFontIndirect ($RotateMe)
; Retrieves a handle of a display device context for the client area a window
$hDC = _WinAPI_GetDC ($hGUI)
; Set text- and back color
_WinAPI_SetTextColor ($hDC, $tcolor)
_WinAPI_SetBkColor ($hDC, $bcolor)
If $transparent Then _WinAPI_SetBkMode($hDC, $TRANSPARENT)
; Selects an object into the specified device context
_WinAPI_SelectObject ($hdc, $rFont)
; Draws formatted text in the specified rectangle
_WinAPI_DrawText ($hDC, $text, $tRect, $DT_NOCLIP + $DT_NOPREFIX)
$tRect = 0
EndFunc
Func Settings_GUI()
If BitAND(GUICtrlRead($MenuItem4), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($MenuItem4, $GUI_UNCHECKED)
;~ GUISetStyle(0x14C80000, -1, $hWnd)
WinSetOnTop($hwnd, "", False)
Else
GUICtrlSetState($MenuItem4, $GUI_CHECKED)
;~ GUISetStyle(0x14C80000, 0x00000108, $hWnd)
WinSetOnTop($hwnd, "", True)
EndIf
EndFunc
Func Settings_Audio()
If BitAND(GUICtrlRead($MenuItem7), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($MenuItem7, $GUI_UNCHECKED)
$audio = False
Else
GUICtrlSetState($MenuItem7, $GUI_CHECKED)
$audio = True
EndIf
EndFunc
Func Create_Ini($new = 1, $val1 = 1, $val2 = 1)
Local $err
If $new = 1 Then
IniWriteSection($ini, "Einstellungen", "AoT=1" & @LF & "Audio=1")
$err = @error
$AoT = 1
$audio = 1
Else
IniWriteSection($ini, "Einstellungen", "AoT=" & $val1 & @LF & "Audio=" & $val2)
$err = @error
EndIf
Return $err
EndFunc
Func Redraw_GUI($hWnd, $msg, $wParam, $lParam)
_WinAPI_RedrawWindow($hWnd, "", "", $RDW_UPDATENOW + $RDW_FRAME)
Redraw_GUI_GDIp()
Return $GUI_RUNDEFMSG
EndFunc ;==>Redraw_GUI
Func Redraw_GUI_GDIp()
Display_Rotated_Text($hWnd, "1. Halbzeit", 6, 373, 90, 800)
Display_Rotated_Text($hWnd, "2. Halbzeit", 506, 319, 270, 800)
If $status > 2 Then Display_Rotated_Text($hWnd, $zeit_puffer1, 54, 372, 90, 800)
If $status > 4 Then Display_Rotated_Text($hWnd, $zeit_puffer2, 458, 345, 270, 800)
If $status > 6 Then Display_Rotated_Text($hWnd, $zeit_puffer3, 54, 337, 90, 800)
If $status > 8 Then Display_Rotated_Text($hWnd, $zeit_puffer4, 458, 310, 270, 800)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap_time, 38, 392, 433, 156)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap_clock, 80, 24, 352, 348)
Return
EndFunc
Func About() ;danke an Authenticity für das Beispiel!
GUISetState(@SW_DISABLE, $hwnd)
If @OSBuild > 3790 Then
Opt("GUIOnEventMode", 0)
Local Const $DTT_GLOWSIZE = 0x00000800, $DTT_TEXTCOLOR = 0x00000001, $DTT_COMPOSITED = 0x00002000, $GDIP_CHOCOLATE = 0xFFD2691E
Local Const $tagDTTOPTS = "uint Size;uint Flags;uint clrText;uint clrBorder;uint clrShadow;int TextShadowType;" & $tagPOINT & _
";int BorderSize;int FontPropId;int ColorPropId;int StateId;int ApplyOverlay;int GlowSize;ptr DrawTextCallback;int lParam;"
$hGUI_About = GUICreate("Über", $iXX, $iYY, -1, -1, $WS_SYSMENU, $WS_EX_TOPMOST)
[/autoit] [autoit][/autoit] [autoit]GUISetState()
[/autoit] [autoit][/autoit] [autoit]$hTheme = _WinAPI_OpenThemeData($hGUI_About, "globals")
[/autoit] [autoit][/autoit] [autoit]$hGraphic_About = _GDIPlus_GraphicsCreateFromHWND($hGUI_About)
$hDC = _GDIPlus_GraphicsGetDC($hGraphic_About)
$hCDC = _WinAPI_CreateCompatibleDC($hDC)
$hBMP_About = _WinAPI_CreateBitmap($iXX, $iYY) ;create a dummy bitmap
$hImage_About = _GDIPlus_BitmapCreateFromHBITMAP($hBMP_About)
$hBitmap_About = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage_About)
$hScrDC = _WinAPI_GetDC(0)
$hDC_backbuffer = _WinAPI_CreateCompatibleDC($hScrDC)
$DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hBitmap_About)
$hBackbuffer_About = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) ;create back buffer bitmap
$tClientRect = _WinAPI_GetClientRect($hGUI_About)
$pClientRect = DllStructGetPtr($tClientRect)
$tBmpInfo = DllStructCreate($tagBITMAPINFO)
DllStructSetData($tBmpInfo, "Size", DllStructGetSize($tBmpInfo) - 4)
DllStructSetData($tBmpInfo, "Width", $iXX)
DllStructSetData($tBmpInfo, "Height", -$iYY)
DllStructSetData($tBmpInfo, "Planes", 1)
DllStructSetData($tBmpInfo, "BitCount", 32)
DllStructSetData($tBmpInfo, "Compression", 0)
$hDIBBmp = _WinAPI_CreateDIBSection($hDC, $tBmpInfo, $pBitmapData)
$hFont_About = _WinAPI_CreateFont($fHigh, $fWidth, $fESC, $fOrient, $fWeight, $fItalic, $fUnderline, $fStrikeout, $fCharset, $fOutputPrec, $fClipPrec, $fQuality, $fPitch, $fFace)
$hOldBmp = _WinAPI_SelectObject($hCDC, $hDIBBmp)
$hOldFont = _WinAPI_SelectObject($hCDC, $hFont_About)
$tDTTOptions = DllStructCreate($tagDTTOPTS)
DllStructSetData($tDTTOptions, "Size", DllStructGetSize($tDTTOptions))
DllStructSetData($tDTTOptions, "Flags", $DTT_GLOWSIZE + $DTT_TEXTCOLOR + $DTT_COMPOSITED)
DllStructSetData($tDTTOptions, "GlowSize", $fGlowsize)
DllStructSetData($tDTTOptions, "clrText", _RGBtoBGR($GDIP_CHOCOLATE))
$pDTTOptions = DllStructGetPtr($tDTTOptions)
_WinAPI_DrawThemeTextEx($hTheme, $hCDC, 0, 0, $atext, $DT_WORD_ELLIPSIS + $DT_WORDBREAK + $DT_CENTER + $DT_NOPREFIX, $pClientRect, $pDTTOptions)
[/autoit] [autoit][/autoit] [autoit]_WinAPI_SelectObject($hCDC, $hOldFont)
_WinAPI_SelectObject($hCDC, $hOldBmp)
_WinAPI_DeleteObject($hFont_About)
_WinAPI_DeleteDC($hCDC)
_GDIPlus_GraphicsReleaseDC($hGraphic_About, $hDC)
$hBrush = _GDIPlus_LineBrushCreate(0, 0, 0, $iYY / 4, 0, 0, 1)
$hbackground = _GDIPlus_BitmapCreateFromGdiDib($tBmpInfo, $pBitmapData)
_GDIPlus_GraphicsDrawImage($hBackbuffer_About, $hbackground, 0, 0)
_GDIPlus_LineBrushSetColors($hBrush, 0x70000000, 0x70D2691E)
_GDIPlus_GraphicsFillRect($hBackbuffer_About, 0, $iYY / 2, $iXX, $iYY, $hBrush)
_WinAPI_BitBlt($hDC, 0, 0, $iXX, $iYY, $hDC_backbuffer, 0, 0, 0x00CC0020)
GUIRegisterMsg($WM_PAINT, "")
GUIRegisterMsg($WM_PAINT, "Redraw_About")
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIRegisterMsg($WM_PAINT, "")
GUIRegisterMsg($WM_PAINT, "Redraw_GUI")
_GDIPlus_ImageDispose($hbackground)
_GDIPlus_GraphicsDispose($hGraphic_About)
_WinAPI_DeleteObject($hDIBBmp)
_WinAPI_CloseThemeData($hTheme)
_WinAPI_DeleteObject($hBMP_About)
_GDIPlus_BitmapDispose($hImage_About)
_WinAPI_DeleteObject($hBitmap_About)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hDC_backbuffer, $DC_obj)
_GDIPlus_GraphicsDispose($hBackbuffer_About)
GUIDelete($hGUI_About)
Opt("GUIOnEventMode", 1)
Else
WinSetOnTop($hwnd, "", False)
MsgBox(0, "Über", $titel & $build & @CRLF & @CRLF & $coder)
If BitAND(GUICtrlRead($MenuItem4), $GUI_CHECKED) = $GUI_CHECKED Then WinSetOnTop($hwnd, "", True)
EndIf
GUISetState(@SW_ENABLE, $hwnd)
EndFunc
Func Redraw_About()
Redraw_GUI_GDIp()
_WinAPI_BitBlt($hDC, 0, 0, $iXX, $iYY, $hDC_backbuffer, 0, 0, 0x00CC0020)
EndFunc
Func _RGBtoBGR($iRGB)
Return Dec(StringMid(Binary($iRGB), 3, 6))
EndFunc
Func _WinAPI_OpenThemeData($hWnd, $sClassList)
Local $aResult = DllCall("uxtheme.dll", "hwnd", "OpenThemeData", "hwnd", $hWnd, "wstr", $sClassList)
If @error Then Return SetError(@error, @extended, 0)
Return SetError(0, 0, $aResult[0])
EndFunc
Func _WinAPI_CloseThemeData($hTheme)
Local $aResult = DllCall("uxtheme.dll", "int", "CloseThemeData", "hwnd", $hTheme)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0] = 0
EndFunc
Func _WinAPI_CreateDIBSection($hDC, $tBmpInfo, ByRef $pBits)
Local $pBmpInfo, $aResult
$pBmpInfo = DllStructGetPtr($tBmpInfo)
$aResult = DllCall("gdi32.dll", "hwnd", "CreateDIBSection", "hwnd", $hDC, "ptr", $pBmpInfo, "uint", 0, "int*", 0, "hwnd", 0, "uint", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] = 87 Then Return SetError(-1, 0, 0)
If $aResult[0] = 0 Then Return SetError(-2, 0, 0)
$pBits = $aResult[4]
Return SetError(0, 0, $aResult[0])
EndFunc
Func _WinAPI_DrawThemeTextEx($hTheme, $hDC, $iPartId, $iStateId, $sText, $iFlags, $pRect, $pDTTOPTS)
Local $aResult = DllCall("uxtheme.dll", "int", "DrawThemeTextEx", "ptr", $hTheme, "hwnd", $hDC, "int", $iPartId, "int", $iStateId, "wstr", $sText, "int", -1, "uint", $iFlags, "ptr", $pRect, "ptr", $pDTTOPTS)
If @error Then Return SetError(@error, @extended, 0)
Return SetError(0, 0, $aResult[0] = 0)
EndFunc
Func _GDIPlus_BitmapCreateFromGdiDib($tBitmapInfo, $pBitmapData)
Local $pBitmapInfo, $aResult
$pBitmapInfo = DllStructGetPtr($tBitmapInfo)
$aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromGdiDib", "ptr", $pBitmapInfo, "ptr", $pBitmapData, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[3]
EndFunc
Func _GDIPlus_LineBrushCreate($nX1, $nY1, $nX2, $nY2, $iARGBClr1, $iARGBClr2, $iWrapMode = 0)
Local $tPointF1, $pPointF1
Local $tPointF2, $pPointF2
Local $aResult
$tPointF1 = DllStructCreate("float;float")
$pPointF1 = DllStructGetPtr($tPointF1)
$tPointF2 = DllStructCreate("float;float")
$pPointF2 = DllStructGetPtr($tPointF2)
DllStructSetData($tPointF1, 1, $nX1)
DllStructSetData($tPointF1, 2, $nY1)
DllStructSetData($tPointF2, 1, $nX2)
DllStructSetData($tPointF2, 2, $nY2)
$aResult = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "ptr", $pPointF1, "ptr", $pPointF2, "uint", $iARGBClr1, "uint", $iARGBClr2, "int", $iWrapMode, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[6]
EndFunc
Func _GDIPlus_LineBrushSetColors($hLineGradientBrush, $iARGBStart, $iARGBEnd)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetLineColors", "hwnd", $hLineGradientBrush, "uint", $iARGBStart, "uint", $iARGBEnd)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc
Func _GDIPlus_PathCreate($iFillMode = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", $iFillMode, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[2]
EndFunc
Func _GDIPlus_CustomLineCapCreate($hPathFill, $hPathStroke, $iLineCap = 0, $nBaseInset = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateCustomLineCap", "hwnd", $hPathFill, "hwnd", $hPathStroke, "int", $iLineCap, "float", $nBaseInset, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[5]
EndFunc
Func _GDIPlus_CustomLineCapSetStrokeCaps($hCustomLineCap, $iStartCap, $iEndCap)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetCustomLineCapStrokeCaps", "hwnd", $hCustomLineCap, "int", $iStartCap, "int", $iEndCap)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc
Func _GDIPlus_CustomLineCapGetStrokeCaps($hCustomLineCap)
Local $aCaps[2], $aResult
$aResult = DllCall($ghGDIPDll, "uint", "GdipGetCustomLineCapStrokeCaps", "hwnd", $hCustomLineCap, "int*", 0, "int*", 0)
If @error Then Return SetError(@error, @extended, -1)
$GDIP_STATUS = $aResult[0]
If $GDIP_STATUS Then Return -1
$aCaps[0] = $aResult[2]
$aCaps[1] = $aResult[3]
Return $aCaps
EndFunc
Func _GDIPlus_PenSetLineCap($hPen, $iStartCap, $iEndCap, $iDashCap)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetPenLineCap197819", "hwnd", $hPen, "int", $iStartCap, "int", $iEndCap, "int", $iDashCap)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc
Func _GDIPlus_PathDispose($hPath)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc
Einige Dateien werden benötigt, die im 7-Zip Archiv enthalten sind!
Hier ein Screenshot: -=>
Ich hoffe, es bring irgend jemanden was (vielleicht das GDI+ Zeug!
)
Gruß,
UEZ
Änderungen in v1.1:
* Ini Datei hinzugefügt, damit die Einstellungen gespeichert werden
* großen Zeiger vergrößert und Spitze hinzugefügt
* großer Zeiger verschiebt sich auch auf Sekunden Basis (vorher Minuten Basis)
* Stoppuhr Bild leicht verbessert
* bei Verlängerung nach 15 Minuten rote Darstellung des Kreisdiagramms
* etc.
Änderungen in v1.2:
* wusste gar nicht, dass die Schrift in "Über" unter WinXP nicht angezeigt wird -> Win2003 und kleiner wird jetzt "nur" eine Messagebox angezeigt
* Reset im Menü hinzugefügt, damit man jeder Zeit die Stoppuhr zurück setzen (resetten) kann
Änderungen in v1.3:
* das About Fenster hatte kein Redraw (hab's vergessen) -> Danke an m-obi für den Hinweis
* doppelter Aufruf von GUIRegisterMsg($WM_PAINT, "") -> dadurch kein Repaint auf der Haupt GUI, wenn das "Über" Fenster geöffnet ist (danke SEuBO!)
* kleinere Bugs beseitigt
Änderungen in v1.4:
* "double buffering" des Grafikfensters von "Über" hinzugefügt, damit es nicht so flackert, wenn man es hin und her bewegt
* kleinere Fehler beseitigt
Dieser Code läuft nach dem "PreProcessed" nicht mehr:
;coded by UEZ 2009-01-17 -=> this recursion code is very slow with AutoIt !!! ![]()
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_UseUpx=n
;~ #AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"
#AutoIt3Wrapper_Run_After=del "L-System Fractals_Obfuscated.au3"
#include <Array.au3>
#include <GDIPlus.au3>
#Include <Misc.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Global $dll = DllOpen("user32.dll")
Global Const $Pi = 4 * ATan(1)
Global Const $Pi_Div_180 = $Pi / 180
Global Const $width = 800
Global Const $height = 600
Global $hGUI, $hWnd, $hGraphic, $Bitmap, $Pen
Global $angle = 0, $x1, $y1, $x2, $y2, $random
Global $length, $depth, $dir, $degree, $dist_rel
Global $font_size, $String_Format, $Font_Family, $Font, $Text_Layout, $Brush, $text
$hGUI = GUICreate("GDI+: L-System Fractals by UEZ 2009 (press F9 to save current image)", $width, $height)
GUISetState(@SW_SHOW)
GUISetOnEvent(-3, "_Exit")
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$Pen = _GDIPlus_PenCreate(0, 1)
_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) ; AntiAlias
$font_size = 7
$String_Format = _GDIPlus_StringFormatCreate ()
$Font_Family = _GDIPlus_FontFamilyCreate ("Arial")
$Font = _GDIPlus_FontCreate ($Font_Family, $font_size, 2)
$Brush = _GDIPlus_BrushCreateSolid (0xDF000000) ;text color
_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
[/autoit] [autoit][/autoit] [autoit]$random = Random(1, 11, 1)
[/autoit] [autoit][/autoit] [autoit]AdlibRegister("Save_PIC", 50)
[/autoit] [autoit][/autoit] [autoit]While 1
Switch $random
Case 1 ;Dragon Curve
$x1 = $width / 4.2
$y1 = $height / 2.8
$length = 500
$depth = Random(6, 18, 1)
$dir = 1
$angle = 0
$text = "Dragon Curve, Recursion Depth = " & $depth
Draw_Text()
Dragon($length, $depth, $dir)
Case 2 ;Levy-C Curve
$x1 = $width / 3.65
$y1 = $height / 2.875
$length = 475
$depth = Random(6, 18, 1)
$dir = 1
$angle = 0
$text = "Levy-C Curve, Recursion Depth = " & $depth
Draw_Text()
Levy_C($length, $depth, $dir)
Case 3 ;Koch Curve
$x1 = $width / 5.3
$y1 = $height / 1.35
$x2 = ""
$y2 = ""
$length = 500
$depth = Random(2, 8, 1)
$dir = 1
$angle = 0
$text = "Koch Curve, Recursion Depth = " & $depth
Draw_Text()
Koch($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Koch($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Koch($length, $depth, $dir) ;F
Case 4 ;Peano Curve
$x1 = $width / 8
$y1 = $height / 2
$length = 600
$depth = Random(2, 5, 1)
$dir = 1
$angle = 0
$text = "Peano Curve, Recursion Depth = " & $depth
Draw_Text()
Peano($length, $depth, $dir)
Case 5 ;Triangle
$x1 = $width / 10.8
$y1 = $height / 1.03
$length = 1300
$depth = Random(2, 10, 1)
$dir = 1
$angle = 0
$text = "Triangle, Recursion Depth = " & $depth
Draw_Text()
Triangle($length, $depth, $dir)
Case 6 ;Arrowhead Curve
$x1 = $width / 10.80
$y1 = $height / 1.05
$length = 650
$depth = Random(3, 9, 1)
$dir = 1
$angle = 0
$text = "Arrowhead Curve, Recursion Depth = " & $depth
Draw_Text()
Arrowhead_R($length, $depth, $dir) ;R
Case 7 ;Penta Plexity
$x1 = $width / 3.55
$y1 = $height / 15
$length = 350
$depth = Random(1, 6, 1)
$dir = 1
$angle = 0
$text = "Penta Plexity, Recursion Depth = " & $depth
Draw_Text()
;F++F++F++F++F
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Case 8 ;Sierpinski Carpet
$x1 = $width / 8
$y1 = $height / 2
$length = 600
$depth = Random(2, 6, 1)
$dir = 1
$angle = 0
$text = "Sierpinski Carpet, Recursion Depth = " & $depth
Draw_Text()
Sierpinski_Carpet($length, $depth, $dir) ;F
Case 9 ;Gosper Curve
$depth = Random(4, 6, 1)
$x1 = $width / 1.45
$y1 = $height / 7 - $depth
$length = 480
$dir = 1
$angle = 0
$text = "Gosper Curve, Recursion Depth = " & $depth
Draw_Text()
Gosper_R($length, $depth, $dir) ;R
Case 10 ;Sierpinski Triangle
$x1 = $width / 10.666
$y1 = $height / 1.05
$length = 325
$depth = Random(2, 9, 1)
$dir = 1
$angle = 0
$text = "Sierpinski Triangle, Recursion Depth = " & $depth
Draw_Text()
;FXF--FF--FF
Sierpinski_F($length, $depth, $dir) ;F
Sierpinski_X($length, $depth, $dir) ;X
Sierpinski_F($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Sierpinski_F($length, $depth, $dir) ;F
Sierpinski_F($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Sierpinski_F($length, $depth, $dir) ;F
Sierpinski_F($length, $depth, $dir) ;F
Case 11 ;Pythagoras Tree
$x1 = $width / 2
$y1 = $height / 1.1
$length = 110
$depth = Random(5, 15, 1)
$dir = 1
$angle = 5
$text = "Pythagoras Tree, Recursion Depth = " & $depth
Draw_Text()
Pythagoras($length, $depth, $dir)
EndSwitch
$random += 1
If $random = 12 Then $random = 1
Sleep(4000)
_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
Wend
Func Pythagoras($length, $split, $dir)
[/autoit] [autoit][/autoit] [autoit]If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Pythagoras_Square($length)
Else
$dist_rel = Sqrt(3) / 2
$degree = 30
Pythagoras_Square($length)
Forward_Only($length)
Turn(-$dir * 1 * $degree)
Pythagoras($length * $dist_rel, $split - 1, 1)
Turn($dir * 3 * $degree)
Forward_Only($length * $dist_rel)
Pythagoras($length / 2, $split - 1, 1)
Forward_Only(-$length * $dist_rel)
Turn(-$dir * 2 * $degree)
Forward_Only(-$length)
EndIf
;Sleep(0)
EndFunc
Func Pythagoras_Square($length)
Local $i
For $i = 1 To 4
Draw_and_Forward($length)
Turn($dir * 90)
Next
EndFunc
Func Sierpinski_X($length, $split, $dir)
;FXF--FF--FF
;X -> --FXF++FXF++FXF--
;F -> FF
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
;~ Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Turn(-$dir * 2 * $degree) ;--
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_X($length / $dist_rel, $split - 1, 1) ;X
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_X($length / $dist_rel, $split - 1, 1) ;X
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_X($length / $dist_rel, $split - 1, 1) ;X
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
EndIf
;Sleep(0)
EndFunc
Func Sierpinski_F($length, $split, $dir)
;FXF--FF--FF
;X -> --FXF++FXF++FXF--
;F -> FF
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Gosper_R($length, $split, $dir)
;F -> R or F -> L
;R -> R+L++L-R--RR-L+
;L -> -R+LL++L+R--R-L
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = Sqrt(7)
$degree = 60
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 2 * $degree) ;++
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn(-$dir * 1 * $degree) ;-
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 2 * $degree) ;--
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 1 * $degree) ;-
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 1 * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Gosper_L($length, $split, $dir)
;F -> R or F -> L
;R -> R+L++L-R--RR-L+
;L -> -R+LL++L+R--R-L
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = Sqrt(7)
$degree = 60
Turn(-$dir * 1 * $degree) ;-
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 2 * $degree) ;++
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 1 * $degree) ;+
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 2 * $degree) ;--
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 1 * $degree) ;-
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
EndIf
;Sleep(0)
EndFunc
Func Sierpinski_Carpet($length, $split, $dir)
;F
;F -> F+F-F-FF-F-F-fF
;f -> fff
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 3
$degree = 90
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 1 * $degree) ;+
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet_Forward_Only($length / $dist_rel, $split - 1, 1) ;f
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Sierpinski_Carpet_Forward_Only($length, $split, $dir) ;f
;F
;F -> F+F-F-FF-F-F-fF
;f -> fff
Forward_Only($length / $dist_rel) ;f
Forward_Only($length / $dist_rel) ;f
Forward_Only($length / $dist_rel) ;f
;Sleep(0)
EndFunc
Func Penta_Plexity($length, $split, $dir)
;F++F++F++F++F
;F -> F++F++F|F-F++F
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = ((Sqrt(5) + 1) / 2)^2
$degree = 36
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 5 * $degree) ;180°
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Arrowhead_R($length, $split, $dir)
;F -> R oder F -> L
;R -> -L+R+L-
;L -> +R-L-R+
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Turn(-$dir * 1 * $degree) ;-
Arrowhead_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 1 * $degree) ;+
Arrowhead_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
Arrowhead_L($length / $dist_rel, $split - 1, 1) ;L
Turn(-$dir * 1 * $degree) ;--
EndIf
;Sleep(0)
EndFunc
Func Arrowhead_L($length, $split, $dir)
;F -> R oder F -> L
;R -> -L+R+L-
;L -> +R-L-R+
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Turn($dir * 1 * $degree) ;+
Arrowhead_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 1 * $degree) ;-
Arrowhead_L($length / $dist_rel, $split - 1, 1) ;L
Turn(-$dir * 1 * $degree) ;-
Arrowhead_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Triangle($length, $split, $dir)
;F--F--F
;F -> F--F--F--ff
;ff -> ff
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Triangle($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Triangle($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Triangle($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Forward_Only($length / $dist_rel) ;f
Forward_Only($length / $dist_rel) ;f
EndIf
;Sleep(0)
EndFunc
Func Dragon($length, $split, $dir)
;F -> R
;R -> +R--L+
;L -> -R++L-
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$degree = 45
$dist_rel = Sqrt(2)
Turn($dir * $degree) ;+
Dragon($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 2 * $degree) ;--
Dragon($length / $dist_rel, $split - 1, -1) ;L
Turn($dir * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Levy_C($length, $split, $dir)
;F
;F -> +F--F+
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$degree = 45
$dist_rel = 1.45
Turn($dir * $degree) ;+
Levy_C($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Levy_C($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Koch($length, $split, $dir)
;F--F--F
;F -> F+F--F+F
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 3
$degree = 60
Koch($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Koch($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Koch($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Koch($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Peano($length, $split, $dir)
;F
;F -> F-F+F+F+F-F-F-F+F
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 3
$degree = 90
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Turn ($degrees)
$angle = $angle + ($degrees * $Pi_Div_180)
EndFunc
Func Draw_and_Forward($length)
$x2 = $x1 + Cos($angle) * $length
$y2 = $y1 + Sin($angle) * $length
;~ Local $red = 0 ;((Cos(1 * $x1 / 2^6) + 1) / 2) * 256
;~ Local $green = 0;((Cos(1.25 * $y2 / 2^6) + 1) / 2) * 256
;~ Local $blue = 0;((Cos(1.5 * $x2 / 2^6) + 1) / 2) * 256
;~ _GDIPlus_PenSetColor($Pen, "0xEF" & Hex($red, 2) & Hex($green, 2) & Hex($blue, 2)) ;Set the pen color
_GDIPlus_PenSetColor($Pen, "0x60000000") ;Set the pen color
_GDIPlus_GraphicsDrawLine($hGraphic, $x1, $y1, $x2, $y2, $Pen)
$x1 = $x2
$y1 = $y2
EndFunc
Func Forward_Only($length)
$x2 = $x1 + Cos($angle) * $length
$y2 = $y1 + Sin($angle) * $length
$x1 = $x2
$y1 = $y2
EndFunc
Func Draw_Text()
Local $Text_Layout2
Local $text_info = "UEZ 2009 ;-)"
$Text_Layout = _GDIPlus_RectFCreate (0, $height - 1.75 * $font_size, 0, 0)
$Text_Layout2 = _GDIPlus_RectFCreate ($width - StringLen($text_info) * $font_size * 0.67, $height - 1.75 * $font_size, 0, 0)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, $text, $Font, $Text_Layout, $String_Format, $Brush)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, $text_info, $Font, $Text_Layout2, $String_Format, $Brush)
EndFunc
Func Save_PIC()
If _IsPressed("78", $dll) Then
_GDIPlus_Save_to_Image(@ScriptDir & "\L-SF-Screenshot_" & @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC, $hGUI)
If @error Then MsgBox(16, "ERROR", "Image was not saved!", 10)
EndIf
EndFunc
; #FUNCTION# =============================================================================
; Name...........: _GDIPlus_Save_to_Image
; Description ...: INTERNAL FUNCTION - save drawn image to file
; Syntax.........: _GraphGDIPlus_Reference_Pixel($file, $hWnd)
; Parameters ....: $file - filename
; $hWnd - handle to GUI
; Autor .........: ptrex, ProgAndy, UEZ
; =========================================================================================
Func _GDIPlus_Save_to_Image($file, $hWnd, $CLSID = "PNG")
Local $hDC, $memBmp, $memDC, $hImage, $w, $h, $size, $sCLSID
If $file <> "" Or $hWnd <> "" Then
$size = WinGetClientSize($hWnd)
$w = $size[0]
$h = $size[1]
$hDC = _WinAPI_GetDC($hWnd)
$memDC = _WinAPI_CreateCompatibleDC($hDC)
$memBmp = _WinAPI_CreateCompatibleBitmap($hDC, $w, $h)
_WinAPI_SelectObject ($memDC, $memBmp)
_WinAPI_BitBlt($memDC, 0, 0, $w, $h, $hDC, 0, 0, 0x00CC0020) ; 0x00CC0020 = $SRCCOPY
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($memBmp)
$sCLSID = _GDIPlus_EncodersGetCLSID ($CLSID)
;~ _GDIPlus_ImageSaveToFile($hImage, $file)
_GDIPlus_ImageSaveToFileEx ($hImage, $file & "." & StringLower($CLSID), $sCLSID)
If @error Then
Return SetError(1, 0, 0)
Else
Return SetError(0, 0, 0)
EndIf
_GDIPlus_ImageDispose ($hImage)
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_DeleteDC($memDC)
_WinAPI_DeleteObject ($memBmp)
Else
Return SetError(1, 0, 0)
EndIf
EndFunc
Func _Exit()
AdlibUnRegister("Save_PIC")
; Clean up resources
_GDIPlus_PenDispose($Pen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_FontDispose ($Font)
_GDIPlus_FontFamilyDispose ($Font_Family)
_GDIPlus_StringFormatDispose ($String_Format)
_GDIPlus_BrushDispose($Brush)
_GDIPlus_Shutdown ()
DllClose($dll)
Exit
EndFunc
Gruß,
UEZ
Das Programm gefällt mir sehr gut - super Code! ![]()
Kannst du noch eine Commandline mit einbauen, damit man den Pre-Prozessor aus SciTE aufrufen kann? Ein Button, um den "PreProcessed" Code zu Testzwecken auszuführen, wäre auch nett!
Ach ja, diese Farben gefallem mir besser -> Global $iColorBk = 0xE0E0E0, $iColor1 = 0x198A00, $iColor2 = 0xCA7F00, $iColor3 = 0x1964EA, $iColor4 = 0x644B4B, $iColor5 = 0x1919FA
Ich werde weiteren Code testen und bei Problemen mich wieder melden ![]()
Danke,
UEZ
Mein GDI+ Beitrag dazu ist im Vergleich zu den Berechnungen eher nebensächlich!
Hut ab! ![]()
UEZ
Hiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjaaaaaaaaaaaaaaaa, das wäre mega schwer und autoit ist für 3D zulangsam, außerdem bin ich gar nicht schlau genug dafür- sry aber das ist echt unmöglich. Ich habe schonmal versucht eine 3D engine mit autoit zu schreiben die konnte einen würfel anzeigen, aber viel mehr ist echt nicht möglich. Worm 2D wäre höchtes möglich.
Ich hatte auch vor mein Autoball script upzudaten, mal schauen.grüße Moritz
Schlau genug bist du, aber AutoIt mit GDI+ wäre da viel zu langsam ![]()
UEZ
Meinst du den Zeiger gegen den Uhrzeiger? Wenn ja, dann einfach die Zeile in $i += 1 editieren!
Gruß,
UEZ
Schaue dir das mal an von BugFix: http://www.autoitscript.com/forum/index.php?showtopic=93402&view=findpost&p=671084
Gruß,
UEZ
Halo UEZ,
ich kann zwar nicht komponieren, aber mein Netbook liefert mit Hilfe deines Tools nette Hintergrundmusik:
Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.
Aufgenommen habe ich das ganze mit dem Audio Recorder von eukalyptus.
Ich hatte eigentlich irgenwelche chaotische, disharmonische Geräusche erwartet, aber das ganze klingt melodiös,mfg (Auto)Bert
Das rhytmische Geklicke im Hintergrund ist auch auf meinem Notebook zu hören! keine Ahnung woran das liegt - vielleicht an der FDMOD.DLL, denn mit BASSMOD.DLL höre ich auch die "Hintergrundgeräusche"! Vielleicht können diese Instrumente nicht richtig abgespielt werden!
Mit KMPlayer hört sich das besser an!
Gruß,
UEZ
Yep, hast recht - ist ein Bug:
Hier die Version, die richtig funktionieren sollte:
#include <Array.au3>
Dim $ergebnis[1]
$path = @WindowsDir
$file = ".log"
;~ $ergebnis = File_Seeker($path, $file, $ergebnis, False, True) ;searchs for ".log" (exact search)
$ergebnis = File_Seeker($path, $file, $ergebnis) ;searchs for "*.log"
;~ $ergebnis = File_Seeker($path, $file, $ergebnis, True) ;searchs for files with extension .log
If Not @error Then
;~ _ArraySort($ergebnis)
;~ _ArrayDisplay($ergebnis)
Local $log
For $i = 1 To UBound($ergebnis) - 1
$log &= $ergebnis[$i] & @CRLF
Next
$file = FileOpen(@ScriptDir & "\Ergebnis.log", 1)
FileWrite($file, $log)
FileClose($file)
EndIf
Exit
[/autoit] [autoit][/autoit] [autoit];==================================================================================================
; Function Name: File_Seeker($path, $file, $array)
; Description: searchs for a file recursively on given drive
; Parameter(s): $path path where to search
; $file filename to search for
; $array to save the search results
; $ext search for file extension, e.g. .mp3
; $exact to search for exact file name (not case sensitive)
; Return Value(s): an array with the full path of the files, $array[0] = amount of found files
; Version: v0.80 Build 2010-01-28 Beta
; Author(s): UEZ
;==================================================================================================
Func File_Seeker($path, $file, ByRef $aResults, $ext = False, $exact = False)
If $file <> "" And IsArray($aResults) And BitAND($ext, $exact) <> 1 Then
If StringRegExp(StringLeft($path, 1), "[a-zA-Z]") And StringMid($path, 2, 1) = ":" Then
If StringRight($path, 1) <> "\" Then $path &= "\"
Local $seek, $suffix = ""
Local $search = FileFindFirstFile($path & "*")
If $search = -1 Then
SetError(2)
Return
EndIf
While 1
$seek = FileFindNextFile($search)
If @error Then ExitLoop
If @extended Then File_Seeker($path & $seek & "\", $file, $aResults, $ext, $exact)
If $exact And Not $ext Then
If $seek = $file Then _ArrayAdd($aResults, $path & $seek)
Else
If $ext Then
If StringRegExp($seek, "(?i:\" & $file & "+$\b)") And StringLeft($file, 1) = "." Then _ArrayAdd($aResults, $path & $seek)
Else
If StringRegExp($seek, "(?i:" & $file & ")+") Then _ArrayAdd($aResults, $path & $seek)
EndIf
EndIf
WEnd
FileClose($search)
$aResults[0] = UBound($aResults) - 1
SetError(0)
Return $aResults
Else
SetError(1)
Return
EndIf
Else
SetError(1)
Return
EndIf
EndFunc
Bitte testen und Feedback!
Danke,
UEZ