sandbox
Loading...
Searching...
No Matches
button.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_UI_BUTTON_HPP_
3#define LIBSBX_UI_BUTTON_HPP_
4
5#include <functional>
6
8
9#include <libsbx/ui/panel.hpp>
10
11namespace sbx::ui {
12
13class button : public panel {
14
15public:
16
17 math::color normal_color{0.3f, 0.3f, 0.3f, 1.0f};
18 math::color hovered_color{0.4f, 0.4f, 0.4f, 1.0f};
19 math::color pressed_color{0.2f, 0.2f, 0.2f, 1.0f};
20
21 std::function<void()> on_click{};
22
23 button();
24
25 ~button() override = default;
26
27protected:
28
29 auto process_input(const math::vector2& mouse_position, bool is_down, bool was_down) -> bool override;
30
31}; // class button
32
33} // namespace sbx::ui
34
35#endif // LIBSBX_UI_BUTTON_HPP_
A vector in two-dimensional space.
Definition: vector2.hpp:28
RGBA color value type.
Definition: color.hpp:48
Definition: button.hpp:13
Definition: panel.hpp:9
RGBA color representation and utilities.