palib/examples/3DSprites/Effects/3DFlips/source/main.c
2025-01-06 22:43:23 +00:00

54 lines
1.4 KiB
C

/*
// 3DCreateSprite
*/
// Includes
#include <PA9.h> // Include for PA_Lib
#include "all_gfx.h"
u16 gfx[3];
// Function: main()
int main()
{
PA_Init(); // Initializes PA_Lib
PA_Init3D(); // Uses Bg0
PA_Reset3DSprites();
// Initialise the text system on the top screen
PA_LoadDefaultText(0, 1);
PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen
PA_OutputSimpleText(1, 0, 6, "Move the Sprite with the stylus");
// First, create the gfx with the corresponding images and sizes. Images converted as 16bit sprites in PAGfx
gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS);
// Create 4 sprites for the different flips......
PA_3DCreateSpriteFromTex(0, gfx[0], 64, 64, 0, 80, 48); // X, Y SPRITE CENTER !
PA_3DCreateSpriteFromTex(1, gfx[0], 64, 64, 0, 80+96, 48); // X, Y SPRITE CENTER !
PA_3DCreateSpriteFromTex(2, gfx[0], 64, 64, 0, 80, 80+64); // X, Y SPRITE CENTER !
PA_3DCreateSpriteFromTex(3, gfx[0], 64, 64, 0, 80+96, 80+64); // X, Y SPRITE CENTER !
// Set the flips
PA_3DSetSpriteHflip(0, 0); PA_3DSetSpriteVflip(0, 0);
PA_3DSetSpriteHflip(1, 1); PA_3DSetSpriteVflip(1, 0);
PA_3DSetSpriteHflip(2, 0); PA_3DSetSpriteVflip(2, 1);
PA_3DSetSpriteHflip(3, 1); PA_3DSetSpriteVflip(3, 1);
while(1) {
PA_WaitForVBL();
PA_3DProcess(); // Update sprites
}
return 0;
} // End of main()