Does anyone know if the Picographics graphics.sprite() functionality is supported on the cosmic unicorn? I have been able to use sprites on the Pico Display Pack 2, but have not had any success using them on cosmic unicorn.
Here is some example code, that tries to display a single frame of a 32x32 pixel ‘party parrot’ by selecting 16 ‘blocks’ of 8x8 sprites from a 128x128 pixel spritesheet.
from cosmic import CosmicUnicorn
from picographics import PicoGraphics, DISPLAY_COSMIC_UNICORN as DISPLAY, PEN_RGB332
cu = CosmicUnicorn()
graphics = PicoGraphics(DISPLAY, pen_type = PEN_RGB332)
# set the led brightness
cu.set_brightness(.75)
# load spritesheet
graphics.load_spritesheet("parrot.rgb332")
# load 16 'blocks' of 8x8 sprites to fill a 32x32 grid with a single frame
for i in range(0, 4):
for j in range(0,4):
graphics.sprite(i, j, i*8, j*8)
cu.update(graphics)
This code produces no output on cosmic unicorn. By contrast, similar code works on the Pico Display Pack:
from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY_2, PEN_RGB332
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2,pen_type=PEN_RGB332)
# set the display backlight
display.set_backlight(0.8)
# load spritesheet of 128x128 pixels
display.load_spritesheet("parrot.rgb332")
# set scale for higher pixel count displays
scale = 8
# fill 32x32 pixels with 16 8x8 pixel "blocks" from the spritesheet
# to create one "frame";
for i in range(0,4):
for j in range(0,4):
display.sprite(i, j, (i)*8*scale, (j)*8*scale, scale)
display.update()
Is there a better approach for generating animations on the cosmic unicorn that I should explore instead?