diff options
| -rw-r--r-- | CMakeLists.txt | 12 | ||||
| -rw-r--r-- | ttwhy/event.cppm | 48 | ||||
| -rw-r--r-- | ttwhy/lib.cppm | 1 |
3 files changed, 60 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 316b655..b50768a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,15 @@ FetchContent_Declare("asio" GIT_TAG "asio-1-38-0" ) -FetchContent_MakeAvailable("asio") +FetchContent_Declare("sml" + GIT_REPOSITORY "https://github.com/boost-ext/sml" + GIT_TAG "v1.2.0" +) + +FetchContent_MakeAvailable( + "asio" + "sml" +) ### asio @@ -40,6 +48,7 @@ target_sources("ttwhy-core" PUBLIC FILE_SET CXX_MODULES FILES + "ttwhy/event.cppm" "ttwhy/io.cppm" "ttwhy/lib.cppm" "ttwhy/scoped_attributes.cppm" @@ -55,6 +64,7 @@ target_compile_features("ttwhy-core" PUBLIC target_link_libraries("ttwhy-core" PUBLIC "ext::asio" + "sml::sml" ) target_compile_options("ttwhy-core" PUBLIC diff --git a/ttwhy/event.cppm b/ttwhy/event.cppm new file mode 100644 index 0000000..3a81bff --- /dev/null +++ b/ttwhy/event.cppm @@ -0,0 +1,48 @@ +module; + +#include <variant> + +export module ttwhy:event; + +namespace ttwhy +{ + export enum class control_key + { + del, + enter, + escape, + tab, + backspace, + }; + + export enum class navigation_key + { + up, + down, + left, + right, + home, + end, + delete_key, + insert_key, + page_up, + page_down, + }; + + export struct character_event + { + char value; + }; + + export struct control_event + { + control_key key; + }; + + export struct navigation_event + { + navigation_key key; + }; + + export using input_event = std::variant<character_event, control_event, navigation_event>; +} // namespace ttwhy diff --git a/ttwhy/lib.cppm b/ttwhy/lib.cppm index 14e0d5c..b7766bd 100644 --- a/ttwhy/lib.cppm +++ b/ttwhy/lib.cppm @@ -1,4 +1,5 @@ export module ttwhy; +export import :event; export import :io; export import :scoped_attributes; |
