TETRIS: static_cast might be faster than dynamic cast
This commit is contained in:
+12
-12
@@ -693,24 +693,24 @@ void handleKeyDownOptions( SDL_Keycode key ) {
|
||||
if ( static_cast< size_t >( selected_color_scheme ) >=
|
||||
color_schemes_names.size() )
|
||||
selected_color_scheme = 0;
|
||||
std::dynamic_pointer_cast< SDLPP::TextRenderer >(
|
||||
g_options_options[OPTIONS_MENU_COLOR_SCHEME] )
|
||||
static_cast< SDLPP::TextRenderer * >(
|
||||
g_options_options[OPTIONS_MENU_COLOR_SCHEME].get() )
|
||||
->changeText( "Color scheme: " +
|
||||
color_schemes_names[selected_color_scheme] );
|
||||
g_update_colors = true;
|
||||
break;
|
||||
case OPTIONS_MENU_SHADOW:
|
||||
g_show_shadow = !g_show_shadow;
|
||||
std::dynamic_pointer_cast< SDLPP::TextRenderer >(
|
||||
g_options_options[OPTIONS_MENU_SHADOW] )
|
||||
static_cast< SDLPP::TextRenderer* >(
|
||||
g_options_options[OPTIONS_MENU_SHADOW].get() )
|
||||
->changeText( std::string( "Show shadow: " ) +
|
||||
( g_show_shadow ? "YES" : "NO" ) );
|
||||
g_update_colors = true;
|
||||
break;
|
||||
case OPTIONS_MENU_3D:
|
||||
g_show_3d = !g_show_3d;
|
||||
std::dynamic_pointer_cast< SDLPP::TextRenderer >(
|
||||
g_options_options[OPTIONS_MENU_3D] )
|
||||
static_cast< SDLPP::TextRenderer* >(
|
||||
g_options_options[OPTIONS_MENU_3D].get() )
|
||||
->changeText( std::string( "Show block texture: " ) +
|
||||
( g_show_3d ? "YES" : "NO" ) );
|
||||
g_update_colors = true;
|
||||
@@ -725,24 +725,24 @@ void handleKeyDownOptions( SDL_Keycode key ) {
|
||||
if ( selected_color_scheme == 0 )
|
||||
selected_color_scheme = color_schemes_names.size();
|
||||
selected_color_scheme--;
|
||||
std::dynamic_pointer_cast< SDLPP::TextRenderer >(
|
||||
g_options_options[OPTIONS_MENU_COLOR_SCHEME] )
|
||||
static_cast< SDLPP::TextRenderer* >(
|
||||
g_options_options[OPTIONS_MENU_COLOR_SCHEME].get() )
|
||||
->changeText( "Color scheme: " +
|
||||
color_schemes_names[selected_color_scheme] );
|
||||
g_update_colors = true;
|
||||
break;
|
||||
case OPTIONS_MENU_SHADOW:
|
||||
g_show_shadow = !g_show_shadow;
|
||||
std::dynamic_pointer_cast< SDLPP::TextRenderer >(
|
||||
g_options_options[OPTIONS_MENU_SHADOW] )
|
||||
static_cast< SDLPP::TextRenderer* >(
|
||||
g_options_options[OPTIONS_MENU_SHADOW].get() )
|
||||
->changeText( std::string( "Show shadow: " ) +
|
||||
( g_show_shadow ? "YES" : "NO" ) );
|
||||
g_update_colors = true;
|
||||
break;
|
||||
case OPTIONS_MENU_3D:
|
||||
g_show_3d = !g_show_3d;
|
||||
std::dynamic_pointer_cast< SDLPP::TextRenderer >(
|
||||
g_options_options[OPTIONS_MENU_3D] )
|
||||
static_cast< SDLPP::TextRenderer* >(
|
||||
g_options_options[OPTIONS_MENU_3D].get() )
|
||||
->changeText( std::string( "Show block texture: " ) +
|
||||
( g_show_3d ? "YES" : "NO" ) );
|
||||
g_update_colors = true;
|
||||
|
||||
Reference in New Issue
Block a user