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.
This commit is contained in:
zvon 2021-01-30 22:59:22 +01:00
parent 2622c9fb98
commit a8ff8e49c7

View File

@ -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();