Skip to content

Commit f56a6fb

Browse files
committed
update tilepalettemapper usage for new API
1 parent f504199 commit f56a6fb

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

Metro/Metro_RP2350_CircuitPython_Matrix/code.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
import supervisor
1515
from displayio import Group, TileGrid
1616
from tilepalettemapper import TilePaletteMapper
17+
from adafruit_fruitjam.peripherals import request_display_config
1718
import adafruit_imageload
1819

20+
1921
# use the built-in HSTX display
22+
request_display_config(320,240)
2023
display = supervisor.runtime.display
2124

2225
# screen size in tiles, tiles are 16x16
@@ -64,7 +67,7 @@
6467
shader_palette[i + 1] = COLORS[i]
6568

6669
# mapper to change colors of tiles within the grid
67-
grid_color_shader = TilePaletteMapper(shader_palette, 2, SCREEN_WIDTH, SCREEN_HEIGHT)
70+
grid_color_shader = TilePaletteMapper(shader_palette, 2)
6871

6972
# load the spritesheet
7073
katakana_bmp, katakana_pixelshader = adafruit_imageload.load("matrix_characters.bmp")

Metro/Metro_RP2350_Match3/match3_game/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217

218218
# create tile palette mappers
219219
for i in range(2):
220-
palette_mapper = TilePaletteMapper(remap_palette, 3, 1, 1)
220+
palette_mapper = TilePaletteMapper(remap_palette, 3)
221221
# remap index 2 to each of the colors in mouse colors list
222222
palette_mapper[0] = [0, 1, i + 3]
223223
palette_mappers.append(palette_mapper)

Metro/Metro_RP2350_Match3/match3_game/match3_game_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class Match3Card(Group):
133133

134134
def __init__(self, card_tuple, **kwargs):
135135
# tile palette mapper to color the card
136-
self._mapper = TilePaletteMapper(kwargs["pixel_shader"], 5, 1, 1)
136+
self._mapper = TilePaletteMapper(kwargs["pixel_shader"], 5)
137137
kwargs["pixel_shader"] = self._mapper
138138
# tile grid to for the visible sprite
139139
self._tilegrid = TileGrid(**kwargs)

Metro/Metro_RP2350_Match3/tilepalettemapper_demo/code.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
tile_palette_mapper = TilePaletteMapper(
2424
spritesheet_bmp.pixel_shader, # input pixel_shader
2525
5, # input color count
26-
3, # grid width
27-
1 # grid height
2826
)
2927

3028
# create a TileGrid to show some cards

0 commit comments

Comments
 (0)