Files
palera1n/src/tui_screen_main.c
T

40 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;
2023-02-05 03:00:29 +08:00
newtCenteredWindow(WIDTH, HEIGHT, NULL);
2023-02-05 02:42:12 +08:00
newtComponent optionsButton = newtCompactButton(46, 17, "Options");
newtComponent startButton = newtCompactButton(57, 17, "Start");
newtComponent exitButton = newtCompactButton(66, 17, "Exit");
2023-02-04 21:29:49 +08:00
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
}
2023-02-05 02:42:12 +08:00
newtFormDestroy(form);
2023-01-29 01:02:47 +08:00
return ret;
2023-01-28 20:41:18 +08:00
}