TETRIS: use new TextRenderer interface
This commit is contained in:
+13
-19
@@ -390,13 +390,6 @@ tetrisZLeft( std::shared_ptr< SDLPP::Renderer > renderer,
|
||||
return retPiece;
|
||||
}
|
||||
|
||||
void updateTextSizeInternal(std::shared_ptr<SDLPP::RenderObject> input) {
|
||||
if(input->getKilled())
|
||||
return;
|
||||
static_cast< SDLPP::TextRenderer* >( input.get() )->setTextColor(
|
||||
*g_font, colors["text"], colors["text_out"], 0.1 );
|
||||
}
|
||||
|
||||
void updateSize() {
|
||||
// have to resize rectangles for the text to be resized correctly
|
||||
g_main_scene->updateSizeAndPosition();
|
||||
@@ -404,19 +397,20 @@ void updateSize() {
|
||||
g_game_over_scene->updateSizeAndPosition();
|
||||
g_options_scene->updateSizeAndPosition();
|
||||
|
||||
std::unordered_set<int> textObjects = { TEXT_ID, MENU_TEXT_ID, MENU_ITEM_ID };
|
||||
for( auto &x : g_main_scene->getObjects( textObjects ) ) {
|
||||
updateTextSizeInternal(x);
|
||||
std::unordered_set< int > textObjects = { TEXT_ID, MENU_TEXT_ID,
|
||||
MENU_ITEM_ID };
|
||||
for ( auto &x : g_main_scene->getObjects( textObjects ) ) {
|
||||
x->updateSizeAndPosition();
|
||||
}
|
||||
updateTextSizeInternal(g_score_texture);
|
||||
for( auto &x : g_menu_scene->getObjects( textObjects ) ) {
|
||||
updateTextSizeInternal(x);
|
||||
g_score_texture->updateSizeAndPosition();
|
||||
for ( auto &x : g_menu_scene->getObjects( textObjects ) ) {
|
||||
x->updateSizeAndPosition();
|
||||
}
|
||||
for( auto &x : g_game_over_scene->getObjects( textObjects ) ) {
|
||||
updateTextSizeInternal(x);
|
||||
for ( auto &x : g_game_over_scene->getObjects( textObjects ) ) {
|
||||
x->updateSizeAndPosition();
|
||||
}
|
||||
for( auto &x : g_options_scene->getObjects( textObjects ) ) {
|
||||
updateTextSizeInternal(x);
|
||||
for ( auto &x : g_options_scene->getObjects( textObjects ) ) {
|
||||
x->updateSizeAndPosition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,8 +431,8 @@ void updateColors() {
|
||||
x->setColor( colors["line"] );
|
||||
}
|
||||
for ( auto &x : g_main_scene->getObjects( { TEXT_ID } ) ) {
|
||||
static_cast< SDLPP::TextRenderer* >( x.get() )->setTextColor(
|
||||
*g_font, colors["text"], colors["text_out"], 0.1 );
|
||||
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"] );
|
||||
g_game_over_options[g_game_over_select]->setColor(
|
||||
|
||||
Reference in New Issue
Block a user