I have written a Frogger game for the original Pimoroni PicoDisplay (240x135) some time ago and it works fine. It has up to 46 graphic items (mostly 16x16 pixels but some 16x32 pixels) moving so quickly at the same time that there is a delay built into the main game loop. Each item is loaded to the framebuffer via a bytearray (“Item” in this example) using the usual
ItemBuf = framebuf.FrameBuffer(Item, 16, 16, framebuf.RGB565)
and displayed using
screen_buffer.blit(ItemBuf, SpriteX, SpriteY)
With the new PicoGraphics driver/module I saw that some improvements could be made. I could use RGB332 to save RAM, as I don’t need the full colour range, and I could leave the items as jpgs (instead of converting them to bytearrays and storing within the code) and use
j.decode(x, y, jpegdec.JPEG_SCALE_FULL)
to decode the jpg file and place on the display. I’ve made all the relevant changes and it all works. However, as it is loading and decoding each image on the fly it is incredibly slow, so as to make the game unusable. I could convert each image into the maximum allowed 8x8 pixel sprites (e.g. a 16x16 pixel into four 8x8 sprites), and use display.sprite but that is a lot of recoding, and I’m not sure if it will be an improvement for the effort. Therefore, I wonder if it is possible to access the equivalent framebuffer being setup and used by the PicoGraphics driver/module, so that I use it in a similar way as my original code? I’ve used the Pico to learn MicroPython, and since PicoGraphics seems to be written in C and I’m not a C Programmer I can’t work it out if I want to do is possible and also how to implement it.
Thanks for any advice.