TETRIS: change menu background, slightly alter checking for full lines

This commit is contained in:
zvon 2020-09-11 21:54:45 +02:00
parent bd60a8bf59
commit 0a06e1d841
4 changed files with 7 additions and 8 deletions

View File

@ -22,7 +22,7 @@ std::map<std::string, std::map<std::string, std::string>> color_schemes = {
{"barrier", "#AA0000"}, {"barrier", "#AA0000"},
{"text", "#FFFFFF"}, {"text", "#FFFFFF"},
{"text_out", "#000000"}, {"text_out", "#000000"},
{"menu_background", "#00000080"}, {"menu_background", "#000000BB"},
{"menu_item_background", "#FFFFFF40"}, {"menu_item_background", "#FFFFFF40"},
}}, }},
{ "gruvbox_dark", { { "gruvbox_dark", {
@ -46,7 +46,7 @@ std::map<std::string, std::map<std::string, std::string>> color_schemes = {
{"barrier", "#d65d0e"}, {"barrier", "#d65d0e"},
{"text", "#ebdbb2"}, {"text", "#ebdbb2"},
{"text_out", "#1d2021"}, {"text_out", "#1d2021"},
{"menu_background", "#28282880"}, {"menu_background", "#282828BB"},
{"menu_item_background", "#d5c4a180"}, {"menu_item_background", "#d5c4a180"},
}}, }},
{ "blackandwhite", { { "blackandwhite", {
@ -70,7 +70,7 @@ std::map<std::string, std::map<std::string, std::string>> color_schemes = {
{"barrier", "#FFFFFF"}, {"barrier", "#FFFFFF"},
{"text", "#FFFFFF"}, {"text", "#FFFFFF"},
{"text_out", "#000000"}, {"text_out", "#000000"},
{"menu_background", "#00000080"}, {"menu_background", "#000000BB"},
{"menu_item_background", "#FFFFFF40"}, {"menu_item_background", "#FFFFFF40"},
}}, }},
}; };

View File

@ -45,6 +45,8 @@ void updateShadow(SDLPP::Scene &scene) {
} }
void moveThem( std::shared_ptr< SDLPP::Scene > scene, int ticks ) { void moveThem( std::shared_ptr< SDLPP::Scene > scene, int ticks ) {
if ( !g_cur_object )
return;
auto movement = g_cur_object->getMovement(); auto movement = g_cur_object->getMovement();
g_ticks_till_fall -= ticks; g_ticks_till_fall -= ticks;
if ( g_cur_object->isDescending() ) if ( g_cur_object->isDescending() )

View File

@ -404,11 +404,9 @@ void mainSceneInput( std::shared_ptr< SDLPP::Scene > scene, int base, std::vecto
col->destroy(); col->destroy();
} }
auto colider_y = colider->getPos().second; auto colider_y = colider->getPos().second;
for ( auto &elem : scene->getObjects() ) { for ( auto &elem : scene->getObjects({BRICK_ID}) ) {
if ( elem->getId() != BRICK_ID )
continue;
auto pos = elem->getPos(); auto pos = elem->getPos();
if ( pos.second < colider_y && pos.first >= LEFT_BORDER && pos.first <= RIGHT_BORDER ) { if ( pos.second < colider_y && pos.first <= RIGHT_BORDER ) {
elem->setPos( pos.first, pos.second + BLOCK_SIZE ); elem->setPos( pos.first, pos.second + BLOCK_SIZE );
} }
} }

View File

@ -23,7 +23,6 @@ void doInput() {
while ( !g_quit ) { while ( !g_quit ) {
base = SDL_GetTicks(); base = SDL_GetTicks();
SDL_framerateDelay( &gFPS ); SDL_framerateDelay( &gFPS );
// TODO here comes the thingy
g_input_functions.back()(g_main_scene, base, line_coliders); g_input_functions.back()(g_main_scene, base, line_coliders);
} }
} }