diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Body.cpp | 29 | ||||
-rw-r--r-- | src/Entry.cpp | 15 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 39 | ||||
-rw-r--r-- | src/RoundedRectangle.cpp | 46 | ||||
-rw-r--r-- | src/SearchBar.cpp | 19 | ||||
-rw-r--r-- | src/Tabs.cpp | 19 |
6 files changed, 105 insertions, 62 deletions
diff --git a/src/Body.cpp b/src/Body.cpp index 534f2b5..a84256e 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -113,7 +113,7 @@ namespace QuickMedia { reactions.push_back(std::move(reaction)); } - Body::Body(Program *program, sf::Texture &loading_icon_texture) : + Body::Body(Program *program, sf::Texture &loading_icon_texture, sf::Shader *rounded_rectangle_shader) : progress_text("", *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(14 * get_ui_scale())), replies_text("", *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(14 * get_ui_scale())), embedded_item_load_text("", *FontLoader::get_font(FontLoader::FontType::LATIN), embedded_item_font_size), @@ -126,19 +126,20 @@ namespace QuickMedia { selected_item(0), prev_selected_item(0), page_scroll(0.0f), - item_background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10), loading_icon(loading_icon_texture), num_visible_items(0), first_item_fully_visible(true), last_item_fully_visible(true), first_fully_visible_item(-1), - last_fully_visible_item(-1) + last_fully_visible_item(-1), + item_background(sf::Vector2f(1.0f, 1.0f), 10.0f, sf::Color(55, 60, 68), rounded_rectangle_shader), + reaction_background(sf::Vector2f(1.0f, 1.0f), 10.0f, sf::Color(33, 37, 44), rounded_rectangle_shader) { + assert(rounded_rectangle_shader); progress_text.setFillColor(sf::Color::White); replies_text.setFillColor(sf::Color(129, 162, 190)); thumbnail_max_size.x = 250; thumbnail_max_size.y = 141; - item_background.setFillColor(sf::Color(55, 60, 68)); sf::Vector2f loading_icon_size(loading_icon.getTexture()->getSize().x, loading_icon.getTexture()->getSize().y); loading_icon.setOrigin(loading_icon_size.x * 0.5f, loading_icon_size.y * 0.5f); } @@ -982,9 +983,9 @@ namespace QuickMedia { //window.draw(item_separator); if(item_index == selected_item) { - item_background.setPosition(item_pos); - item_background.setSize(sf::Vector2f(size.x, item_height)); - window.draw(item_background); + item_background.set_position(item_pos); + item_background.set_size(sf::Vector2f(size.x, item_height)); + item_background.draw(window); } float text_offset_x = padding_x; @@ -1011,10 +1012,12 @@ namespace QuickMedia { image.setColor(sf::Color(255, 255, 255, thumbnail_fade_progress * 255)); image.setScale(image_scale); image.setPosition(item_pos + sf::Vector2f(image_padding_x, padding_y)); - if(thumbnail_mask_shader && item->thumbnail_mask_type == ThumbnailMaskType::CIRCLE) + if(thumbnail_mask_shader && item->thumbnail_mask_type == ThumbnailMaskType::CIRCLE) { + thumbnail_mask_shader->setUniform("resolution", new_image_size); window.draw(image, thumbnail_mask_shader); - else + } else { window.draw(image); + } text_offset_x += image_padding_x + new_image_size.x; // We want the next image fallback to have the same size as the successful image rendering, because its likely the image fallback will have the same size (for example thumbnails on youtube) //image_fallback.setSize(sf::Vector2f(width_ratio * image_size.x, height_ratio * image_size.y)); @@ -1113,8 +1116,6 @@ namespace QuickMedia { } if(!item->reactions.empty() && include_embedded_item) { - sf::RoundedRectangleShape reaction_background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10); - reaction_background.setFillColor(sf::Color(33, 37, 44)); float reaction_offset_x = 0.0f; item_pos.y += reaction_padding_y; float reaction_max_height = 0.0f; @@ -1125,9 +1126,9 @@ namespace QuickMedia { reaction.text->updateGeometry(); reaction_max_height = std::max(reaction_max_height, reaction.text->getHeight()); reaction.text->setPosition(std::floor(item_pos.x + text_offset_x + reaction_offset_x + reaction_background_padding_x), std::floor(item_pos.y + padding_y - 4.0f + reaction_background_padding_y)); - reaction_background.setPosition(std::floor(item_pos.x + text_offset_x + reaction_offset_x), std::floor(item_pos.y + padding_y)); - reaction_background.setSize(sf::Vector2f(reaction.text->getWidth() + reaction_background_padding_x * 2.0f, reaction.text->getHeight() + reaction_background_padding_y * 2.0f)); - window.draw(reaction_background); + reaction_background.set_position(sf::Vector2f(std::floor(item_pos.x + text_offset_x + reaction_offset_x), std::floor(item_pos.y + padding_y))); + reaction_background.set_size(sf::Vector2f(reaction.text->getWidth() + reaction_background_padding_x * 2.0f, reaction.text->getHeight() + reaction_background_padding_y * 2.0f)); + reaction_background.draw(window); reaction_offset_x += reaction.text->getWidth() + reaction_background_padding_x * 2.0f + reaction_spacing_x; reaction.text->draw(window); if(text_offset_x + reaction_offset_x + reaction.text->getWidth() + reaction_background_padding_x * 2.0f > size.x && i < (int)item->reactions.size() - 1) { diff --git a/src/Entry.cpp b/src/Entry.cpp index 5a6110c..96a34f3 100644 --- a/src/Entry.cpp +++ b/src/Entry.cpp @@ -11,29 +11,28 @@ const float padding_vertical = std::floor(3.0f * QuickMedia::get_ui_scale()); const float background_margin_vertical = std::floor(0.0f * QuickMedia::get_ui_scale()); namespace QuickMedia { - Entry::Entry(const std::string &placeholder_text) : + Entry::Entry(const std::string &placeholder_text, sf::Shader *rounded_rectangle_shader) : on_submit_callback(nullptr), draw_background(true), text("", false, std::floor(16 * get_ui_scale()), 0.0f), width(0.0f), - background(sf::Vector2f(1.0f, 1.0f), 7.0f, 10), + background(sf::Vector2f(1.0f, 1.0f), 7.0f, sf::Color(55, 60, 68), rounded_rectangle_shader), placeholder(placeholder_text, *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(16 * get_ui_scale())), mouse_left_inside(false) { text.setEditable(true); - background.setFillColor(sf::Color(55, 60, 68)); placeholder.setFillColor(sf::Color(255, 255, 255, 100)); } void Entry::process_event(sf::Event &event) { if(is_touch_enabled() && event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == sf::Mouse::Left) { - sf::FloatRect box(background.getPosition(), background.getSize()); + sf::FloatRect box(background.get_position(), background.get_size()); if(box.contains(event.mouseButton.x, event.mouseButton.y)) mouse_left_inside = true; else mouse_left_inside = false; } else if(is_touch_enabled() && event.type == sf::Event::MouseButtonReleased && event.mouseButton.button == sf::Mouse::Left) { - sf::FloatRect box(background.getPosition(), background.getSize()); + sf::FloatRect box(background.get_position(), background.get_size()); if(mouse_left_inside && box.contains(event.mouseButton.x, event.mouseButton.y)) show_virtual_keyboard(); mouse_left_inside = false; @@ -58,9 +57,9 @@ namespace QuickMedia { // TODO: Set the max number of visible lines and use glScissor to cut off the lines outsides // (and also split text into lines to not draw them at all once they are not inside the scissor box) void Entry::draw(sf::RenderWindow &window) { - background.setSize(sf::Vector2f(width, get_height())); + background.set_size(sf::Vector2f(width, get_height())); if(draw_background) - window.draw(background); + background.draw(window); if(text.getString().isEmpty() && !text.isEditable()) { window.draw(placeholder); @@ -93,7 +92,7 @@ namespace QuickMedia { } void Entry::set_position(const sf::Vector2f &pos) { - background.setPosition(pos); + background.set_position(pos); text.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical - std::floor(3.0f * get_ui_scale()))); placeholder.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical + std::floor(3.0f * get_ui_scale()))); } diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 79f1f74..4de65d2 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -645,12 +645,17 @@ namespace QuickMedia { set_resource_loader_root_path(resources_root.c_str()); if(!circle_mask_shader.loadFromFile(resources_root + "shaders/circle_mask.glsl", sf::Shader::Type::Fragment)) { - fprintf(stderr, "Failed to load %s/shaders/circle_mask.glsl", resources_root.c_str()); + fprintf(stderr, "Failed to load %s/shaders/circle_mask.glsl\n", resources_root.c_str()); + abort(); + } + + if(!rounded_rectangle_shader.loadFromFile(resources_root + "shaders/rounded_rectangle.glsl", sf::Shader::Type::Fragment)) { + fprintf(stderr, "Failed to load %s/shaders/rounded_rectangle.glsl\n", resources_root.c_str()); abort(); } if(!loading_icon.loadFromFile(resources_root + "images/loading_icon.png")) { - fprintf(stderr, "Failed to load %s/images/loading_icon.png", resources_root.c_str()); + fprintf(stderr, "Failed to load %s/images/loading_icon.png\n", resources_root.c_str()); abort(); } loading_icon.setSmooth(true); @@ -1177,13 +1182,13 @@ namespace QuickMedia { } std::unique_ptr<Body> Program::create_body() { - auto body = std::make_unique<Body>(this, loading_icon); + auto body = std::make_unique<Body>(this, loading_icon, &rounded_rectangle_shader); body->thumbnail_mask_shader = &circle_mask_shader; return body; } std::unique_ptr<SearchBar> Program::create_search_bar(const std::string &placeholder, int search_delay) { - auto search_bar = std::make_unique<SearchBar>(&plugin_logo, placeholder); + auto search_bar = std::make_unique<SearchBar>(&plugin_logo, &rounded_rectangle_shader, placeholder); search_bar->text_autosearch_delay = search_delay; return search_bar; } @@ -1290,7 +1295,7 @@ namespace QuickMedia { tab.page->on_navigate_to_page(tab.body.get()); } - Tabs ui_tabs; + Tabs ui_tabs(&rounded_rectangle_shader); for(auto &tab : tabs) { ui_tabs.add_tab(tab.page->get_title()); } @@ -2936,7 +2941,7 @@ namespace QuickMedia { }); }; - Entry comment_input("Press i to begin writing a comment..."); + Entry comment_input("Press i to begin writing a comment...", &rounded_rectangle_shader); comment_input.draw_background = false; comment_input.set_editable(false); @@ -3328,9 +3333,9 @@ namespace QuickMedia { void Program::chat_login_page() { assert(strcmp(plugin_name, "matrix") == 0); - SearchBar login_input(nullptr, "Username"); - SearchBar password_input(nullptr, "Password", true); - SearchBar homeserver_input(nullptr, "Homeserver"); + SearchBar login_input(nullptr, &rounded_rectangle_shader, "Username"); + SearchBar password_input(nullptr, &rounded_rectangle_shader, "Password", true); + SearchBar homeserver_input(nullptr, &rounded_rectangle_shader, "Homeserver"); sf::Text status_text("", *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(18 * get_ui_scale())); @@ -3566,31 +3571,28 @@ namespace QuickMedia { std::vector<ChatTab> tabs; ChatTab pinned_tab; - pinned_tab.body = std::make_unique<Body>(this, loading_icon); + pinned_tab.body = create_body(); pinned_tab.body->thumbnail_max_size = CHAT_MESSAGE_THUMBNAIL_MAX_SIZE; - pinned_tab.body->thumbnail_mask_shader = &circle_mask_shader; pinned_tab.body->attach_side = AttachSide::BOTTOM; pinned_tab.body->line_separator_color = sf::Color::Transparent; tabs.push_back(std::move(pinned_tab)); ChatTab messages_tab; - messages_tab.body = std::make_unique<Body>(this, loading_icon); + messages_tab.body = create_body(); messages_tab.body->thumbnail_max_size = CHAT_MESSAGE_THUMBNAIL_MAX_SIZE; - messages_tab.body->thumbnail_mask_shader = &circle_mask_shader; messages_tab.body->attach_side = AttachSide::BOTTOM; messages_tab.body->line_separator_color = sf::Color::Transparent; tabs.push_back(std::move(messages_tab)); // ChatTab users_tab; - // users_tab.body = std::make_unique<Body>(this, loading_icon); + // users_tab.body = create_body(); // users_tab.body->thumbnail_max_size = CHAT_MESSAGE_THUMBNAIL_MAX_SIZE; - // users_tab.body->thumbnail_mask_shader = &circle_mask_shader; // users_tab.body->attach_side = AttachSide::TOP; // //users_tab.body->line_separator_color = sf::Color::Transparent; // users_tab.text = sf::Text("Users", *FontLoader::get_font(FontLoader::FontType::LATIN), tab_text_size); // tabs.push_back(std::move(users_tab)); - Tabs ui_tabs(back_color); + Tabs ui_tabs(&rounded_rectangle_shader, back_color); const int PINNED_TAB_INDEX = ui_tabs.add_tab("Pinned messages (0)"); const int MESSAGES_TAB_INDEX = ui_tabs.add_tab("Messages"); ui_tabs.set_selected(MESSAGES_TAB_INDEX); @@ -3855,7 +3857,7 @@ namespace QuickMedia { ui_tabs.set_text(PINNED_TAB_INDEX, "Pinned messages (" + std::to_string(tabs[PINNED_TAB_INDEX].body->items.size()) + ")"); }; - Body url_selection_body(this, loading_icon); + Body url_selection_body(this, loading_icon, &rounded_rectangle_shader); std::unordered_set<std::string> fetched_messages_set; auto filter_existing_messages = [&fetched_messages_set](Messages &messages) { @@ -3895,7 +3897,7 @@ namespace QuickMedia { read_marker_timeout_ms = 0; redraw = true; - Entry chat_input("Press i to begin writing a message..."); + Entry chat_input("Press i to begin writing a message...", &rounded_rectangle_shader); chat_input.draw_background = false; chat_input.set_editable(false); @@ -5096,6 +5098,7 @@ namespace QuickMedia { room_avatar_texture_size.x *= room_avatar_sprite.getScale().x; room_avatar_texture_size.y *= room_avatar_sprite.getScale().y; room_avatar_sprite.setPosition(body_pos.x, room_name_total_height * 0.5f - room_avatar_texture_size.y * 0.5f + 5.0f); + circle_mask_shader.setUniform("resolution", sf::Vector2f(room_avatar_texture_size.x, room_avatar_texture_size.y)); window.draw(room_avatar_sprite, &circle_mask_shader); room_name_text_offset_x += room_avatar_texture_size.x + 10.0f; } diff --git a/src/RoundedRectangle.cpp b/src/RoundedRectangle.cpp new file mode 100644 index 0000000..6b956e8 --- /dev/null +++ b/src/RoundedRectangle.cpp @@ -0,0 +1,46 @@ +#include "../include/RoundedRectangle.hpp" +#include <SFML/Graphics/Shader.hpp> +#include <SFML/Graphics/RenderWindow.hpp> +#include <assert.h> + +namespace QuickMedia { + RoundedRectangle::RoundedRectangle(sf::Vector2f size, float radius, sf::Color color, sf::Shader *rounded_rectangle_shader) : radius(radius), pos(0.0f, 0.0f), size(size), rounded_rectangle_shader(rounded_rectangle_shader) { + assert(rounded_rectangle_shader); + vertices[0].color = color; + vertices[1].color = color; + vertices[2].color = color; + vertices[3].color = color; + + vertices[0].texCoords = sf::Vector2f(0.0f, 0.0f); + vertices[1].texCoords = sf::Vector2f(1.0f, 0.0f); + vertices[2].texCoords = sf::Vector2f(1.0f, 1.0f); + vertices[3].texCoords = sf::Vector2f(0.0f, 1.0f); + } + + void RoundedRectangle::set_position(sf::Vector2f pos) { + this->pos = pos; + vertices[0].position = pos; + vertices[1].position = pos + sf::Vector2f(size.x, 0.0f); + vertices[2].position = pos + sf::Vector2f(size.x, size.y); + vertices[3].position = pos + sf::Vector2f(0.0f, size.y); + } + + void RoundedRectangle::set_size(sf::Vector2f size) { + this->size = size; + set_position(pos); + } + + sf::Vector2f RoundedRectangle::get_position() const { + return pos; + } + + sf::Vector2f RoundedRectangle::get_size() const { + return size; + } + + void RoundedRectangle::draw(sf::RenderWindow &window) { + rounded_rectangle_shader->setUniform("resolution", size); + rounded_rectangle_shader->setUniform("radius", radius); + window.draw(vertices, 4, sf::Quads, rounded_rectangle_shader); + } +}
\ No newline at end of file diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp index fa119a6..6aa6eec 100644 --- a/src/SearchBar.cpp +++ b/src/SearchBar.cpp @@ -19,7 +19,7 @@ static const float padding_bottom = std::floor(15.0f * QuickMedia::get_ui_scale( static const float background_margin_vertical = std::floor(4.0f * QuickMedia::get_ui_scale()); namespace QuickMedia { - SearchBar::SearchBar(sf::Texture *plugin_logo, const std::string &placeholder, bool input_masked) : + SearchBar::SearchBar(sf::Texture *plugin_logo, sf::Shader *rounded_rectangle_shader, const std::string &placeholder, bool input_masked) : onTextUpdateCallback(nullptr), onTextSubmitCallback(nullptr), onTextBeginTypingCallback(nullptr), @@ -29,7 +29,7 @@ namespace QuickMedia { caret_visible(true), text(placeholder, *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(16 * get_ui_scale())), autocomplete_text("", *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(16 * get_ui_scale())), - background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10), + background(sf::Vector2f(1.0f, 1.0f), 10.0f, front_color, rounded_rectangle_shader), placeholder_str(placeholder), show_placeholder(true), updated_search(false), @@ -44,7 +44,6 @@ namespace QuickMedia { { text.setFillColor(text_placeholder_color); autocomplete_text.setFillColor(text_placeholder_color); - background.setFillColor(front_color); //background.setCornersRadius(5); background_shadow.setFillColor(sf::Color(23, 25, 27)); //background_shadow.setPosition(background.getPosition() + sf::Vector2f(5.0f, 5.0f)); @@ -65,7 +64,7 @@ namespace QuickMedia { //if(draw_shadow) // window.draw(background_shadow); window.draw(shade); - window.draw(background); + background.draw(window); // TODO: Render starting from the character after text length window.draw(autocomplete_text); if(input_masked && !show_placeholder) { @@ -112,13 +111,13 @@ namespace QuickMedia { onTextEntered(8); if(is_touch_enabled() && event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == sf::Mouse::Left) { - sf::FloatRect box(background.getPosition(), background.getSize()); + sf::FloatRect box(background.get_position(), background.get_size()); if(box.contains(event.mouseButton.x, event.mouseButton.y)) mouse_left_inside = true; else mouse_left_inside = false; } else if(is_touch_enabled() && event.type == sf::Event::MouseButtonReleased && event.mouseButton.button == sf::Mouse::Left) { - sf::FloatRect box(background.getPosition(), background.getSize()); + sf::FloatRect box(background.get_position(), background.get_size()); if(mouse_left_inside && box.contains(event.mouseButton.x, event.mouseButton.y)) show_virtual_keyboard(); mouse_left_inside = false; @@ -175,12 +174,12 @@ namespace QuickMedia { const float width = std::floor(window_size.x - offset_x - 10.0f); - background.setSize(sf::Vector2f(width, rect_height)); + background.set_size(sf::Vector2f(width, rect_height)); shade.setSize(sf::Vector2f(window_size.x, padding_top + rect_height + padding_bottom)); caret.setSize(sf::Vector2f(std::floor(2.0f * get_ui_scale()), text.getCharacterSize() + std::floor(2.0f * get_ui_scale()))); background_shadow.setSize(sf::Vector2f(window_size.x, 5.0f)); - background.setPosition(offset_x, padding_top + vertical_pos); + background.set_position(sf::Vector2f(offset_x, padding_top + vertical_pos)); shade.setPosition(0.0f, vertical_pos); background_shadow.setPosition(0.0f, std::floor(shade.getSize().y + vertical_pos)); sf::Vector2f font_position(std::floor(offset_x + background_margin_horizontal), std::floor(padding_top + background_margin_vertical + vertical_pos)); @@ -308,10 +307,6 @@ namespace QuickMedia { } } - void SearchBar::set_background_color(sf::Color color) { - background.setFillColor(color); - } - void SearchBar::clear_autocomplete_if_text_not_substring() { const sf::String &text_str = text.getString(); const sf::String &autocomplete_str = autocomplete_text.getString(); diff --git a/src/Tabs.cpp b/src/Tabs.cpp index eb435fc..4437472 100644 --- a/src/Tabs.cpp +++ b/src/Tabs.cpp @@ -24,8 +24,7 @@ namespace QuickMedia { return tab_height + std::floor(10.0f * get_ui_scale()); } - Tabs::Tabs(sf::Color shade_color) : background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10), shade_color(shade_color) { - background.setFillColor(tab_selected_color); + Tabs::Tabs(sf::Shader *rounded_rectangle_shader, sf::Color shade_color) : background(sf::Vector2f(1.0f, 1.0f), 10.0f, tab_selected_color, rounded_rectangle_shader), shade_color(shade_color) { shade.setFillColor(shade_color); } @@ -70,7 +69,7 @@ namespace QuickMedia { width_per_tab = std::floor(width / num_visible_tabs); const float tab_text_y = std::floor(pos.y + tab_height*0.5f - (tab_text_size + 5.0f*get_ui_scale())*0.5f); tab_background_width = std::floor(width_per_tab - tab_margin_x*2.0f); - background.setSize(sf::Vector2f(tab_background_width, tab_height)); + background.set_size(sf::Vector2f(tab_background_width, tab_height)); shade.setSize(sf::Vector2f(width, get_shade_height())); shade.setPosition(std::floor(pos.x), std::floor(pos.y)); @@ -106,8 +105,8 @@ namespace QuickMedia { } if((int)index == selected_tab) { - background.setPosition(background_pos_x, std::floor(pos.y)); - window.draw(background); + background.set_position(sf::Vector2f(background_pos_x, std::floor(pos.y))); + background.draw(window); } sf::Text &tab_text = tab_texts[index]; @@ -121,7 +120,7 @@ namespace QuickMedia { } float lw = std::floor(25.0f * get_ui_scale()); - float lh = background.getSize().y; + float lh = background.get_size().y; float line_offset_y = std::floor(lw * 0.35f); @@ -144,11 +143,11 @@ namespace QuickMedia { line.setOrigin(line.getSize().x * 0.5f, line.getSize().y * 0.5f); line.rotate(-45.0f); - line.setPosition(std::floor(start_pos.x + line.getLocalBounds().width), std::floor(pos.y + background.getSize().y * 0.5f - lh * 0.5f + line_offset_y)); + line.setPosition(std::floor(start_pos.x + line.getLocalBounds().width), std::floor(pos.y + background.get_size().y * 0.5f - lh * 0.5f + line_offset_y)); window.draw(line); line.rotate(-90.0f); - line.setPosition(std::floor(start_pos.x + line.getLocalBounds().width), std::floor(pos.y + background.getSize().y * 0.5f - lh * 0.5f + line_offset_y + std::floor(7.0f * get_ui_scale()))); + line.setPosition(std::floor(start_pos.x + line.getLocalBounds().width), std::floor(pos.y + background.get_size().y * 0.5f - lh * 0.5f + line_offset_y + std::floor(7.0f * get_ui_scale()))); window.draw(line); } @@ -171,11 +170,11 @@ namespace QuickMedia { line.setOrigin(line.getSize().x * 0.5f, line.getSize().y * 0.5f); line.rotate(45.0f); - line.setPosition(std::floor(start_pos.x + width - lw*0.75f + line.getLocalBounds().width), std::floor(pos.y + background.getSize().y * 0.5f - lh * 0.5f + line_offset_y)); + line.setPosition(std::floor(start_pos.x + width - lw*0.75f + line.getLocalBounds().width), std::floor(pos.y + background.get_size().y * 0.5f - lh * 0.5f + line_offset_y)); window.draw(line); line.rotate(-90.0f); - line.setPosition(std::floor(start_pos.x + width - lw*0.75f + line.getLocalBounds().width), std::floor(pos.y + background.getSize().y * 0.5f - lh * 0.5f + line_offset_y + std::floor(7.0f * get_ui_scale()))); + line.setPosition(std::floor(start_pos.x + width - lw*0.75f + line.getLocalBounds().width), std::floor(pos.y + background.get_size().y * 0.5f - lh * 0.5f + line_offset_y + std::floor(7.0f * get_ui_scale()))); window.draw(line); } } |