TETRIS: static_cast might be faster than dynamic cast

This commit is contained in:
2021-01-30 16:02:02 +01:00
parent ad1805101c
commit 7f661630c0
2 changed files with 14 additions and 14 deletions
+2 -2
View File
@@ -393,7 +393,7 @@ tetrisZLeft( std::shared_ptr< SDLPP::Renderer > renderer,
void updateTextSizeInternal(std::shared_ptr<SDLPP::RenderObject> input) {
if(input->getKilled())
return;
std::dynamic_pointer_cast< SDLPP::TextRenderer >( input )->setTextColor(
static_cast< SDLPP::TextRenderer* >( input.get() )->setTextColor(
*g_font, colors["text"], colors["text_out"], 0.1 );
}
@@ -437,7 +437,7 @@ void updateColors() {
x->setColor( colors["line"] );
}
for ( auto &x : g_main_scene->getObjects( { TEXT_ID } ) ) {
std::dynamic_pointer_cast< SDLPP::TextRenderer >( x )->setTextColor(
static_cast< SDLPP::TextRenderer* >( x.get() )->setTextColor(
*g_font, colors["text"], colors["text_out"], 0.1 );
}
g_menu_options[g_menu_select]->setColor( colors["menu_item_background"] );