aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-07-31 21:01:31 +0200
committerdec05eba <dec05eba@protonmail.com>2024-07-31 21:01:31 +0200
commit8a82fa688b4ca27bb96900da97dce0fd870d3a65 (patch)
tree153e58a35e45215d4e6efa64afc721e30467bce3 /src/gui
parent497217a3e09b577f650aaf503356588515067ca8 (diff)
More style changes
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/Button.cpp5
-rw-r--r--src/gui/ComboBox.cpp2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/Button.cpp b/src/gui/Button.cpp
index 5a71a16..b9d6d7c 100644
--- a/src/gui/Button.cpp
+++ b/src/gui/Button.cpp
@@ -11,7 +11,8 @@ namespace gsr {
bool 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 });
+ const mgl::vec2f collision_margin(1.0f, 1.0f); // Makes sure that multiple buttons that are next to each other wont activate at the same time when the cursor is right between them
+ const bool inside = mgl::FloatRect(position + collision_margin, size - collision_margin).contains({ (float)event.mouse_move.x, (float)event.mouse_move.y });
if(mouse_inside && !inside) {
mouse_inside = false;
} else if(!mouse_inside && inside) {
@@ -76,7 +77,7 @@ namespace gsr {
// Background
mgl::Rectangle rect(size);
rect.set_position(position);
- rect.set_color(mgl::Color(0, 0, 0, 250));
+ rect.set_color(mgl::Color(0, 0, 0, 220));
window.draw(rect);
}
}
diff --git a/src/gui/ComboBox.cpp b/src/gui/ComboBox.cpp
index b96b3ae..00e8bc3 100644
--- a/src/gui/ComboBox.cpp
+++ b/src/gui/ComboBox.cpp
@@ -95,7 +95,7 @@ namespace gsr {
background.set_size(max_size);
background.set_color(mgl::Color(0, 0, 0));
} else {
- background.set_color(mgl::Color(0, 0, 0, 250));
+ background.set_color(mgl::Color(0, 0, 0, 220));
}
window.draw(background);