aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-12-01 18:50:00 +0100
committerdec05eba <dec05eba@protonmail.com>2019-12-01 18:50:00 +0100
commitfb425ca64d797a56d75d09dceb338ed49894497d (patch)
tree58c98cf1f194ae8e959093176ac014ab0d2e68ef /src
parent6c7adadf6d5c85d5e280e965d4dee1563bf46821 (diff)
Improve performance of shadow rendering behind body items
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 5147767..bf782bb 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -227,10 +227,10 @@ namespace QuickMedia {
sf::Vector2f item_pos = pos;
if(i == selected_item) {
- selected_border.setPosition(pos);
- selected_border.setSize(sf::Vector2f(selected_border_width, item_height));
- window.draw(selected_border);
- item_pos.x += selected_border_width;
+ //selected_border.setPosition(pos);
+ //selected_border.setSize(sf::Vector2f(selected_border_width, item_height));
+ //window.draw(selected_border);
+ //item_pos.x += selected_border_width;
item_background.setFillColor(sf::Color(0, 85, 119));
} else {
item_background.setFillColor(front_color);
@@ -238,9 +238,15 @@ namespace QuickMedia {
item_pos.x = std::floor(item_pos.x);
item_pos.y = std::floor(item_pos.y);
- item_background_shadow.setPosition(item_pos + sf::Vector2f(5.0f, 5.0f));
- item_background_shadow.setSize(sf::Vector2f(size.x, item_height));
+
+ item_background_shadow.setPosition(item_pos + sf::Vector2f(size.x, 0.0f) + sf::Vector2f(0.0, 5.0f));
+ item_background_shadow.setSize(sf::Vector2f(5.0f, item_height));
+ window.draw(item_background_shadow);
+
+ item_background_shadow.setPosition(item_pos + sf::Vector2f(0.0f, item_height) + sf::Vector2f(5.0, 0.0f));
+ item_background_shadow.setSize(sf::Vector2f(size.x - 5.0f, 5.0f));
window.draw(item_background_shadow);
+
item_background.setPosition(item_pos);
item_background.setSize(sf::Vector2f(size.x, item_height));
window.draw(item_background);