From 07eebc494c3655a81ba45522603a9406825a3d0f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 23 Sep 2020 20:28:42 +0200 Subject: Make tabs rounded, readd color to nyaa.si trusted/remake --- src/Body.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/Body.cpp') 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(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); -- cgit v1.2.3