From 6cb237cfba67e1a15d475dccfb706bcc179afe71 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 24 Sep 2020 04:51:50 +0200 Subject: Add tab background --- TODO | 2 +- src/QuickMedia.cpp | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/TODO b/TODO index a823b9f..dbd9e25 100644 --- a/TODO +++ b/TODO @@ -24,4 +24,4 @@ Use fallback cjk font for regular sf::Text as well (search, tabs, chapter name w Fix some japanese fonts not rendering (full width alphanumeric?). Also add support for full chinese and korean range. Resize text vertex arrays to 0 when not visible on screen to reduce memory usage. Text already does this but its done incorrectly (copied from dchat codebase). (Is this really necessary?). -Speed up thumbnail creating (image resizing). \ No newline at end of file +Speed up thumbnail creating (image resizing). diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 8e7c8af..e367ae0 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1191,6 +1191,8 @@ namespace QuickMedia { */ window.clear(back_color); + if(tabs[selected_tab].body) + search_bar->draw(window, false); { const float width_per_tab = window_size.x / tabs.size(); tab_background.setSize(sf::Vector2f(std::floor(width_per_tab - tab_margin_x * 2.0f), tab_height)); @@ -1222,8 +1224,6 @@ namespace QuickMedia { ++i; } } - if(tabs[selected_tab].body) - search_bar->draw(window, false); // fps++; // if(tt.getElapsedTime().asMilliseconds() >= 1000) { @@ -1275,8 +1275,9 @@ namespace QuickMedia { search_bar->update(); window.clear(back_color); - body->draw(window, body_pos, body_size); search_bar->draw(window); + body->draw(window, body_pos, body_size); + window.display(); faefeaf } @@ -1909,6 +1910,7 @@ namespace QuickMedia { search_bar->update(); window.clear(back_color); + search_bar->draw(window, false); const float width_per_tab = window_size.x / tabs.size(); tab_background.setSize(sf::Vector2f(std::floor(width_per_tab - tab_margin_x * 2.0f), tab_height)); @@ -1945,7 +1947,6 @@ namespace QuickMedia { ++i; } - search_bar->draw(window, false); window.display(); } @@ -2461,8 +2462,8 @@ namespace QuickMedia { } window.clear(back_color); - body->draw(window, body_pos, body_size); search_bar->draw(window); + body->draw(window, body_pos, body_size); window.display(); } @@ -2518,8 +2519,8 @@ namespace QuickMedia { search_bar->update(); window.clear(back_color); - body->draw(window, body_pos, body_size); search_bar->draw(window); + body->draw(window, body_pos, body_size); window.display(); } } @@ -2593,9 +2594,9 @@ namespace QuickMedia { search_bar->update(); window.clear(back_color); + search_bar->draw(window); body->draw(window, body_pos, body_size); window.draw(current_dir_text); - search_bar->draw(window); window.display(); } @@ -2652,8 +2653,8 @@ namespace QuickMedia { search_bar->update(); window.clear(back_color); - body->draw(window, body_pos, body_size); search_bar->draw(window); + body->draw(window, body_pos, body_size); window.display(); } } @@ -3061,11 +3062,11 @@ namespace QuickMedia { window.draw(rect); } } else if(navigation_stage == NavigationStage::REPLYING) { - body->draw(window, body_pos, body_size); search_bar->draw(window); - } else if(navigation_stage == NavigationStage::VIEWING_COMMENTS) { body->draw(window, body_pos, body_size); + } else if(navigation_stage == NavigationStage::VIEWING_COMMENTS) { search_bar->draw(window); + body->draw(window, body_pos, body_size); } window.display(); } @@ -3453,6 +3454,8 @@ namespace QuickMedia { window.clear(back_color); + chat_input.draw(window, false); + const float width_per_tab = window_size.x / tabs.size(); tab_background.setSize(sf::Vector2f(std::floor(width_per_tab - tab_margin_x * 2.0f), tab_height)); @@ -3460,8 +3463,7 @@ namespace QuickMedia { tabs[selected_tab].body->draw(window, body_pos, body_size); const float tab_y = tab_spacer_height + std::floor(tab_vertical_offset + tab_height * 0.5f - (tab_text_size + 5.0f) * 0.5f); - tab_shade.setPosition(0.0f, tab_spacer_height + std::floor(tab_vertical_offset)); - tab_shade.setSize(sf::Vector2f(window_size.x, tab_height + 10.0f)); + tab_shade.setSize(sf::Vector2f(window_size.x, tab_spacer_height + std::floor(tab_vertical_offset) + tab_height + 10.0f)); window.draw(tab_shade); int i = 0; @@ -3476,7 +3478,6 @@ namespace QuickMedia { ++i; } - chat_input.draw(window, false); window.display(); } -- cgit v1.2.3