devkitSMS icon indicating copy to clipboard operation
devkitSMS copied to clipboard

SMS_setTileatXY

Open xfixium opened this issue 1 year ago • 2 comments

#enhancement

Is there any way to assign tile flags to the target? In my use case, it would be nice if the target xy tile used the sprite palette instead of the background palette. I'd imagine if this were supported, that you would need to consider the other bits as well (flipping, priority, etc.. etc..)

Unless there's another function that would be better for this. I do like the simplicity of the function, when changing a single tile on the map. Thank you for your time.

xfixium avatar Apr 18 '24 04:04 xfixium

These are all the available flags, from SMSlib.h:

/* handy defines for tilemaps entry */
#define TILE_FLIPPED_X            0x0200
#define TILE_FLIPPED_Y            0x0400
#define TILE_USE_SPRITE_PALETTE   0x0800
#define TILE_PRIORITY             0x1000

so you can for instance do: SMS_setTileatXY (some_x, some_y, some_tile | TILE_USE_SPRITE_PALETTE) to set some tile on screen (at the location you want) using the sprite palette.

also remember that if you need to set some tiles in sequence you can use a single SMS_setNextTileatXY(x,y) followed by as many SMS_setTile(tile) as you need and it'll be way faster.

sverx avatar Apr 18 '24 08:04 sverx

Oh wow, I had no clue. Very nice! Thank you!

xfixium avatar Apr 18 '24 10:04 xfixium