From b0527b4d472115e8bdc058fec74f092a96cec971 Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 2 Nov 2014 10:39:36 -0800 Subject: [PATCH] Migrate main app loop to ctrulib's new aptMainLoop(). --- source/main.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/source/main.c b/source/main.c index aed80c2..7882881 100644 --- a/source/main.c +++ b/source/main.c @@ -21,33 +21,24 @@ int main() clearScreens(); print(GFX_TOP, "Press A to begin...\n"); - APP_STATUS status; - while ((status = aptGetStatus()) != APP_EXITING) { - if (status == APP_RUNNING) { - drawFrames(); + while (aptMainLoop()) { + drawFrames(); - hidScanInput(); - if (hidKeysDown() & KEY_B) { + hidScanInput(); + if (hidKeysDown() & KEY_B) { + break; + } else if (hidKeysDown() & KEY_A) { + clearScreen(GFX_TOP); + + if (testCounter < (sizeof(tests) / sizeof(tests[0]))) { + tests[testCounter](); + testCounter++; + } else { break; - } else if (hidKeysDown() & KEY_A) { - clearScreen(GFX_TOP); - - if (testCounter < (sizeof(tests) / sizeof(tests[0]))) { - tests[testCounter](); - testCounter++; - } else { - break; - } - - print(GFX_TOP, "\n"); - print(GFX_TOP, "Press A to continue...\n"); } - } else if (status == APP_SUSPENDING) { - aptReturnToMenu(); - } else if (status == APP_SLEEPMODE) { - aptWaitStatusEvent(); - break; + print(GFX_TOP, "\n"); + print(GFX_TOP, "Press A to continue...\n"); } gspWaitForEvent(GSPEVENT_VBlank0, false);