mirror of
https://github.com/AntonioND/palib.git
synced 2025-06-18 14:45:43 -04:00
56 lines
1.2 KiB
C
56 lines
1.2 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, 2, 6, "Touch the screen to resize !");
|
|
|
|
// First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx
|
|
gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS);
|
|
|
|
// Create sprite...
|
|
PA_3DCreateSpriteFromTex(0, // Sprite number
|
|
gfx[0], // Gfx...
|
|
64, 64, // Width, Height
|
|
0, // Palette
|
|
128, 96); // X, Y SPRITE CENTER !
|
|
|
|
while(1) {
|
|
if(Stylus.Held){ // Resize if held...
|
|
if(Stylus.X >= 128) PA_3DSetSpriteWidth(0, (Stylus.X-128)*2);
|
|
else PA_3DSetSpriteWidth(0, (128-Stylus.X)*2);
|
|
if(Stylus.Y >= 96) PA_3DSetSpriteHeight(0, (Stylus.Y-96)*2);
|
|
else PA_3DSetSpriteHeight(0, (96-Stylus.Y)*2);
|
|
|
|
}
|
|
|
|
|
|
PA_WaitForVBL();
|
|
PA_3DProcess(); // Update sprites
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
} // End of main()
|