PNG

If you need to create custom sprite images for one of the demos, such as sprite_bounce, you can use the packtiles script.

First, create a 128x128 pixel .png image and place it in the pico/PicoDVI/software/assets directory. (You can also download one of the lovely sprites provided below.)

Packtiles

Next, from a terminal cd pico/PicoDVI/software (your path may be different depending on where you installed it).

Run this command to convert the pt_128x128.png file:

./scripts/packtiles -sdmf rgab5515 assets/pt_128x128.png  assets/pt_128x128_rgab5515.h

This will generate a converted .h file asset that can be compiled into the code.

Edit main.c

To use this new asset in the sprite_bounce demo code, head to pico/PicoDVI/software/apps/sprite_bounce and open main.c in your editor.

You can look for one of the original sprites, such as (around line 24):

include "eben_128x128_rgab5515.h"

and swap that for the new one:

include "pt_128x128_rgab5515.h"

Then, swap out the asset used by the berry[] array:

berry[i].img = i % 2 ? pt_128x128 : raspberry_128x128;

Re-save the main.c file.

Build

Now, you can build the app:

cd PicoDVI
mkdir build
cd build
PICO_SDK_PATH=path/to/sdk cmake -DPICO_COPY_TO_RAM=1 ..
make -j4 

This will create the sprite_bounce.uf2 file we need and place it in the pico/PicoDVI/software/build/apps/sprite_bounce directory.

Run It

Now, you can flash the Pico with the new sprite_bounce.uf2 file just as shown previously on the Demo Code page!

This guide was first published on May 04, 2022. It was last updated on Apr 30, 2024.

This page (Sprite Conversion) was last updated on Mar 08, 2024.

Text editor powered by tinymce.