-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MicroPython Example of loading sprites #58
Conversation
Awesome, thank you, going to run and test this! I have a feeling that the only reason larger pen types don't support sprites is the RAM constraints. I wonder if that should be fixed now we have Pico 2 and... y'know... ALL THE PSRAM 😆 Edit: it might also be that the sprite functions are implemented in some eldritch horror fashion that doesn't bear thinking about and doesn't lend itself to other pen types. I'm not going to stare into that abyss just yet though. |
It was a fun one to work on! And it does look like the RGB565 pen can load in sprites, I may play with that some and see about changing the parameter to just be an overwritable pen type? I went with RGB332 cause there were sprite sheets for it, and I had no idea what magic was happening in |
I did some more digging on RGB565, and at this point, it's over my head, and I'm not sure why the colors are off. But I did do some testing. I found the pirate themed RGB565 sprite sheets in the picosystem repo and set the device to RGB565 and loaded it up. Everything is a bit pink. Did move from 30fps to 60fps though. Not sure if that's because of different pens or fewer colors. Those pictures are at the bottom. I also found another magic python file. I got the same results when trying to convert a spritesheet I had that was working with |
Surprisingly little! I think it's probably rendered horribly cryptic by numpy operations IIRC but the principle is simple enough. Take an 8bit per pixel image... and just chop 3, 3 and 2 bits off for red, green and blue respectively, pack 'em into a byte and repeat. RGB565 is the same but two bytes. RGB888 ... well you get the idea 😆 |
I ended up asking a friend (Okay, maybe it was AI) and was able to get the script working to convert the sprite sheets over. Working perfectly with the RGB565 pen and even running at 60fps+
|
04a3dd7
to
e3d5441
Compare
Sorry for the radio silence here, been focussed on pushing the rest of Presto over the not-quite-finished-but-good-enough line. Would you mind giving this one last rebase, please? |
e3d5441
to
778a111
Compare
No problem at all @Gadgetoid ! I just rebased, and it should be good to go, but I will pull the uf2 down once my repo makes the build to double check it still works with the changes from the rebase |
Awesome, thank you! If you want to get ahead of the latest QA/linting fixes in dev, you can also run:
If it complains about anything that doesn't make sense to fix - unused args you really don't need to use for example - then use a Note: If you don't want to run the gauntlet I'll run a QA pass when I merge and rebase dev onto main anyway! |
Sweet! I went through and ran that and took the fixes. The only issue I ran into is the |
Oooh, perhaps you have found an obscure bug 😆 I'll look into that. Thanks for adding the fixes, saves me some hassle later! |
Okay the |
Oh also:
And
|
D'oh. Worked perfectly! Thank you so much and the icon is da bomb. I think it is ready to go. Thanks for all the help! |
No worries, it's a fantastic example and dangerously addictive 😆 absolute shoe-in. Thank you for your efforts and responsiveness here! |
sprites
if set to true, sets the pen type toPEN_RGB332
to allow forRGB332
sprites that work with PicoGraphicsawesome_game.py
, which is a port of the same name from the tutfy2040 exampleThe game uses a touch screen instead of a gamepad, so it's easier for everyone to try it; also, every time you get a treasure chest, a backlight turns on as gold.