• Offizieller Beitrag

    Hallo

    Hier mal wieder ein kleines Plugin für die G15. Dazu braucht ihr das hier: Zugriff auf LCD der G15 mit der LgLCD SDK
    Ein Pizza Timer. Einfach Zeit eingeben und auf die Pizza warten ;)
    Wenn die letzten 10 Sekunden anbrechen stellt er sich in "ALERT" modus, d.h. er setzt sich automatisch in den Vordergrund (wenn eingestellt).
    Zur Sicherheit bekommt ihr aber auch eine Messagebox dazu ;)

    Spoiler anzeigen
    [autoit]

    #include <LCDSDK.au3>
    _lgLcdInit()

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

    Global $PAUSE = False, $RESTART = False
    ;~ _lgLcd_EnDisableTest()
    Global $PROGRAM_NAME = "Spider's PizzaTimer"
    Global $iConnection = _lgLCDConnect($PROGRAM_NAME)
    Global $iDevice = _lgLCDOpen($iConnection, 0, "_Buttons")

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

    $hBMP = _lgLcd_DrawText("GTASPIDER", 0, 0, 10, "Arial Black", 18)
    $hBMP = _lgLcd_DrawText("BY", $hBMP, 63, -2, "Arial Black", 10)
    _lgLcdUpdateBitmap($iDevice,$hBMP,$LGLCD_PRIORITY_ALERT)
    Sleep(500)
    $hBMP = _lgLcd_DrawText($PROGRAM_NAME, 0, 6, 10, "Arial", 13)
    _lgLcdUpdateBitmap($iDevice,$hBMP,$LGLCD_PRIORITY_ALERT)
    Do

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

    Until _Input() = 0
    Global $aPxArray[160 * 43]
    For $x = 1 To 160 * 43
    $aPxArray[$x - 1] = 1
    Next
    Global $aPxArray0[160 * 43]
    For $x = 1 To 160 * 43
    $aPxArray0[$x - 1] = 0
    Next

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

    $hBMP = _lgLcd_DrawPixel($aPxArray)
    $hBMP0 = _lgLcd_DrawPixel($aPxArray0)

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

    _lgLcdUpdateBitmap($iDevice, $hBMP, $LGLCD_PRIORITY_ALERT, False)
    Beep(500, 200)
    _lgLcdUpdateBitmap($iDevice, $hBMP0, $LGLCD_PRIORITY_ALERT, False)
    Sleep(200)
    _lgLcdUpdateBitmap($iDevice, $hBMP, $LGLCD_PRIORITY_ALERT, False)
    Beep(500, 200)
    _lgLcdUpdateBitmap($iDevice, $hBMP0, $LGLCD_PRIORITY_ALERT, False)
    Sleep(200)
    _lgLcdUpdateBitmap($iDevice, $hBMP, $LGLCD_PRIORITY_ALERT)
    Beep(500, 200)
    _lgLcdUpdateBitmap($iDevice, $hBMP0, $LGLCD_PRIORITY_ALERT)
    $hBMP = _lgLcd_DrawText("PIZZA!", 0, 12, -4, "Tahoma", 26, 1)
    _lgLcdUpdateBitmap($iDevice, $hBMP, $LGLCD_PRIORITY_ALERT)
    MsgBox(48, $PROGRAM_NAME, "Pizza ist fertig!")

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

    Func _Input()

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

    Do
    $ib = InputBox($PROGRAM_NAME, "Bitte Zeit setzen (MM:SS)", "15:00")
    If @error Then Exit
    Until StringRegExp($ib, "\d{1,2}:\d{2}")
    $aMinSek = StringSplit($ib, ":")
    Global $PAUSE = False, $RESTART = False
    Return _Main($aMinSek)
    EndFunc ;==>_Input

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

    Func _Main($aMinSek)
    Local $iMinus = 0, $iMode = $LGLCD_PRIORITY_NORMAL
    $iTimeInMs = $aMinSek[1] * 60 * 1000
    $iTimeInMs += $aMinSek[2] * 1000
    $hTi = TimerInit()
    Do
    If $RESTART Then
    $RESTART = False
    Return 1
    EndIf

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

    $iDiff = TimerDiff($hTi) - $iMinus
    If $iTimeInMs - $iDiff < 10000 Then $iMode = $LGLCD_PRIORITY_ALERT
    $iMin = Int(($iTimeInMs - $iDiff)/1000/60)
    $iSek = Round(($iTimeInMs - $iDiff - ($iMin*1000*60)) / 1000, 1)
    If $iSek < 0.1 Then $iSek = 0
    If $iSek > 59.9 Then $iSek = 59.9
    If StringLen($iMin) < 2 Then $iMin = "0" & $iMin
    If StringLen(Int($iSek)) < 2 Then $iSek = "0" & $iSek
    If Not StringInStr($iSek, ".") Then $iSek &= ".0"
    If $PAUSE Then
    $hBMP = _lgLcd_DrawText($iMin & ":" & $iSek, 0, 8, -4, "Tahoma", 26, 1)
    $hBMP = _lgLcd_DrawText("4", $hBMP, 10, 30, "Webdings", 7)
    $hBMP = _lgLcd_DrawText("<", $hBMP, 52, 30, "Webdings", 7)
    $hBMP = _lgLcd_DrawText("q", $hBMP, 90, 30, "Webdings", 10)
    $hBMP = _lgLcd_DrawText("r", $hBMP, 136, 30, "Webdings", 7)
    _lgLcdUpdateBitmap($iDevice, $hBMP, $iMode)
    While $PAUSE
    Sleep(100)

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

    WEnd
    $iMinus = TimerDiff($hTi) - $iDiff
    Else
    $hBMP = _lgLcd_DrawText($iMin & ":" & $iSek, 0, 8, -4, "Tahoma", 26, 1)
    $hBMP = _lgLcd_DrawText(";", $hBMP, 10, 30, "Webdings", 7);4
    $hBMP = _lgLcd_DrawText("<", $hBMP, 52, 30, "Webdings", 7)
    $hBMP = _lgLcd_DrawText("q", $hBMP, 90, 30, "Webdings", 10)
    $hBMP = _lgLcd_DrawText("r", $hBMP, 136, 30, "Webdings", 7)
    _lgLcdUpdateBitmap($iDevice, $hBMP, $iMode)
    Sleep(100)
    EndIf
    Until $iDiff > $iTimeInMs
    Return 0
    EndFunc ;==>_Main

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

    Func _Buttons($iDevice, $dwButtons, $pContext)
    Select
    Case BitAND($dwButtons, 1)
    $PAUSE = Not $PAUSE
    Case BitAND($dwButtons, 2)
    Exit
    Case BitAND($dwButtons, 4)
    $RESTART = True
    Case BitAND($dwButtons, 8)
    Exit
    EndSelect
    Return $pContext
    EndFunc ;==>_Buttons

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

    Func OnAutoItExit()
    If Eval("iDevice") Then
    $hBMP = _lgLcd_DrawText("GTASPIDER", 0, 0, 10, "Arial Black", 18)
    $hBMP = _lgLcd_DrawText("BY", $hBMP, 63, -2, "Arial Black", 10)
    _lgLcdUpdateBitmap($iDevice,$hBMP,$LGLCD_PRIORITY_ALERT)
    Sleep(500)
    _lgLcdClose($iDevice)
    _lgLcdDisconnect($iConnection)
    _lgLcdDeInit()
    EndIf
    EndFunc ;==>OnAutoItExit

    [/autoit]

    Screenshots:
    autoit.de/wcf/attachment/6481/
    autoit.de/wcf/attachment/6482/
    Gruß
    Spider