mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-06-24 08:01:13 +08:00

Some checks are pending
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (cl, cl, windows-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (clang, clang++, macos-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (clang, clang++, ubuntu-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (gcc, g++, macos-latest) (push) Waiting to run
Build / Bazel, ${{ matrix.cxx }}, ${{ matrix.os }} (gcc, g++, ubuntu-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (cl, Windows MSVC, windows-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (gcc, Linux GCC, ubuntu-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (llvm, llvm-cov gcov, Linux Clang, ubuntu-latest) (push) Waiting to run
Build / CMake, ${{ matrix.compiler }}, ${{ matrix.os }} (llvm, llvm-cov gcov, MacOS clang, macos-latest) (push) Waiting to run
Documentation / documentation (push) Waiting to run
89 lines
2.8 KiB
Markdown
89 lines
2.8 KiB
Markdown
@mainpage Introduction
|
|
@tableofcontents
|
|
|
|
<img src="https://github.com/ArthurSonzogni/FTXUI/assets/4759106/6925b6da-0a7e-49d9-883c-c890e1f36007" alt="Demo image"></img>
|
|
|
|
**FTXUI** is simple cross-platform C++ library for terminal based user interfaces!
|
|
|
|
# Feature
|
|
* Functional style. Inspired by
|
|
[1](https://hackernoon.com/building-reactive-terminal-interfaces-in-c-d392ce34e649?gi=d9fb9ce35901)
|
|
and [React](https://reactjs.org/)
|
|
* No dependencies
|
|
* **Cross platform**.
|
|
* Simple and elegant syntax (in my opinion)
|
|
* Keyboard & mouse navigation.
|
|
* Support for [UTF8](https://en.wikipedia.org/wiki/UTF-8) and [fullwidth chars](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) (→ 测试)
|
|
* Support for animations. [Demo 1](https://arthursonzogni.github.io/FTXUI/examples/?file=component/menu_underline_animated_gallery), [Demo 2](https://arthursonzogni.github.io/FTXUI/examples/?file=component/button_style)
|
|
* Support for drawing. [Demo](https://arthursonzogni.github.io/FTXUI/examples/?file=component/canvas_animated)
|
|
* Learn by [examples](#documentation), and [tutorials](#documentation)
|
|
* Multiple build system and packages:
|
|
* Good practices: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc...
|
|
|
|
# Example
|
|
|
|
```cpp
|
|
#include <ftxui/dom/elements.hpp>
|
|
#include <ftxui/screen/screen.hpp>
|
|
#include <iostream>
|
|
|
|
int main() {
|
|
using namespace ftxui;
|
|
|
|
// Create a simple document with three text elements.
|
|
Element document = hbox({
|
|
text("left") | border,
|
|
text("middle") | border | flex,
|
|
text("right") | border,
|
|
});
|
|
|
|
// Create a screen with full width and height fitting the document.
|
|
auto screen = Screen::Create(
|
|
Dimension::Full(), // Width
|
|
Dimension::Fit(document) // Height
|
|
);
|
|
|
|
// Render the document onto the screen.
|
|
Render(screen, document);
|
|
|
|
// Print the screen to the console.
|
|
screen.Print();
|
|
}
|
|
```
|
|
|
|
Expected output:
|
|
|
|
```
|
|
┌────┐┌────────────────────────────────────┐┌─────┐
|
|
│left││middle ││right│
|
|
└────┘└────────────────────────────────────┘└─────┘
|
|
```
|
|
|
|
# Supported Platforms
|
|
|
|
- Linux
|
|
- MacOS
|
|
- Windows
|
|
- WebAssembly
|
|
|
|
<div class="section_buttons">
|
|
|
|
| Next |
|
|
|--------------------------------------:|
|
|
| [Getting Started](getting-started.html) |
|
|
|
|
</div>
|
|
|
|
@defgroup screen ftxui/screen
|
|
|
|
Please check the [tutorial](module-screen.html) of the `ftxui/screen` module.
|
|
|
|
@defgroup dom ftxui/dom
|
|
|
|
Please check the [tutorial](module-dom.html) of the `ftxui/dom` module.
|
|
|
|
@defgroup component ftxui/component
|
|
|
|
Please check the [tutorial](module-component.html) of the `ftxui/component`
|
|
module.
|