Files
palera1n/src/tui_screen_main.c
T

39 lines
1.2 KiB
C
Raw Normal View History

2023-01-28 20:41:18 +08:00
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <locale.h>
#include <unistd.h>
2023-01-29 01:02:47 +08:00
#include <assert.h>
2023-01-28 20:41:18 +08:00
2023-01-28 20:54:06 +08:00
#include <common.h>
#include <tui.h>
2023-01-28 20:41:18 +08:00
2023-01-29 13:08:48 +08:00
tui_screen_t tui_screen_main() {
2023-02-04 21:29:49 +08:00
int ret = MAIN_SCREEN;
bool can_start = false;
newtCenteredWindow(60, 16, "palera1n version 2.0.0");
newtComponent optionsButton = newtCompactButton(30, 14, "Options");
newtComponent startButton = newtCompactButton(41, 14, "Start");
newtComponent exitButton = newtCompactButton(50, 14, "Exit");
newtComponent welcome = newtLabel(1, 0, "Welcome to palera1n!");
newtComponent form = newtForm(NULL, NULL, 0);
newtFormAddComponents(form, optionsButton, startButton, exitButton, welcome, NULL);
newtRunForm(form);
newtRefresh();
newtComponent buttonPressed = newtFormGetCurrent(form);
if (buttonPressed == optionsButton) {
ret = OPTIONS_SCREEN;
} else if (buttonPressed == startButton) {
if (can_start)
ret = ENTER_RECOVERY_SCREEN;
else
ret = MAIN_SCREEN;
} else if (buttonPressed == exitButton) {
ret = EXIT_SCREEN;
2023-01-29 01:02:47 +08:00
}
return ret;
2023-01-28 20:41:18 +08:00
}