aboutsummaryrefslogtreecommitdiff
path: root/src/Body.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-09-23 20:28:42 +0200
committerdec05eba <dec05eba@protonmail.com>2020-09-23 20:28:42 +0200
commit07eebc494c3655a81ba45522603a9406825a3d0f (patch)
treee4e98b0ebaa1bedd266c046fc78f44750880ec4d /src/Body.cpp
parent5b8c2237147336fd44b9deaa24e933abd797f8a3 (diff)
Make tabs rounded, readd color to nyaa.si trusted/remake
Diffstat (limited to 'src/Body.cpp')
-rw-r--r--src/Body.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 238ea8c..b8bfbff 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -15,7 +15,7 @@ const sf::Color front_color(32, 36, 42);
const sf::Color back_color(33, 35, 37);
namespace QuickMedia {
- BodyItem::BodyItem(std::string _title): visible(true), dirty(false), dirty_description(false), thumbnail_is_local(false), background_color(sf::Color::Transparent) {
+ BodyItem::BodyItem(std::string _title): visible(true), dirty(false), dirty_description(false), thumbnail_is_local(false), title_color(sf::Color::White) {
set_title(std::move(_title));
}
@@ -340,7 +340,8 @@ namespace QuickMedia {
sf::Sprite image;
sf::RoundedRectangleShape item_background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10);
- item_background.setFillColor(front_color);
+ //item_background.setFillColor(front_color);
+ item_background.setFillColor(sf::Color(32, 37, 43));
//item_background.setOutlineThickness(1.0f);
//item_background.setOutlineColor(sf::Color(13, 15, 17));
sf::RectangleShape item_background_shadow;
@@ -362,6 +363,7 @@ namespace QuickMedia {
body_item->title_text->setString(body_item->get_title());
else
body_item->title_text = std::make_unique<Text>(body_item->get_title(), font, 16, size.x - 50 - image_padding_x * 2.0f);
+ body_item->title_text->setFillColor(body_item->title_color);
body_item->title_text->updateGeometry();
}
@@ -458,19 +460,9 @@ 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;
- item_background.setFillColor(sf::Color(32, 37, 43));
- } else {
- item_background.setFillColor(item->background_color);
- }
-
- item_pos.x = std::floor(item_pos.x);
- item_pos.y = std::floor(item_pos.y);
+ sf::Vector2f item_pos;
+ item_pos.x = std::floor(pos.x);
+ item_pos.y = std::floor(pos.y);
item_background_shadow.setSize(sf::Vector2f(std::max(0.0f, size.x - 20.0f), 1.0f));
item_background_shadow.setPosition(item_pos + sf::Vector2f(10.0f, std::floor(item_height + spacing_y * 0.5f)));
@@ -526,6 +518,7 @@ namespace QuickMedia {
//title_text.setPosition(std::floor(item_pos.x + text_offset_x), std::floor(item_pos.y + padding_y));
//window.draw(title_text);
if(!item->get_title().empty()) {
+ item->title_text->setFillColor(item->title_color);
item->title_text->setPosition(std::floor(item_pos.x + text_offset_x), std::floor(item_pos.y + padding_y - 4.0f));
item->title_text->setMaxWidth(size.x - text_offset_x - image_padding_x * 2.0f);
item->title_text->draw(window);