Little "painter" for Annex32

Place code snippets and demo code here
Post Reply
User avatar
Electroguard
Posts: 179
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 40 times
Been thanked: 102 times

Little "painter" for Annex32

Post by Electroguard »

Couldn't leave this little Screen Painter example from CiccioCB behind...

(from CiccioCB)

I did little video for a simple "painter" program for the ESP32.
The video is here:



The code is below

Code: [Local Link Removed for Guests]

gui.init 20, 0
col1 = gui.button 0, 0, 50, 40, "RED"
gui.setcolor col1, tft.color(black), tft.color(red), tft.color(yellow)
col2 = gui.button 0, 40, 50, 40, "GREEN"
gui.setcolor col2, tft.color(black), tft.color(green), tft.color(yellow)
col3 = gui.button 0, 80, 50, 40, "BLUE"
gui.setcolor col3, tft.color(black), tft.color(blue), tft.color(yellow)
col4 = gui.button 0, 120, 50, 40, "WHITE"
gui.setcolor col4, tft.color(black), tft.color(white), tft.color(yellow)
col5 = gui.button 0, 160, 50, 40, "BLACK"
gui.setcolor col5, tft.color(white), tft.color(black), tft.color(yellow)
clr = gui.button 0, 205, 50, 35, "CLEAR"
gui.setcolor clr, tft.color(white), tft.color(olive), tft.color(yellow)
gui.setevent col1, 1, changeColor
gui.setevent col2, 1, changeColor
gui.setevent col3, 1, changeColor
gui.setevent col4, 1, changeColor
gui.setevent col5, 1, changeColor

gui.setevent clr, 1, clearAll
color = tft.color(white)

gui.autorefresh 50, 1

for z = 1 to 10000000
  touch.read
  if touch.z = 1 then
    tft.circle touch.x, touch.y, 1, color , 1
  end if
  'pause 1
next z
end

changeColor:
select case gui.target
  case col1
    color = tft.color(red)
  case col2
    color = tft.color(green)
  case col3
    color = tft.color(blue)
  case col4
    color = tft.color(white)   
  case col5
    color = tft.color(black)              
end select
return

clearAll:
tft.fill 0
gui.redraw
return
Post Reply