aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Text.cpp b/src/Text.cpp
index 2abc276..5668cf8 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -49,6 +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) {
+ vertex_buffers[i] = sf::VertexBuffer(sf::PrimitiveType::Triangles, sf::VertexBuffer::Static);
+ vertex_buffers[i].create(0);
+ }
setString(std::move(_str));
}
@@ -585,6 +589,10 @@ namespace QuickMedia
}
boundingBox.height = num_lines * line_height;
+ for(int i = 0; i < 3; ++i) {
+ vertex_buffers[i].update(&vertices[i][0], vertices[i].getVertexCount(), 0);
+ }
+
//url_ranges.clear();
if(!editable)
vertices_linear.clear();
@@ -899,14 +907,14 @@ namespace QuickMedia
sf::RenderStates states;
states.transform.translate(pos);
states.texture = &font->getTexture(characterSize);
- target.draw(vertices[i], states);
+ target.draw(vertex_buffers[i], states);
}
if(vertices[2].getVertexCount() > 0) {
sf::RenderStates states;
states.transform.translate(pos);
states.texture = TextureLoader::get_texture("images/emoji.png");
- target.draw(vertices[2], states);
+ target.draw(vertex_buffers[2], states);
}
if(!editable) return true;