From aee2ac5b27baafd90c1eb337de1ae775514bb5eb Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Tue, 6 Aug 2024 01:38:28 -0400 Subject: [PATCH] Rename the hack spike of the game idea to its final name. Start a test of FTXUI for the game. --- watchgit.cpp => escape_turings_tarpit.cpp | 5 ++++- ftxtest.cpp | 24 +++++++++++++++++++++++ meson.build | 10 +++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) rename watchgit.cpp => escape_turings_tarpit.cpp (98%) create mode 100644 ftxtest.cpp diff --git a/watchgit.cpp b/escape_turings_tarpit.cpp similarity index 98% rename from watchgit.cpp rename to escape_turings_tarpit.cpp index e7e4268..33a40bf 100644 --- a/watchgit.cpp +++ b/escape_turings_tarpit.cpp @@ -24,7 +24,10 @@ const auto ERROR = fmt::emphasis::bold | fg(fmt::color::red); class GameEngine { int hit_points = 0; map damage_types{ - {"error", 4}, {"warning", 1}}; + {"error", 4}, + {"warning", 1}, + {"note", 1}, + }; public: GameEngine(int hp) : hit_points(hp) {}; diff --git a/ftxtest.cpp b/ftxtest.cpp new file mode 100644 index 0000000..017fb2b --- /dev/null +++ b/ftxtest.cpp @@ -0,0 +1,24 @@ +#include +#include +#include + +int main(void) { + using namespace ftxui; + + // Define the document + Element document = + hbox({ + text("left") | border, + text("middle") | border | flex, + text("right") | border, + }); + + auto screen = Screen::Create( + Dimension::Full(), // Width + Dimension::Fit(document) // Height + ); + Render(screen, document); + screen.Print(); + + return EXIT_SUCCESS; +} diff --git a/meson.build b/meson.build index 25dbab8..24375f0 100644 --- a/meson.build +++ b/meson.build @@ -17,13 +17,21 @@ efsw_proj = cmake.subproject('efsw') efsw_dep = efsw_proj.dependency('efsw') fmt = dependency('fmt') +ftxui_screen = dependency('ftxui-screen') +ftxui_dom = dependency('ftxui-dom') +ftxui_component = dependency('ftxui-component') dependencies = [ fmt, libgit2package_dep, efsw_dep, + ftxui_screen, ftxui_dom, ftxui_component ] -executable('watchgit', 'watchgit.cpp', +executable('escape_turings_tarpit', + 'escape_turings_tarpit.cpp', dependencies: dependencies) executable('regtest', 'regtest.cpp', dependencies: [fmt]) + +executable('ftxtest', 'ftxtest.cpp', + dependencies: dependencies)