real
This commit is contained in:
parent
c81f6a200a
commit
8470905df9
@ -10,7 +10,6 @@ big6.png
|
|||||||
big7.png
|
big7.png
|
||||||
big8.png
|
big8.png
|
||||||
big9.png
|
big9.png
|
||||||
big10.png
|
|
||||||
bg.png
|
bg.png
|
||||||
floor.png
|
floor.png
|
||||||
logo.png
|
logo.png
|
||||||
|
Binary file not shown.
108
source/main.c
108
source/main.c
@ -84,74 +84,68 @@ void moveSprite(Sprite *spr, s16 dx, s16 dy) {
|
|||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
// Init libs
|
// Init libs
|
||||||
romfsInit();
|
romfsInit();
|
||||||
gfxInitDefault();
|
gfxInitDefault();
|
||||||
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
|
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
|
||||||
C2D_Init(C2D_DEFAULT_MAX_OBJECTS);
|
C2D_Init(C2D_DEFAULT_MAX_OBJECTS);
|
||||||
C2D_Prepare();
|
C2D_Prepare();
|
||||||
consoleInit(GFX_BOTTOM, NULL);
|
consoleInit(GFX_BOTTOM, NULL);
|
||||||
|
|
||||||
// Create screens
|
// Create screens
|
||||||
C3D_RenderTarget* top = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT);
|
C3D_RenderTarget* top = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT);
|
||||||
// C3D_RenderTarget* bottom = C2D_CreateScreenTarget(GFX_BOTTOM, GFX_LEFT);
|
|
||||||
|
|
||||||
// Load graphics
|
// Load graphics
|
||||||
spriteSheet = C2D_SpriteSheetLoad("romfs:/gfx/sprites.t3x");
|
spriteSheet = C2D_SpriteSheetLoad("romfs:/gfx/sprites.t3x");
|
||||||
if (!spriteSheet) {
|
if (!spriteSheet) {
|
||||||
printf("No");
|
printf("No");
|
||||||
// svcBreak(USERBREAK_PANIC);
|
// svcBreak(USERBREAK_PANIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize sprites
|
// Initialize sprites
|
||||||
initSprites();
|
initSprites();
|
||||||
|
|
||||||
// score sprite & int
|
// score sprite & int
|
||||||
int score = 0;
|
int score = 0;
|
||||||
Sprite scoreSprite;
|
Sprite scoreSprite;
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
while (aptMainLoop())
|
while (aptMainLoop())
|
||||||
{
|
{
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
|
|
||||||
// Respond to user input
|
// Respond to user input
|
||||||
u32 kDown = hidKeysDown();
|
u32 kDown = hidKeysDown();
|
||||||
if (kDown & KEY_START)
|
if (kDown & KEY_START)
|
||||||
break; // break in order to return to hbmenu
|
break; // break in order to return to hbmenu
|
||||||
|
|
||||||
|
|
||||||
// get circlepad position
|
// Render the scene
|
||||||
circlePosition cpos;
|
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||||
hidCircleRead(&cpos);
|
C2D_TargetClear(top, C2D_Color32f(0.2352941176f, 0.8392156863f, 0.8392156863f, 1.0f));
|
||||||
// move spr based on it
|
C2D_SceneBegin(top);
|
||||||
moveSprite(&sprites[0], cpos.dx, cpos.dy);
|
|
||||||
|
|
||||||
printf("Bird Pos: %f, %f\n", sprites[0].x, sprites[0].y);
|
C2D_SpriteSetPos(&sprites[12].spr, 200, 120); // center bg
|
||||||
|
C2D_DrawSprite(&sprites[12].spr);
|
||||||
|
|
||||||
// Render the scene
|
C2D_DrawSprite(&sprites[0].spr);
|
||||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
C3D_FrameEnd(0);
|
||||||
C2D_TargetClear(top, C2D_Color32f(0.2352941176f, 0.8392156863f, 0.8392156863f, 1.0f));
|
|
||||||
C2D_SceneBegin(top);
|
|
||||||
|
|
||||||
C2D_DrawSprite(&sprites[0].spr);
|
// // Flush and swap framebuffers
|
||||||
C3D_FrameEnd(0);
|
// gfxFlushBuffers();
|
||||||
|
// gfxSwapBuffers();
|
||||||
|
|
||||||
// // Flush and swap framebuffers
|
// //Wait for VBlank
|
||||||
// gfxFlushBuffers();
|
// gspWaitForVBlank();
|
||||||
// gfxSwapBuffers();
|
}
|
||||||
|
|
||||||
// //Wait for VBlank
|
// Delete graphics
|
||||||
// gspWaitForVBlank();
|
C2D_SpriteSheetFree(spriteSheet);
|
||||||
}
|
|
||||||
|
|
||||||
// Delete graphics
|
// Deinit libs
|
||||||
C2D_SpriteSheetFree(spriteSheet);
|
C2D_Fini();
|
||||||
|
C3D_Fini();
|
||||||
// Deinit libs
|
gfxExit();
|
||||||
C2D_Fini();
|
romfsExit();
|
||||||
C3D_Fini();
|
return 0;
|
||||||
gfxExit();
|
|
||||||
romfsExit();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user