From a8ff8e49c793f3c284cae7460723c68e7d0e835e Mon Sep 17 00:00:00 2001 From: zvon Date: Sat, 30 Jan 2021 22:59:22 +0100 Subject: [PATCH] SDLPP: Don't automatically updateSizeAndPosition with every text change This can lead to problems becuase only main thread can update textures, let programmers figure out when is the appropriate time to update a texture. --- sdlpp/sdlpp_textrenderer.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sdlpp/sdlpp_textrenderer.cpp b/sdlpp/sdlpp_textrenderer.cpp index d5a0f3f..15dc58b 100644 --- a/sdlpp/sdlpp_textrenderer.cpp +++ b/sdlpp/sdlpp_textrenderer.cpp @@ -42,15 +42,12 @@ void TextRenderer::setTextColor( std::shared_ptr< Font > font, const std::string &outline_color, double outline_size ) { saveFontConfig( font, color, outline_color, outline_size ); - updateSizeAndPosition(); } void TextRenderer::setTextColor( std::shared_ptr< FontConfiguration > config ) { saveFontConfig( config ); - updateSizeAndPosition(); } void TextRenderer::changeText( const std::string &text ) { _text = text; - updateSizeAndPosition(); } void TextRenderer::setFlags( int flags ) { position_flags = flags; @@ -69,6 +66,7 @@ void TextRenderer::render() { col->render( *renderer, colider_color ); } } +// TODO move this to method updateTexture and call that function from this void TextRenderer::updateSizeAndPosition() { RectangleRender::updateSizeAndPosition();