From d952c3025341fafb4141375ecd2ba3ee9687275d Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 21 Apr 2021 15:25:22 +0200 Subject: Temporary revert text vertexbuffer code because of sfml bug --- TODO | 3 ++- include/Text.hpp | 2 +- src/Text.cpp | 14 ++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index 7b9508b..d3f56f4 100644 --- a/TODO +++ b/TODO @@ -134,4 +134,5 @@ When ui is scaled then the predicted thumbnail size will be wrong since its scal Check if get_page handlers in pages need to check if next batch is valid. If the server returns empty next batch we shouldn't fetch the first page... Cloudflare kicks in when downloading manga on manganelo.. figure out a way to bypass it. This doesn't seem to happen when using python requests as is done in AutoMedia. Replace cppcodec with another library for base64 url encoding/decoding. Its way too large for what it does. -Revert back to old fuzzy search code or use levenshtein distance, then reorder items by best match. This could be done by having a second vector of indices and use that vector everywhere body items by index is accessed (including selected_item). Also perform the search in Body::draw when search term has been modified. This allows us to automatically update that new vector. \ No newline at end of file +Revert back to old fuzzy search code or use levenshtein distance, then reorder items by best match. This could be done by having a second vector of indices and use that vector everywhere body items by index is accessed (including selected_item). Also perform the search in Body::draw when search term has been modified. This allows us to automatically update that new vector. +Using a VertexBuffer in Text makes the text quickly glitch out. Why does this happen? \ No newline at end of file diff --git a/include/Text.hpp b/include/Text.hpp index d25d47b..53105f5 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -145,7 +145,7 @@ namespace QuickMedia // 2: CJK // 3: Emoji sf::VertexArray vertices[3]; - sf::VertexBuffer vertex_buffers[3]; + //sf::VertexBuffer vertex_buffers[3]; float maxWidth; sf::Vector2f position; sf::Color color; diff --git a/src/Text.cpp b/src/Text.cpp index 5668cf8..cac485d 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -49,10 +49,10 @@ namespace QuickMedia vertices[0].setPrimitiveType(sf::PrimitiveType::Triangles); vertices[1].setPrimitiveType(sf::PrimitiveType::Triangles); vertices[2].setPrimitiveType(sf::PrimitiveType::Triangles); - for(int i = 0; i < 3; ++i) { + /*for(int i = 0; i < 3; ++i) { vertex_buffers[i] = sf::VertexBuffer(sf::PrimitiveType::Triangles, sf::VertexBuffer::Static); vertex_buffers[i].create(0); - } + }*/ setString(std::move(_str)); } @@ -589,9 +589,9 @@ namespace QuickMedia } boundingBox.height = num_lines * line_height; - for(int i = 0; i < 3; ++i) { + /*for(int i = 0; i < 3; ++i) { vertex_buffers[i].update(&vertices[i][0], vertices[i].getVertexCount(), 0); - } + }*/ //url_ranges.clear(); if(!editable) @@ -907,14 +907,16 @@ namespace QuickMedia sf::RenderStates states; states.transform.translate(pos); states.texture = &font->getTexture(characterSize); - target.draw(vertex_buffers[i], states); + //target.draw(vertex_buffers[i], states); + target.draw(vertices[i], states); } if(vertices[2].getVertexCount() > 0) { sf::RenderStates states; states.transform.translate(pos); states.texture = TextureLoader::get_texture("images/emoji.png"); - target.draw(vertex_buffers[2], states); + //target.draw(vertex_buffers[2], states); + target.draw(vertices[2], states); } if(!editable) return true; -- cgit v1.2.3