mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-24 15:52:20 +00:00
Allow different texture format
This commit is contained in:
parent
6795c0b1ce
commit
7d08f7eed5
4 changed files with 4 additions and 1 deletions
|
@ -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->data = (u8*)(my_tpl + pos);
|
||||||
my_texture->w = imghead->width;
|
my_texture->w = imghead->width;
|
||||||
my_texture->h = imghead->height;
|
my_texture->h = imghead->height;
|
||||||
|
my_texture->format = imghead->fmt;
|
||||||
my_texture->freedata = true;
|
my_texture->freedata = true;
|
||||||
GRRLIB_SetHandle( my_texture, 0, 0 );
|
GRRLIB_SetHandle( my_texture, 0, 0 );
|
||||||
GRRLIB_FlushTex( my_texture );
|
GRRLIB_FlushTex( my_texture );
|
||||||
|
|
|
@ -96,6 +96,7 @@ int main() {
|
||||||
|
|
||||||
GRRLIB_texImg *tex_test_tpl1 = GRRLIB_LoadTextureTPL(textures_tpl, textures_tpl_size, ballsprites);
|
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_tpl2 = GRRLIB_LoadTextureTPL(textures_tpl, textures_tpl_size, pirate);
|
||||||
|
GRRLIB_texImg *tex_test_tpl3 = GRRLIB_LoadTextureTPL(textures_tpl, textures_tpl_size, girl);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
WPAD_SetVRes(0, 640, 480);
|
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(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, 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
|
// Draw a sprite
|
||||||
GRRLIB_DrawTile(600, 400, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupee
|
GRRLIB_DrawTile(600, 400, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupee
|
||||||
|
|
BIN
examples/basic_drawing/textures/girl.png
Normal file
BIN
examples/basic_drawing/textures/girl.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 154 KiB |
|
@ -1,2 +1,3 @@
|
||||||
<filepath="ballsprites.png" id="ballsprites" colfmt=6 />
|
<filepath="ballsprites.png" id="ballsprites" colfmt=6 />
|
||||||
<filepath="pirate.png" id="pirate" colfmt=6 />
|
<filepath="pirate.png" id="pirate" colfmt=6 />
|
||||||
|
<filepath="girl.png" id="girl" colfmt=5 />
|
||||||
|
|
Loading…
Reference in a new issue