mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-15 23:48:15 +08:00
Add Blink. Refactor examples.
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
add_subdirectory(color)
|
||||
add_subdirectory(frame)
|
||||
add_subdirectory(gauge)
|
||||
add_subdirectory(input)
|
||||
add_subdirectory(menu)
|
||||
add_subdirectory(menu2)
|
||||
add_subdirectory(print_key_press)
|
||||
add_subdirectory(separator)
|
||||
add_subdirectory(toggle)
|
||||
add_subdirectory(vbox_hbox)
|
||||
function(example name)
|
||||
add_executable(${name} ${name}.cpp)
|
||||
target_link_libraries(${name} PUBLIC ftxui)
|
||||
endfunction(example)
|
||||
|
||||
add_subdirectory(component)
|
||||
add_subdirectory(dom)
|
||||
example(print_key_press)
|
||||
|
@@ -1,4 +0,0 @@
|
||||
add_executable(color_main
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(color_main PRIVATE ftxui)
|
6
examples/component/CMakeLists.txt
Normal file
6
examples/component/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
example(color)
|
||||
example(gauge)
|
||||
example(input)
|
||||
example(menu)
|
||||
example(menu2)
|
||||
example(toggle)
|
@@ -54,7 +54,5 @@ int main(int argc, const char *argv[])
|
||||
|
||||
std::cout << screen.ToString();
|
||||
|
||||
getchar();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -9,6 +9,7 @@
|
||||
|
||||
using namespace ftxui::component;
|
||||
using namespace ftxui::dom;
|
||||
using namespace ftxui;
|
||||
|
||||
class MyComponent : ComponentVertical {
|
||||
public:
|
||||
@@ -44,7 +45,7 @@ class MyComponent : ComponentVertical {
|
||||
};
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
ftxui::ScreenInteractive screen(60, 17);
|
||||
ftxui::ScreenInteractive screen(60, 5);
|
||||
MyComponent component(screen.delegate());
|
||||
component.on_enter = screen.ExitLoopClosure();
|
||||
screen.Loop();
|
@@ -43,6 +43,7 @@ class MyComponent : ComponentHorizontal {
|
||||
flex(
|
||||
vbox(
|
||||
hcenter(bold(text(L"Percentage by 10%"))),
|
||||
separator(),
|
||||
left_menu.Render()
|
||||
)
|
||||
),
|
||||
@@ -50,6 +51,7 @@ class MyComponent : ComponentHorizontal {
|
||||
flex(
|
||||
vbox(
|
||||
hcenter(bold(text(L"Percentage by 1%"))),
|
||||
separator(),
|
||||
right_menu.Render()
|
||||
)
|
||||
),
|
3
examples/dom/CMakeLists.txt
Normal file
3
examples/dom/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
example(frame)
|
||||
example(separator)
|
||||
example(vbox_hbox)
|
@@ -19,7 +19,6 @@ int main(int argc, const char *argv[])
|
||||
Render(screen, document.get());
|
||||
|
||||
std::cout << screen.ToString();
|
||||
|
||||
getchar();
|
||||
|
||||
return 0;
|
@@ -32,7 +32,5 @@ int main(int argc, const char *argv[])
|
||||
|
||||
std::cout << screen.ToString();
|
||||
|
||||
getchar();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,4 +0,0 @@
|
||||
add_executable(frame_example
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(frame_example PRIVATE ftxui)
|
@@ -1,4 +0,0 @@
|
||||
add_executable(gauge_example
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(gauge_example PRIVATE ftxui)
|
@@ -1,4 +0,0 @@
|
||||
add_executable(input_main
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(input_main PRIVATE ftxui)
|
@@ -1,4 +0,0 @@
|
||||
add_executable(menu_main
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(menu_main PRIVATE ftxui)
|
@@ -1,4 +0,0 @@
|
||||
add_executable(menu2_main
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(menu2_main PRIVATE ftxui)
|
@@ -1,4 +0,0 @@
|
||||
add_executable(print_key_press
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(print_key_press PRIVATE ftxui)
|
@@ -1,4 +0,0 @@
|
||||
add_executable(separator_example
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(separator_example PRIVATE ftxui)
|
@@ -1,4 +0,0 @@
|
||||
add_executable(toogle_main
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(toogle_main PRIVATE ftxui)
|
@@ -1,4 +0,0 @@
|
||||
add_executable(vbox_hbox_example
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(vbox_hbox_example PRIVATE ftxui)
|
Reference in New Issue
Block a user