aboutsummaryrefslogtreecommitdiff
path: root/src/gui/CheckBox.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-10-27 01:52:22 +0200
committerdec05eba <dec05eba@protonmail.com>2024-10-27 01:54:37 +0200
commitcfcee1a5d8e5068cdc5171b01beb9f9e6251e51e (patch)
treed2237ae86f9c41bb74ae05be25f5209857e1a132 /src/gui/CheckBox.cpp
parent1d2fc77cfcd3d40c3a382d3f5f8e6c28e8b38da9 (diff)
Add option to change video resolution
Diffstat (limited to 'src/gui/CheckBox.cpp')
-rw-r--r--src/gui/CheckBox.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/CheckBox.cpp b/src/gui/CheckBox.cpp
index f1c84ff..d602cca 100644
--- a/src/gui/CheckBox.cpp
+++ b/src/gui/CheckBox.cpp
@@ -42,8 +42,12 @@ namespace gsr {
if(event.type == mgl::Event::MouseButtonPressed && event.mouse_button.button == mgl::Mouse::Left) {
const bool clicked_inside = mgl::FloatRect(position + offset, get_size()).contains({ (float)event.mouse_button.x, (float)event.mouse_button.y });
- if(clicked_inside)
+ if(clicked_inside) {
checked = !checked;
+ if(on_changed)
+ on_changed(checked);
+ return false;
+ }
}
return true;
}
@@ -105,6 +109,8 @@ namespace gsr {
this->checked = checked;
if(!animated)
toggle_animation_value = checked ? 1.0f : 0.0f;
+ if(on_changed)
+ on_changed(checked);
}
bool CheckBox::is_checked() const {