# --- Drawing setup --# Create a Group
group = displayio.Group(max_size=22)
# Create a bitmap object
bitmap = displayio.Bitmap(64, 32, 2) # width, height, bit depth
# Create a color palette
color = displayio.Palette(4)
color[0] = 0x000000 # black
color[1] = 0xFF0000 # red
color[2] = 0x444444 # dim white
color[3] = 0xDD8000 # gold
# Create a TileGrid using the Bitmap and Palette
tile_grid = displayio.TileGrid(bitmap, pixel_shader=color)
# Add the TileGrid to the Group
group.append(tile_grid)
# draw the frame for startup
rect1 = Rect(0, 0, 2, 32, fill=color[2])
rect2 = Rect(62, 0, 2, 32, fill=color[2])
rect3 = Rect(2, 0, 9, 2, fill=color[0])
rect4 = Rect(53, 0, 9, 2, fill=color[0])
rect5 = Rect(2, 30, 12, 2, fill=color[0])
rect6 = Rect(50, 30, 12, 2, fill=color[0])
group.append(rect1)
group.append(rect2)
group.append(rect3)
group.append(rect4)
group.append(rect5)
group.append(rect6)
def redraw_frame(): # to adjust spacing at bottom later
rect3.fill = color[2]
rect4.fill = color[2]
rect5.fill = color[2]
rect6.fill = color[2]
# draw the wings w polygon shapes
wing_polys = []
wing_polys.append(Polygon([(3, 3), (9, 3), (9, 4), (4, 4)], outline=color[1]))
wing_polys.append(Polygon([(5, 6), (9, 6), (9, 7), (6, 7)], outline=color[1]))
wing_polys.append(Polygon([(7, 9), (9, 9), (9, 10), (8, 10)], outline=color[1]))
wing_polys.append(Polygon([(54, 3), (60, 3), (59, 4), (54, 4)], outline=color[1]))
wing_polys.append(Polygon([(54, 6), (58, 6), (57, 7), (54, 7)], outline=color[1]))
wing_polys.append(Polygon([(54, 9), (56, 9), (55, 10), (54, 10)], outline=color[1]))
for wing_poly in wing_polys:
group.append(wing_poly)
def redraw_wings(index): # to change colors
for wing in wing_polys:
wing.outline = color[index]
# --- Content Setup --deco_font = bitmap_font.load_font("/BellotaText-Bold-21.bdf")
# Create two lines of text. Besides changing the text, you can also
# customize the color and font (using Adafruit_CircuitPython_Bitmap_Font).
# text positions
on_x = 15
on_y = 9
off_x = 12
off_y = 9
air_x = 15
air_y = 25
text_line1 = adafruit_display_text.label.Label(
deco_font, color=color[3], text="OFF", max_glyphs=6
)
text_line1.x = off_x
text_line1.y = off_y
text_line2 = adafruit_display_text.label.Label(
deco_font, color=color[1], text="AIR", max_glyphs=6
)