Fixed game over menu

This commit is contained in:
zvon 2020-08-24 20:07:11 +02:00
parent af5e7bbd34
commit 14943bf005

View File

@ -188,8 +188,8 @@ private:
std::vector< std::vector< int > > pieces_rel_position;
std::vector< std::shared_ptr< TetrisBlock > > pieces;
std::vector< std::pair< double, double > > original_pos;
double default_x;
double default_y;
double default_x = 0;
double default_y = 0;
bool descend = false;
};
@ -520,14 +520,14 @@ void addGameOver( SDLPP::Scene &scene, std::shared_ptr< SDLPP::Renderer > &r ) {
y->centerX();
scene.addObject( y );
auto restart =
std::make_shared< SDLPP::TextRenderer >( 0.4, 0.5, 0.2, 1, r );
std::make_shared< SDLPP::TextRenderer >( 0.4, 0.5, 0.2, 0.1, r );
restart->setText( *font, "Restart", "#FFFFFF", "#000000", 5 );
restart->centerX();
restart->setColor( "#FFFFFF40" );
scene.addObject( restart );
game_over_options.push_back( restart );
auto quit =
std::make_shared< SDLPP::TextRenderer >( 0.4, 0.7, 0.2, 1, r );
std::make_shared< SDLPP::TextRenderer >( 0.4, 0.7, 0.2, 0.1, r );
quit->setText( *font, "Quit Game", "#FFFFFF", "#000000", 5 );
quit->centerX();
scene.addObject( quit );
@ -792,7 +792,7 @@ void handleKeyDownGameOver( SDL_Keycode key ) {
inputThread.detach();
}
break;
case 2:
case 1:
quitGame();
default:
break;