• Hi,

    Ich stell hier mal meine eigene Uhr rein.

    Ich denke allerdings, dass das nicht die erste ist.

    Hoffe aber trotzdem, dass sie gefällt. :D

    Spoiler anzeigen
    [autoit]


    #include <GDIPlus.au3>
    #include <Misc.au3>
    #include <WindowsConstants.au3>
    Opt("GUIOnEventMode",1)
    Opt("MouseCoordMode",2)
    Global $iWidth = 200
    Global $iHeight = 200
    Global $nnx = $iWidth/2
    Global $nny = $iHeight/2
    Global $aPoints1[5][2]
    Global $aPoints2[5][2]
    Global $kreisl1 = $iWidth/3
    Global $kreisl2 = $iWidth/2.5
    Global $rX2 = $iWidth/1.75
    Global $rY2 = $iHeight/1.5
    Global $rWidth2 = $iWidth/15
    Global $rHeight2 = $iHeight/15
    Global $rX3 = $iWidth/1.5
    Global $rY3 = $iHeight/1.5
    Global $rWidth3 = $iWidth/15
    Global $rHeight3 = $iHeight/15
    Global $rX4 = $iWidth/1.3125
    Global $rY4 = $iHeight/1.5
    Global $rWidth4 = $iWidth/7.5
    Global $rHeight4 = $iHeight/15

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

    WinSetTrans("Uhr","",255)

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

    $hWnd = GUICreate("Physic Engine",$iWidth,$iHeight,-1,-1,$WS_POPUP)
    GUISetState(@SW_SHOW)

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

    _GDIPlus_Startup()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth,$iHeight,$hGraphics)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    $hPenblau = _GDIPlus_PenCreate(0xFF0000FF)
    $hPengruen = _GDIPlus_PenCreate(0xFF00FF00)
    $hBrushrot = _GDIPlus_BrushCreateSolid(0xFFFF0000)
    $hBrushgruen = _GDIPlus_BrushCreateSolid(0xFF00FF00)
    $hBrushgrau = _GDIPlus_BrushCreateSolid(0xFF999999)

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

    GUISetOnEvent(-3,"_exit")

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

    AdlibRegister("_menu",10)

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

    While 1
    WEnd
    Func _menu()
    _GDIPlus_GraphicsClear($hBuffer,0xFFFFFFFF)

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

    _punkte()

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

    _GDIPlus_GraphicsFillRect($hBuffer,$rX2,$rY2,$rWidth2,$rHeight2,$hBrushgrau)
    _GDIPlus_GraphicsFillRect($hBuffer,$rX3,$rY3,$rWidth3,$rHeight3,$hBrushgrau)
    _GDIPlus_GraphicsFillRect($hBuffer,$rX4,$rY4,$rWidth4,$rHeight4,$hBrushgrau)

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

    _GDIPlus_GraphicsDrawString($hBuffer,@MDAY,$rX2,$rY2 + $iHeight/200,"Arial",$iWidth/30)
    _GDIPlus_GraphicsDrawString($hBuffer,@MON,$rX3,$rY3 + $iHeight/200,"Arial",$iWidth/30)
    _GDIPlus_GraphicsDrawString($hBuffer,@YEAR,$rX4 + $iWidth/100,$rY4 + $iHeight/200,"Arial",$iWidth/30)

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

    _GDIPlus_GraphicsFillPolygon($hBuffer,$aPoints1)

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

    _GDIPlus_GraphicsFillPolygon($hBuffer,$aPoints2)

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

    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx,$nny,$secx,$secy)

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

    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282/12 + 1.5705)*$kreisl1,$nny - Sin(6.282/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282/12 + 1.5705)*$kreisl2,$nny - Sin(6.282/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*2/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*2/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*2/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*2/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*3/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*3/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*3/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*3/12 + 1.5705)*$kreisl2)
    ;_GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*4/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*4/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*4/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*4/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*5/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*5/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*5/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*5/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*6/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*6/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*6/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*6/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*7/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*7/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*7/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*7/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*8/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*8/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*8/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*8/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*9/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*9/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*9/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*9/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*10/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*10/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*10/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*10/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*11/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*11/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*11/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*11/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx - Cos(6.282*12/12 + 1.5705)*$kreisl1,$nny - Sin(6.282*12/12 + 1.5705)*$kreisl1,$nnx - Cos(6.282*12/12 + 1.5705)*$kreisl2,$nny - Sin(6.282*12/12 + 1.5705)*$kreisl2)
    _GDIPlus_GraphicsDrawImageRect($hGraphics,$hBitmap,0,0,$iWidth,$iHeight)
    EndFunc
    Func _punkte()
    Global $sec = @SEC
    Global $secl = $iWidth/3 + $iWidth/50
    Global $secx = $nnx - Cos(($sec/60)*6.282 + 1.5705)*$secl
    Global $secy = $nny - Sin(($sec/60)*6.282 + 1.5705)*$secl

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

    Global $min = @MIN
    Global $minl = $iWidth/3
    Global $minx = $nnx - Cos(($min/60)*6.282 + 1.5705)*$minl
    Global $miny = $nny - Sin(($min/60)*6.282 + 1.5705)*$minl

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

    Global $hour = @HOUR
    Global $stdl = $iWidth/5
    Global $stdx = $nnx - Cos((($hour/12)*6.282 + 1.5705)+(($min/60)*0.5235))*$stdl
    Global $stdy = $nny - Sin((($hour/12)*6.282 + 1.5705)+(($min/60)*0.5235))*$stdl

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

    $aPoints1[0][0] = 4

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

    $aPoints1[1][0] = $stdx
    $aPoints1[1][1] = $stdy
    $aPoints1[2][0] = $nnx - Cos((($hour/12)*6.282 + 3.141)+(($min/60)*0.5235))*$stdl/10
    $aPoints1[2][1] = $nny - Sin((($hour/12)*6.282 + 3.141)+(($min/60)*0.5235))*$stdl/10
    $aPoints1[3][0] = $nnx - Cos((($hour/12)*6.282 + 4.7115)+(($min/60)*0.5235))*$stdl/10
    $aPoints1[3][1] = $nny - Sin((($hour/12)*6.282 + 4.7115)+(($min/60)*0.5235))*$stdl/10
    $aPoints1[4][0] = $nnx - Cos((($hour/12)*6.282)+(($min/60)*0.5235))*$stdl/10
    $aPoints1[4][1] = $nny - Sin((($hour/12)*6.282)+(($min/60)*0.5235))*$stdl/10

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

    $aPoints2[0][0] = 4

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

    $aPoints2[1][0] = $minx
    $aPoints2[1][1] = $miny
    $aPoints2[2][0] = $nnx - Cos(($min/60)*6.282 + 3.141)*$minl/(50/3)
    $aPoints2[2][1] = $nny - Sin(($min/60)*6.282 + 3.141)*$minl/(50/3)
    $aPoints2[3][0] = $nnx - Cos(($min/60)*6.282 + 4.7115)*$minl/(50/3)
    $aPoints2[3][1] = $nny - Sin(($min/60)*6.282 + 4.7115)*$minl/(50/3)
    $aPoints2[4][0] = $nnx - Cos(($min/60)*6.282)*$minl/(50/3)
    $aPoints2[4][1] = $nny - Sin(($min/60)*6.282)*$minl/(50/3)
    EndFunc
    Func _exit()
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)

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

    _GDIPlus_PenDispose($hPenblau)
    _GDIPlus_PenDispose($hPengruen)

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

    _GDIPlus_BrushDispose($hBrushrot)
    _GDIPlus_BrushDispose($hBrushgruen)
    _GDIPlus_BrushDispose($hBrushgrau)

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

    _GDIPlus_Shutdown()
    Exit
    EndFunc

    [/autoit]
  • Hallo.

    Ich habe ein paar dinge zu bemängeln:
    1. Warum ist der Titel des Fensters Physic Engine ?
    2. Das GUI flackert sehr, wenn ein anderes Fenster in den Vordergrund kommt.
    3. Kommen Warnings:

    Spoiler anzeigen

    C:\Dokumente und Einstellungen\Pride\Desktop\Neu AutoIt v3 Script.au3(66,51) : WARNING: $secx: possibly used before declaration.
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx,$nny,$secx,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Dokumente und Einstellungen\Pride\Desktop\Neu AutoIt v3 Script.au3(66,57) : WARNING: $secy: possibly used before declaration.
    _GDIPlus_GraphicsDrawLine($hBuffer,$nnx,$nny,$secx,$secy)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Dokumente und Einstellungen\Pride\Desktop\Neu AutoIt v3 Script.au3 - 0 error(s), 2 warning(s)

    Und das Design ist auch net das beste. Aber es Funktioniert und das ist gut ;)
    MfG. PrideRage

    Meine Projekte:
    ClipBoard Manager (beendet)
    Gutes ClipBoard Verwaltungs Programm mit nützlichen Funktionen.

    HTML Creator (beendet)
    Nützliches Tool um schnell ein eigenes HTML Dokument zu erstellen.

    • Offizieller Beitrag

    Sieht ganz gut aus die Uhr. :thumbup:

    Das Flackern der GUI tritt zwar unter Windows 7 nicht auf, aber es liegt bestimmt am AdlibRegister. Die Zeit von 10ms ist irgendwie viel zu kurz. Eigentlich reicht 1000, da ja nur jede Sekunde neu gezeichnet werden muß. Das sollte auch die Prozessorlast verringern.

  • Ach das habe ich ja auch noch net gesehen.
    Deswegen war mein PC auch total überlastet, und ich habe mich schon gewundert :/
    Naja, sind halt fehler die ma passieren.
    Die Uhr ist nett und nicht schlecht für einen, der net so lange dabei ist.

    Meine Projekte:
    ClipBoard Manager (beendet)
    Gutes ClipBoard Verwaltungs Programm mit nützlichen Funktionen.

    HTML Creator (beendet)
    Nützliches Tool um schnell ein eigenes HTML Dokument zu erstellen.