#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 600
'Set the display driver (mandatory)
#DefineExtra: #define ESP32_2432S028
#End Region
Sub Process_Globals
Private VERSION As String = "rLovyanGFXEx Basic v20250409"
Public Serial1 As Serial
Private lcd As LovyanGFXEx
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log(CRLF, CRLF, "[AppStart]", VERSION)
lcd.Initialize(Null)
CallSubPlus("Demo", 500, 5)
End Sub
Private Sub Demo(tag As Byte)
lcd.DisplayRotation = 1
lcd.BackgroundColor = lcd.COLOR_WHITE
lcd.DrawHeader(VERSION, lcd.FONT_FONT2, lcd.TEXT_ALIGN_CENTER, 1, lcd.COLOR_WHITE, lcd.COLOR_NAVY, lcd.COLOR_RED)
lcd.DrawFooter("B4X=great... enjoy", lcd.FONT_FONT2, lcd.TEXT_ALIGN_CENTER, 1, lcd.COLOR_WHITE, lcd.COLOR_NAVY, lcd.COLOR_RED)
lcd.FillCircle(30, 30, 15, lcd.COLOR_RED)
lcd.FillRoundRect(10, 70, 50, 20, 5, lcd.COLOR_RED)
' Set cursor at x,y position
Dim x,y As ULong
x = 100
y = 100
lcd.SetCursor(x,y)
' Print text in red at cursor position
lcd.Font = lcd.FONT_FONT0
lcd.SetTextSize(3)
lcd.SetTextColor(lcd.ColorRGB(255,0,0))
lcd.Print("HELLO")
' Print text in white at new cursor position
lcd.SetCursor(100,200)
lcd.SetTextSize(3)
lcd.SetTextColor(lcd.ColorRGB(255,255,255))
lcd.Print("World")
' Draw blue pixel
lcd.DrawPixel(50, lcd.Height / 2 , lcd.COLOR_BLUE)
' Draw lines
lcd.DrawLine(60, 60, 100, 100, lcd.ColorRGB(255,0,0))
'lcd.DrawLine(10, lcd.Height - 20, lcd.Width - 20, lcd.Height - 20, lcd.COLOR_BLUE)
lcd.DrawGradientLine(10, lcd.Height - 20, lcd.Width - 20, lcd.Height - 20, lcd.COLOR_RED, lcd.color_BLACK)
lcd.DrawWideLine(10, lcd.Height / 2, lcd.Width / 2, lcd.Height / 2, 5, lcd.COLOR_CYAN)
' 3-point black Bezier curve
lcd.drawBezier3(10, 200, 100, 150, 150, 200, lcd.COLOR_BLACK)
' Draw circles
lcd.DrawCircle(60, 60, 20, lcd.COLOR_BLUE)
'lcd.FillCircle(60, 60, 20, lcd.ColorRGB(255,0,0))
'Dim c As ULong = Bit.ParseInt("000000FF", 32)
'lcd.FillCircle(60, 60, 20, c)
'lcd.FillCircle(150, 150, 20, lcd.COLOR_RED)
' Little triangle
lcd.fillTriangle(80, 80, 60, 80, 80, 60, lcd.COLOR_YELLOW)
' Draw TextBox
lcd.DrawTextBox((lcd.Width / 2) - (100 / 2), 30, 100, 40, "INFO", lcd.COLOR_BLACK, 2, lcd.COLOR_WHITE, lcd.COLOR_RED, 4)
lcd.DrawTextBoxMultiLIne(200, 80, 100, 130, "Line1", "Line2", "Line3", lcd.COLOR_BLACK, 0, lcd.COLOR_LIGHTGRAY, lcd.COLOR_RED, 4)
End Sub