FTXUI/examples/dom/window.cpp

25 lines
830 B
C++
Raw Normal View History

2020-05-25 07:34:13 +08:00
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <iostream>
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.