https://kotlinlang.org logo
Title
a

abbic

04/03/2022, 10:33 AM
Hi all, i'm trying to render 16x16 px tiles on a compose Canvas. Im unsure about how do do this in a relatively sane manner (i know that probably anything i try will be "good enough"), my thoughts are to create ImageBitmaps for each tile on start (complicated by the fact that the tiles are saved onto a single png, im assuming i can slice an ImageBitmap of the sprite sheet) and draw them individually onto the Canvas, but do thoughts jump out to anyone?
I just found a BitmapPainter, which has srcOffset and srcSize parameters (ideal for isolating a single tile in a spritesheet). I might have to create a map of tile index to Bitmap painter so that i dont create as many of these as there are tiles on screen every frame