I see there is a tilemap class (https://github.com/pokitto/PokittoLib/tree/master/Pokitto/POKITTO_LIBS/Tilemap) but I have no idea how to use it. Has anyone got some simplified code that demonstrates its use?
Not in C++, but in Python. Micropython implementation is just a wrapper over the C++ Tilemap class, so it should be very helpful. Just open the online MP editor and select “Tilemap” from the Examples list.
https://pyinsky.herokuapp.com/
Thanks, that explains a lot.
I see the tiles are packed into a nibble (two per byte). Is it possible to have greater than 16 tiles?
Another question … you use blit()
to draw the character but this does not seem to be exposed through the class. Are you using a hacked version of the library that exposes the private method?
Actually, I have made just that fix for the MIB game You need to have #define MAX_TILE_COUNT 256
in My_settings.h
Tilemap.zip (2.2 KB)
I have also fixed it so that also MODE15 can use the optimized tile blitter.
I would make a PR for PokittolLib but I am still wondering if this should use runtime selection instead of a macro.
It ends up using the DrawBitmap()
in C++ as usual.
Nice.
I have converted your python project to C++ ‘exactly’ and have posted it here for others > https://github.com/filmote/TilemapCPP
Erm… did you remember to push the code?
Nope … but have now!