FTXUI/examples/dom/window.cpp

29 lines
1.1 KiB
C++
Raw Normal View History

#include <ftxui/dom/elements.hpp> // for operator|, color, Element, bgcolor, graph, border
#include <ftxui/screen/screen.hpp> // for Fixed, Screen
#include <vector> // for vector
2021-05-02 02:40:35 +08:00
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, Color::DarkBlue, Color::Green, Color::Red
2020-05-25 07:34:13 +08:00
2020-10-17 04:31:24 +08:00
int main(void) {
2020-05-25 07:34:13 +08:00
using namespace ftxui;
2020-10-17 04:31:24 +08:00
Element document = graph([](int x, int y) {
std::vector<int> result(x, 0);
for (int i{0}; i < x; ++i) {
result[i] = ((3 * i) / 2) % y;
}
return result;
}) |
color(Color::Red) | border | color(Color::Green) |
bgcolor(Color::DarkBlue);
auto screen = Screen::Create(Dimension::Fixed(80), Dimension::Fixed(10));
2020-05-25 07:34:13 +08:00
Render(screen, document);
2021-03-22 05:54:39 +08:00
screen.Print();
2020-05-25 07:34:13 +08:00
}
2020-09-06 19:46:56 +08:00
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.