aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-03-31 02:38:18 +0200
committerdec05eba <dec05eba@protonmail.com>2022-03-31 02:38:18 +0200
commit5dc945eb6a0361ee7a64314f7a2acbf24ea9b565 (patch)
tree51132c347bda1d8c33945a962f8bc1ac0948a982 /src/gui
parent900553e6c0120edaf90fa8d28f34bd82af4c5a58 (diff)
Start/stop recording if not running/already running
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/Button.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/Button.cpp b/src/gui/Button.cpp
index b266639..2250560 100644
--- a/src/gui/Button.cpp
+++ b/src/gui/Button.cpp
@@ -10,6 +10,7 @@ namespace gsr {
}
void Button::on_event(mgl::Event &event, mgl::Window&) {
+ /*
if(event.type == mgl::Event::MouseMoved) {
const bool inside = mgl::FloatRect(position, size).contains({ (float)event.mouse_move.x, (float)event.mouse_move.y });
if(mouse_inside && !inside) {
@@ -17,10 +18,24 @@ namespace gsr {
} else if(!mouse_inside && inside) {
mouse_inside = true;
}
+ } else if(event.type == mgl::Event::MouseButtonPressed && mouse_inside) {
+
+ }
+ */
+ if(event.type == mgl::Event::MouseButtonPressed && mouse_inside) {
+ if(on_click)
+ on_click();
}
}
void Button::draw(mgl::Window &window) {
+ const bool inside = mgl::FloatRect(position, size).contains(window.get_mouse_position().to_vec2f());
+ if(mouse_inside && !inside) {
+ mouse_inside = false;
+ } else if(!mouse_inside && inside) {
+ mouse_inside = true;
+ }
+
if(mouse_inside) {
// Background
/*