A better starter for the project.

main
Zed A. Shaw 2 months ago
parent ad143dca05
commit 6afb13a50b
  1. 72
      main.cpp

@ -1,39 +1,53 @@
#include <iostream> // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
#include <ftxui/dom/elements.hpp> // the LICENSE file.
#include <ftxui/screen/screen.hpp> #include <chrono> // for operator""s, chrono_literals
#include <ftxui/screen/string.hpp> #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <iostream> // for cout, ostream
#include <memory> // for allocator, shared_ptr
#include <string> // for string, operator<<
#include <thread> // 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
using namespace std::chrono_literals;
int main() { int main() {
using namespace ftxui; using namespace ftxui;
std::string p =
auto summary = [&] { 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.)";
auto content = vbox({
hbox({text(L"- done: "), text(L"3") | bold}) | color(Color::Green), std::string reset_position;
hbox({text(L"- active: "), text(L"2") | bold}) | color(Color::RedLight), while (true) {
hbox({text(L"- queue: "), text(L"9") | bold}) | color(Color::Red), auto document = vbox({
}); hflow(paragraph(p)),
return window(text(L" Summary "), content); separator(),
}; hflow(paragraph(p)),
separator(),
auto document = //
vbox({
hbox({ hbox({
summary(), hflow(paragraph(p)),
summary(), separator(),
summary() | flex, hflow(paragraph(p)),
}), }),
summary(), }) |
summary(), border;
});
document = vbox(filler(), document);
// Limit the size of the document to 80 char. // auto screen = Screen::Create(Dimension::Fit(document));
document = document | size(WIDTH, LESS_THAN, 80); // Render(screen, document);
// screen.Print();
// getchar();
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document)); auto screen = Screen::Create(Dimension::Full());
Render(screen, document); Render(screen, document);
std::cout << reset_position;
screen.Print();
reset_position = screen.ResetPosition();
std::cout << screen.ToString() << '\0' << std::endl; std::this_thread::sleep_for(0.01s);
}
return EXIT_SUCCESS; return 0;
} }

Loading…
Cancel
Save