From 00f84e3b984904e36cbee502a470003ecd7d09cf Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sat, 10 Aug 2024 10:46:54 -0400 Subject: initial upload --- ui/button.hpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 ui/button.hpp (limited to 'ui/button.hpp') diff --git a/ui/button.hpp b/ui/button.hpp new file mode 100644 index 0000000..4a0a9f5 --- /dev/null +++ b/ui/button.hpp @@ -0,0 +1,37 @@ +#ifndef MBUOY_UI_BUTTON_HPP +#define MBUOY_UI_BUTTON_HPP + +#include "attr/dimensions.hpp" +#include "attr/ondraw.hpp" +#include "attr/position.hpp" +#include "attr/string.hpp" +#include "find.hpp" +#include "port.hpp" + +namespace mbuoy { + +template +struct button +{ + static constexpr auto point = find(Attr...); + static constexpr auto dims = find(Attr...); + static constexpr auto text = find(Attr...); + static constexpr auto draw = find(Attr...); + + static consteval void init(unsigned char *(&ptr)) { + *ptr++ = 0; // pressed? + } + + static void render() { + (*draw)(*point, *dims); + } + + static consteval int size() { + return 1; + } +}; + +} // namespace mbuoy + +#endif // MBUOY_UI_BUTTON_HPP + -- cgit v1.2.3