Skip to content

Commit

Permalink
new vectorio API
Browse files Browse the repository at this point in the history
  • Loading branch information
FoamyGuy committed Aug 17, 2021
1 parent 23768a2 commit a56e59f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions displayio_dial.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def _initialize_dial(self, width, height):

# create the needle
self._create_needle()
self.append(self._needle_vector_shape)
self.append(self._needle)
self._update_needle(self._value)

def _adjust_dimensions(self, width, height):
Expand Down Expand Up @@ -462,15 +462,11 @@ def _get_font_height(self, font, scale):

def _create_needle(self):
# Create the needle
self._needle_palette = displayio.Palette(2)
self._needle_palette.make_transparent(0)
self._needle_palette[1] = self._needle_color
self._needle_palette = displayio.Palette(1)
self._needle_palette[0] = self._needle_color

self._needle = vectorio.Polygon(
points=[(100, 100), (100, 50), (50, 50), (50, 100)]
)
self._needle_vector_shape = vectorio.VectorShape(
shape=self._needle,
points=[(100, 100), (100, 50), (50, 50), (50, 100)],
pixel_shader=self._needle_palette,
x=0,
y=0,
Expand Down

0 comments on commit a56e59f

Please sign in to comment.