Add Blink. Refactor examples.

This commit is contained in:
Arthur Sonzogni
2019-01-02 22:33:59 +01:00
parent 20eaeae4c3
commit 13e04176a4
32 changed files with 122 additions and 116 deletions

View File

@@ -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)

View File

@@ -1,4 +0,0 @@
add_executable(color_main
main.cpp
)
target_link_libraries(color_main PRIVATE ftxui)

View File

@@ -0,0 +1,6 @@
example(color)
example(gauge)
example(input)
example(menu)
example(menu2)
example(toggle)

View File

@@ -54,7 +54,5 @@ int main(int argc, const char *argv[])
std::cout << screen.ToString();
getchar();
return 0;
}

View File

@@ -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();

View File

@@ -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()
)
),

View File

@@ -0,0 +1,3 @@
example(frame)
example(separator)
example(vbox_hbox)

View File

@@ -19,7 +19,6 @@ int main(int argc, const char *argv[])
Render(screen, document.get());
std::cout << screen.ToString();
getchar();
return 0;

View File

@@ -32,7 +32,5 @@ int main(int argc, const char *argv[])
std::cout << screen.ToString();
getchar();
return 0;
}

View File

@@ -1,4 +0,0 @@
add_executable(frame_example
main.cpp
)
target_link_libraries(frame_example PRIVATE ftxui)

View File

@@ -1,4 +0,0 @@
add_executable(gauge_example
main.cpp
)
target_link_libraries(gauge_example PRIVATE ftxui)

View File

@@ -1,4 +0,0 @@
add_executable(input_main
main.cpp
)
target_link_libraries(input_main PRIVATE ftxui)

View File

@@ -1,4 +0,0 @@
add_executable(menu_main
main.cpp
)
target_link_libraries(menu_main PRIVATE ftxui)

View File

@@ -1,4 +0,0 @@
add_executable(menu2_main
main.cpp
)
target_link_libraries(menu2_main PRIVATE ftxui)

View File

@@ -1,4 +0,0 @@
add_executable(print_key_press
main.cpp
)
target_link_libraries(print_key_press PRIVATE ftxui)

View File

@@ -1,4 +0,0 @@
add_executable(separator_example
main.cpp
)
target_link_libraries(separator_example PRIVATE ftxui)

View File

@@ -1,4 +0,0 @@
add_executable(toogle_main
main.cpp
)
target_link_libraries(toogle_main PRIVATE ftxui)

View File

@@ -1,4 +0,0 @@
add_executable(vbox_hbox_example
main.cpp
)
target_link_libraries(vbox_hbox_example PRIVATE ftxui)