diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-08-06 08:22:42 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-08-06 08:22:42 +0200 |
commit | 520c61ec64c001d2c9c9d953051aa58715831731 (patch) | |
tree | 2c0e10995d1a85374f628e78a53321f727013bf3 /include/gui/CheckBox.hpp | |
parent | 9b6033e2b97f6f572cb69a393d4d1d1ea41b5d72 (diff) |
Add checkbox, scale more sizes by window scale
Diffstat (limited to 'include/gui/CheckBox.hpp')
-rw-r--r-- | include/gui/CheckBox.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/gui/CheckBox.hpp b/include/gui/CheckBox.hpp new file mode 100644 index 0000000..4459976 --- /dev/null +++ b/include/gui/CheckBox.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include "Widget.hpp" +#include <functional> + +#include <mglpp/graphics/Color.hpp> +#include <mglpp/graphics/Text.hpp> + +namespace gsr { + class CheckBox : public Widget { + public: + CheckBox(mgl::Font *font, const char *text); + CheckBox(const CheckBox&) = delete; + CheckBox& operator=(const CheckBox&) = delete; + + bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override; + void draw(mgl::Window &window, mgl::vec2f offset) override; + + mgl::vec2f get_size() override; + + std::function<void()> on_click; + private: + mgl::vec2f get_checkbox_size(); + private: + mgl::Text text; + bool checked = false; + }; +}
\ No newline at end of file |