diff --git a/Makefile b/Makefile index 71748e0..abbe998 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,8 @@ build: test: build ./builddir/runtests -install: build test - powershell "cp ./builddir/subprojects/libgit2-1.8.1/liblibgit2package.dll ." - powershell "cp ./builddir/subprojects/efsw/libefsw.dll ." - powershell "cp builddir/escape_turings_tarpit.exe ." +run: build test + ./builddir/roguish clean: meson compile --clean -C builddir diff --git a/main.cpp b/main.cpp index f39cb53..067e227 100644 --- a/main.cpp +++ b/main.cpp @@ -8,40 +8,60 @@ #include // for string, operator<< #include // for sleep_for -#include "ftxui/dom/elements.hpp" // for hflow, paragraph, separator, hbox, vbox, filler, operator|, border, Element -#include "ftxui/dom/node.hpp" // for Render -#include "ftxui/screen/box.hpp" // for ftxui +#include // for hflow, paragraph, separator, hbox, vbox, filler, operator|, border, Element +#include // for Render +#include // for ftxui +#include using namespace std::chrono_literals; + +std::array tiles = { +"##########", +"# #", +"# #", +"# |", +"# #", +"##########", +}; + int main() { using namespace ftxui; - std::string p = - R"(In probability theory and statistics, Bayes' theorem (alternatively Bayes' law or Bayes' rule) describes the probability of an event, based on prior knowledge of conditions that might be related to the event. For example, if cancer is related to age, then, using Bayes' theorem, a person's age can be used to more accurately assess the probability that they have cancer, compared to the assessment of the probability of cancer made without knowledge of the person's age. One of the many applications of Bayes' theorem is Bayesian inference, a particular approach to statistical inference. When applied, the probabilities involved in Bayes' theorem may have different probability interpretations. With the Bayesian probability interpretation the theorem expresses how a subjective degree of belief should rationally change to account for availability of related evidence. Bayesian inference is fundamental to Bayesian statistics.)"; - std::string reset_position; + + auto c = Canvas(100, 100); + + // A triangle following the mouse, using braille characters. + auto map = Renderer([&] { + for(size_t i = 0; i < tiles.size(); ++i) { + c.DrawText(50, 50+i*4, tiles[i]); + } + + for(size_t i = 0; i < tiles[0].size() - 2; i++) { + for(size_t j = 0; j < tiles.size() - 2; j++) { + c.DrawText(52+i*2, 54+j*4, ".", Color::Yellow); + } + } + + c.DrawText(50+3*4, 50+3*4, "@", Color::Blue); + + return canvas(c); + }); + while (true) { - auto document = vbox({ - hflow(paragraph(p)), - separator(), - hflow(paragraph(p)), - separator(), - hbox({ - hflow(paragraph(p)), - separator(), - hflow(paragraph(p)), - }), - }) | - border; - - document = vbox(filler(), document); - - // auto screen = Screen::Create(Dimension::Fit(document)); - // Render(screen, document); - // screen.Print(); - // getchar(); + auto document = hbox({ + hflow( + vbox( + gauge(0.5) | border, + text("STATUS") | border + ) | xflex_grow + ), + separator(), + hflow(map->Render()), + }) | border; auto screen = Screen::Create(Dimension::Full()); Render(screen, document); + std::cout << reset_position; screen.Print(); reset_position = screen.ResetPosition(); diff --git a/status.txt b/status.txt new file mode 100644 index 0000000..804af08 --- /dev/null +++ b/status.txt @@ -0,0 +1,8 @@ +* Research how hard to create a non-terminal/graphic backend to FTXUI. +* Look into font rendering libraries. +* Get a basic UI in FTX with a stat panel and map. +* Fill the map with something. +* Dijkstra's algorithm for the map. +* https://github.com/HenrYxZ/dijkstra-map/blob/main/dijkstra_map.py +* Look at a few more rogue games +* Lua integration