FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
html_like.cpp
Go to the documentation of this file.
1// Copyright 2020 Arthur Sonzogni. Todos los derechos reservados.
2// El uso de este código fuente se rige por la licencia MIT que se puede encontrar en
3// el archivo LICENSE.
4#include <chrono> // for operator""s, chrono_literals
5#include <ftxui/screen/screen.hpp> // for Screen
6#include <iostream> // for cout, ostream
7#include <string> // for allocator, operator<<, string
8#include <thread> // for sleep_for
9
10#include "ftxui/dom/elements.hpp" // for paragraph, text, operator|, Element, border, Fit, color, hflow, spinner, vbox, bold, dim, underlined
11#include "ftxui/dom/node.hpp" // for Render
12#include "ftxui/screen/box.hpp" // for ftxui
13#include "ftxui/screen/color.hpp" // for Color, Color::Red
14
15int main() {
16 using namespace ftxui;
17 using namespace std::chrono_literals;
18
19 auto img1 = []() { return text("img") | border; };
20 auto img2 = []() { return vbox({text("big"), text("image")}) | border; };
21
22 std::string reset_position;
23 for (int i = 0;; ++i) {
24 auto document = //
25 hflow(
26 paragraph("¡Hola mundo! Aquí hay una imagen:"), img1(),
27 paragraph(" Aquí hay un texto "), text("subrayado ") | underlined,
28 paragraph(" Aquí hay un texto "), text("negrita ") | bold,
29 paragraph("Hello world! Here is an image:"), img2(),
30 paragraph(
31 "Lorem Ipsum es simplemente un texto falso utilizado en la "
32 "composición y maquetación antes de la impresión. Lorem "
33 "Ipsum ha sido el texto de relleno estándar de la industria "
34 "desde el año 1500, cuando un impresor desconocido tomó una "
35 "galera de tipos y la mezcló de tal manera que logró hacer un "
36 "libro de muestras tipográficas. No solo sobrevivió 500 años, "
37 "sino que también se adaptó a la tipografía electrónica, "
38 "permaneciendo esencialmente sin cambios. Fue popularizado en "
39 "los años 60 con la publicación de hojas \"Letraset\" que "
40 "contenían pasajes de Lorem Ipsum, y más recientemente con el "
41 "software de autoedición, como Aldus PageMaker, que incluye "
42 "versiones de Lorem Ipsum."),
43 paragraph(" Aquí hay un texto "), text("tenue ") | dim,
44 paragraph("¡Hola mundo! Aquí hay una imagen:"), img1(),
45 paragraph(" Aquí hay un texto "), text("rojo ") | color(Color::Red),
46 paragraph(" Un spinner "), spinner(6, i / 10)) |
47 border;
48
49 auto screen = Screen::Create(Dimension::Fit(document));
50 Render(screen, document);
51 std::cout << reset_position;
52 screen.Print();
53 reset_position = screen.ResetPosition();
54
55 std::this_thread::sleep_for(0.01s);
56 }
57
58 return 0;
59}
auto screen
Element vbox(Elements children)
Un contenedor que muestra elementos verticalmente uno por uno.
Definition vbox.cpp:95
int main()
Definition html_like.cpp:15
El espacio de nombres ftxui:: de FTXUI.
Definition animation.hpp:10