Fixed game over menu
This commit is contained in:
parent
af5e7bbd34
commit
14943bf005
10
tetris.cpp
10
tetris.cpp
@ -188,8 +188,8 @@ private:
|
|||||||
std::vector< std::vector< int > > pieces_rel_position;
|
std::vector< std::vector< int > > pieces_rel_position;
|
||||||
std::vector< std::shared_ptr< TetrisBlock > > pieces;
|
std::vector< std::shared_ptr< TetrisBlock > > pieces;
|
||||||
std::vector< std::pair< double, double > > original_pos;
|
std::vector< std::pair< double, double > > original_pos;
|
||||||
double default_x;
|
double default_x = 0;
|
||||||
double default_y;
|
double default_y = 0;
|
||||||
bool descend = false;
|
bool descend = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -520,14 +520,14 @@ void addGameOver( SDLPP::Scene &scene, std::shared_ptr< SDLPP::Renderer > &r ) {
|
|||||||
y->centerX();
|
y->centerX();
|
||||||
scene.addObject( y );
|
scene.addObject( y );
|
||||||
auto restart =
|
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->setText( *font, "Restart", "#FFFFFF", "#000000", 5 );
|
||||||
restart->centerX();
|
restart->centerX();
|
||||||
restart->setColor( "#FFFFFF40" );
|
restart->setColor( "#FFFFFF40" );
|
||||||
scene.addObject( restart );
|
scene.addObject( restart );
|
||||||
game_over_options.push_back( restart );
|
game_over_options.push_back( restart );
|
||||||
auto quit =
|
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->setText( *font, "Quit Game", "#FFFFFF", "#000000", 5 );
|
||||||
quit->centerX();
|
quit->centerX();
|
||||||
scene.addObject( quit );
|
scene.addObject( quit );
|
||||||
@ -792,7 +792,7 @@ void handleKeyDownGameOver( SDL_Keycode key ) {
|
|||||||
inputThread.detach();
|
inputThread.detach();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 1:
|
||||||
quitGame();
|
quitGame();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user