botw-completer/source/ui_basic.c
badbl0cks 4ece8c1922
Implement functional menu system
- Add button-driven menu with multiple options
- Wire up A button to add all Korok pins
- Connect B button to count existing pins
- Auto-initialize save system on startup
- Cleaner main loop without manual save testing
2023-05-19 15:33:48 -07:00

60 lines
No EOL
1.5 KiB
C

#include <stdio.h>
#include <stdarg.h>
#include <switch.h>
#include "ui_basic.h"
#include "data_basic.h"
#include "map_basic.h"
static void addKorokPins() {
printMessage("Adding Korok seed pins...\n");
for (int i = 0; i < KOROK_COUNT; i++) {
addMapPin(MAP_PIN_LEAF, KOROKS[i]);
}
printMessage("Added %d Korok pins!\n", KOROK_COUNT);
}
static void testFunction() {
printMessage("Test function called!\n");
}
void initUI() {
printf("\x1b[2J"); // Clear screen
printf("\x1b[1;1H"); // Move cursor to top-left
printf("═══════════════════════════════════════\n");
printf(" BOTW Completer v0.4\n");
printf("═══════════════════════════════════════\n");
printf("\n");
printf("Menu:\n");
printf("A - Add Korok pins\n");
printf("B - Count map pins\n");
printf("Y - Test function\n");
printf("+ - Exit\n");
printf("\n");
}
void printMessage(const char* message, ...) {
va_list args;
va_start(args, message);
vprintf(message, args);
va_end(args);
}
bool handleButtonPress(u64 button) {
if (button & HidNpadButton_Plus) {
return true; // Exit requested
}
if (button & HidNpadButton_A) {
addKorokPins();
}
if (button & HidNpadButton_B) {
countMapPins();
}
if (button & HidNpadButton_Y) {
testFunction();
}
return false; // Continue running
}