mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-15 23:48:15 +08:00
Initial prototype
This commit is contained in:
1
examples/CMakeLists.txt
Normal file
1
examples/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
add_subdirectory(text)
|
4
examples/text/CMakeLists.txt
Normal file
4
examples/text/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
add_executable(main
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(main PRIVATE ftxui)
|
38
examples/text/main.cpp
Normal file
38
examples/text/main.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "ftxui/core/screen.hpp"
|
||||
#include "ftxui/core/dom/elements.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
using namespace ftxui::dom;
|
||||
auto root =
|
||||
vbox(
|
||||
hbox(
|
||||
text(L"north-west"),
|
||||
flex(),
|
||||
text(L"north-east")
|
||||
),
|
||||
flex(),
|
||||
hbox(
|
||||
hbox(
|
||||
flex(),
|
||||
text(L"center"),
|
||||
flex()
|
||||
)
|
||||
),
|
||||
flex(),
|
||||
hbox(
|
||||
text(L"south-west"),
|
||||
flex(),
|
||||
text(L"south-east")
|
||||
)
|
||||
);
|
||||
auto screen = ftxui::Screen::WholeTerminal();
|
||||
Render(screen, root.get());
|
||||
|
||||
std::cout << screen.ToString();
|
||||
|
||||
getchar();
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user