Implement main menu and layout switching in TUI; add components for applying BPS patches, loading ROMs, and palette editing

This commit is contained in:
scawful
2025-01-18 16:13:02 -05:00
parent c1a9b49f69
commit 444907ee4e
2 changed files with 222 additions and 34 deletions

View File

@@ -4,22 +4,49 @@
#include <ftxui/component/component.hpp>
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <string>
#include <vector>
#include "app/rom.h"
namespace yaze {
namespace cli {
struct Context {
bool is_loaded = false;
ftxui::Component layout;
ftxui::Component main_component;
const std::vector<std::string> kMainMenuEntries = {
"Apply BPS Patch",
"Generate Save File",
"Load ROM",
"Palette Editor",
"Exit",
};
void ShowMain();
enum class MainMenuEntry {
kApplyBpsPatch,
kGenerateSaveFile,
kLoadRom,
kPaletteEditor,
kExit,
};
void DrawPaletteEditor(Rom *rom);
enum LayoutID {
kApplyBpsPatch,
kGenerateSaveFile,
kLoadRom,
kPaletteEditor,
kExit,
kMainMenu,
kError,
};
struct Context {
Rom rom;
LayoutID current_layout = LayoutID::kMainMenu;
std::string error_message;
};
static Context app_context;
void ShowMain();
} // namespace cli
} // namespace yaze