-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
|
||
include_directories(thirdparty) | ||
add_executable(cryptor cryptor.cpp) | ||
add_executable(cryptor cryptor.cpp) | ||
|
||
include(FetchContent) | ||
|
||
FetchContent_Declare(ftxui | ||
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui | ||
GIT_TAG v5.0.0 | ||
GIT_PROGRESS TRUE | ||
GIT_SHALLOW FALSE | ||
EXCLUDE_FROM_ALL | ||
FIND_PACKAGE_ARGS NAMES ftxui | ||
) | ||
|
||
FetchContent_Declare(nlohmann_json | ||
URL https://github.com/nlohmann/json/releases/download/v3.10.5/json.tar.xz | ||
EXCLUDE_FROM_ALL | ||
FIND_PACKAGE_ARGS NAMES nlohmann_json | ||
) | ||
|
||
FetchContent_GetProperties(ftxui) | ||
FetchContent_GetProperties(nlohmann_json) | ||
|
||
FetchContent_MakeAvailable(ftxui) | ||
FetchContent_MakeAvailable(nlohmann_json) | ||
|
||
add_executable(test_protocol_ui test_protocol_ui.cpp) | ||
# target_include_directories(test_protocol_ui ${ftxui_INCLUDE}) | ||
target_link_libraries(test_protocol_ui | ||
PRIVATE ftxui::screen | ||
PRIVATE ftxui::dom | ||
PRIVATE ftxui::component | ||
PUBLIC nlohmann_json::nlohmann_json | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <functional> // for function | ||
#include <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream | ||
#include <string> // for string, basic_string, allocator | ||
#include <vector> // for vector | ||
|
||
#include "ftxui/component/captured_mouse.hpp" // for ftxui | ||
#include "ftxui/component/component.hpp" // for Menu | ||
#include "ftxui/component/component_options.hpp" // for MenuOption | ||
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive | ||
|
||
int main() { | ||
using namespace ftxui; | ||
auto screen = ScreenInteractive::TerminalOutput(); | ||
|
||
std::vector<std::string> entries = { | ||
"entry 1", | ||
"entry 2", | ||
"entry 3", | ||
}; | ||
int selected = 0; | ||
|
||
MenuOption option; | ||
option.on_enter = screen.ExitLoopClosure(); | ||
auto menu = Menu(&entries, &selected, option); | ||
|
||
screen.Loop(menu); | ||
|
||
std::cout << "Selected element = " << selected << std::endl; | ||
} |