Allow different texture format

This commit is contained in:
Crayon2000 2024-03-06 15:42:30 -05:00
parent 4215aa06c6
commit 08710a77d2
4 changed files with 4 additions and 1 deletions

View file

@ -216,6 +216,7 @@ GRRLIB_texImg* GRRLIB_LoadTextureTPL (const u8 *my_tpl, const int size, u32 id)
my_texture->data = (u8*)(my_tpl + pos);
my_texture->w = imghead->width;
my_texture->h = imghead->height;
my_texture->format = imghead->fmt;
my_texture->freedata = true;
GRRLIB_SetHandle( my_texture, 0, 0 );
GRRLIB_FlushTex( my_texture );

View file

@ -96,6 +96,7 @@ int main() {
GRRLIB_texImg *tex_test_tpl1 = GRRLIB_LoadTextureTPL(textures_tpl, textures_tpl_size, ballsprites);
GRRLIB_texImg *tex_test_tpl2 = GRRLIB_LoadTextureTPL(textures_tpl, textures_tpl_size, pirate);
GRRLIB_texImg *tex_test_tpl3 = GRRLIB_LoadTextureTPL(textures_tpl, textures_tpl_size, girl);
while(1) {
WPAD_SetVRes(0, 640, 480);
@ -116,7 +117,7 @@ int main() {
GRRLIB_DrawImg(350, 50, tex_test_bmp, 0, 4, 4, GRRLIB_WHITE); // Draw a bitmap
GRRLIB_DrawImg(400, 200, tex_test_tpl1, 0, 2, 2, GRRLIB_WHITE); // Draw a TPL
GRRLIB_DrawImg(400, 300, tex_test_tpl2, 0, 1, 1, GRRLIB_WHITE); // Draw a TPL
GRRLIB_DrawImg(100, 200, tex_test_tpl3, 0, 1, 1, GRRLIB_WHITE); // Draw a TPL
// Draw a sprite
GRRLIB_DrawTile(600, 400, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupee

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

View file

@ -1,2 +1,3 @@
<filepath="ballsprites.png" id="ballsprites" colfmt=6 />
<filepath="pirate.png" id="pirate" colfmt=6 />
<filepath="girl.png" id="girl" colfmt=5 />