#include <stdio.h>
#include <3ds.h>
volatile bool runThread = true;
volatile bool gfx_isinit = false;
void threadMain(void *arg) {
gfxInitDefault();
consoleInit(GFX_TOP, NULL);
gfx_isinit = true;
while(runThread) {
gfxFlushBuffers();
gfxSwapBuffers();
gspWaitForVBlank();
}
gfxExit();
}
int main(int argc, char* argv[])
{
Thread threadHandle = threadCreate(threadMain, 0, 4 * 1024, 0x19, -2, false);
while (!gfx_isinit) svcSleepThread(10000000);
printf("\n\nPress START to quit\nHOME-button does not work\n");
// Main loop
while (aptMainLoop())
{
hidScanInput();
u32 kDown = hidKeysDown();
if (kDown & KEY_START)
break; // break in order to return to hbmenu
}
runThread = false;
threadJoin(threadHandle, U64_MAX);
threadFree(threadHandle);
return 0;
}