I'm using devkitpro, and I pretty much copied the gpusprites code, but I thought I could shorten it for my needs, apparently not. I should say I am very new to 3DS programming, but not programming in general.
The exception type is data abort, and on the Citra it ran fine but didn't show the sprite, but when I added the if statement under the spriteSheet loading line it said that there was a fatal error, but still let me continue if I wanted.
The exception type is data abort, and on the Citra it ran fine but didn't show the sprite, but when I added the if statement under the spriteSheet loading line it said that there was a fatal error, but still let me continue if I wanted.
C:
#include <citro2d.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SCREEN_WIDTH 400
#define SCREEN_HEIGHT 240
static C2D_SpriteSheet spriteSheet;
int main(int argc, char* argv[])
{
romfsInit();
gfxInitDefault();
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
C2D_Init(C2D_DEFAULT_MAX_OBJECTS);
C2D_Prepare();
consoleInit(GFX_BOTTOM, NULL);
C3D_RenderTarget* top = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT);
spriteSheet = C2D_SpriteSheetLoad("romfs:/gfx/chimken.t3x");
if (!spriteSheet) svcBreak(USERBREAK_PANIC); // <-- This causes issues on Citra!!
C2D_Sprite sprite;
C2D_SpriteFromSheet(&sprite, spriteSheet, 0);
C2D_SpriteSetCenter(&sprite, 0.5f, 0.5f);
C2D_SpriteSetPos(&sprite, 100, 120);
//C2D_SpriteSetScale(&sprite, 4,4);
printf("Press Start to quit");
// Main loop
while (aptMainLoop())
{
hidScanInput();
// Your code goes here
u32 kDown = hidKeysDown();
if (kDown & KEY_START)
break; // break in order to return to hbmenu
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, C2D_Color32f(0.0f,0.0f,0.0f,1.0f));
C2D_SceneBegin(top);
C2D_DrawSprite(&sprite);
C3D_FrameEnd(0);
}
C2D_SpriteSheetFree(spriteSheet);
C2D_Fini();
C3D_Fini();
gfxExit();
romfsExit();
return 0;
}
Last edited by Linc0,







