Created
December 18, 2023 15:05
-
-
Save iglesias/1cc0c115aca8c8086751d392a28a8028 to your computer and use it in GitHub Desktop.
FTXUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ftxui/component/component.hpp" // for Renderer, CatchEvent, Horizontal, Menu, Tab | |
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive | |
#include <ftxui/dom/elements.hpp> // for canvas, Element, separator, hbox, operator|, border | |
int main() | |
{ | |
auto renderer_text = ftxui::Renderer([&] { | |
auto c = ftxui::Canvas(100, 100); | |
c.DrawText(0, 0, "A piece of text", | |
[](ftxui::Pixel& p) { | |
p.foreground_color = ftxui::Color::Blue; | |
p.underlined = true; | |
p.bold = true; | |
}); | |
return canvas(std::move(c)); | |
}); | |
auto screen = ftxui::ScreenInteractive::FitComponent(); | |
screen.Loop(renderer_text); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include = -IFTXUI/include | |
CXXFLAGS = -Wall -Wextra -pedantic -std=c++20 $(include) | |
LDFLAGS = -LFTXUI/build | |
LDLIBS = -lftxui-component -lftxui-dom -lftxui-screen | |
TARGET = learn_ftxui | |
all: $(TARGET) | |
$(TARGET): learn_ftxui.cpp | |
$(CXX) $(CXXFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS) | |
clean: | |
rm -f $(TARGET) |
-> figure out automatic canvas updates to draw dynamics as in the htop, spinner, gauge examples shown at https://github.com/ArthurSonzogni/FTXUI
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://arthursonzogni.github.io/FTXUI/#modules
https://www.gnu.org/software/make/manual/make.html#Implicit-Variables