- Add UI initialization to main loop - Use UI message system instead of direct printf - Improve exit handling with boolean flag - Add line buffering for better output
44 lines
No EOL
905 B
C
44 lines
No EOL
905 B
C
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <switch.h>
|
|
#include "save_basic.h"
|
|
#include "ui_basic.h"
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
|
|
consoleInit(NULL);
|
|
|
|
// Configure input
|
|
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
|
|
PadState pad;
|
|
padInitializeDefault(&pad);
|
|
|
|
// Initialize UI
|
|
initUI();
|
|
|
|
printMessage("Press A to test save loading\n");
|
|
printMessage("Press + to exit\n");
|
|
|
|
bool exit = false;
|
|
|
|
// Main loop
|
|
while(appletMainLoop() && !exit)
|
|
{
|
|
padUpdate(&pad);
|
|
u64 kDown = padGetButtonsDown(&pad);
|
|
|
|
exit = handleButtonPress(kDown);
|
|
|
|
if (kDown & HidNpadButton_A) {
|
|
openSave();
|
|
processSave();
|
|
}
|
|
|
|
consoleUpdate(NULL);
|
|
}
|
|
|
|
consoleExit(NULL);
|
|
return 0;
|
|
} |