mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:57:45 +00:00
Solitaire: Disable filling with background color during end animation
This fixes #7792. The visual glitches with card corners, and the screen-clear when opening a menu, were both caused by the widgets having `fill_with_background_color` set. We need that set most of the time, so we just disable it for the duration of the game-over animation. Also resove a FIXME that no longer applies. :^)
This commit is contained in:
parent
679f831451
commit
364d728e66
2 changed files with 12 additions and 1 deletions
|
@ -52,6 +52,7 @@ void Game::timer_event(Core::TimerEvent&)
|
||||||
if (m_start_game_over_animation_next_frame) {
|
if (m_start_game_over_animation_next_frame) {
|
||||||
m_start_game_over_animation_next_frame = false;
|
m_start_game_over_animation_next_frame = false;
|
||||||
m_game_over_animation = true;
|
m_game_over_animation = true;
|
||||||
|
set_background_fill_enabled(false);
|
||||||
} else if (m_game_over_animation) {
|
} else if (m_game_over_animation) {
|
||||||
VERIFY(!m_animation.card().is_null());
|
VERIFY(!m_animation.card().is_null());
|
||||||
if (m_animation.card()->position().x() >= Game::width || m_animation.card()->rect().right() <= 0)
|
if (m_animation.card()->position().x() >= Game::width || m_animation.card()->rect().right() <= 0)
|
||||||
|
@ -73,6 +74,15 @@ void Game::create_new_animation_card()
|
||||||
m_animation = Animation(card, rand_float() + .4f, x_sgn * ((rand() % 3) + 2), .6f + rand_float() * .4f);
|
m_animation = Animation(card, rand_float() + .4f, x_sgn * ((rand() % 3) + 2), .6f + rand_float() * .4f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::set_background_fill_enabled(bool enabled)
|
||||||
|
{
|
||||||
|
Widget* widget = this;
|
||||||
|
while (widget) {
|
||||||
|
widget->set_fill_with_background_color(enabled);
|
||||||
|
widget = widget->parent_widget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Game::start_game_over_animation()
|
void Game::start_game_over_animation()
|
||||||
{
|
{
|
||||||
if (m_game_over_animation)
|
if (m_game_over_animation)
|
||||||
|
@ -100,6 +110,7 @@ void Game::stop_game_over_animation()
|
||||||
if (!m_game_over_animation)
|
if (!m_game_over_animation)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
set_background_fill_enabled(true);
|
||||||
m_game_over_animation = false;
|
m_game_over_animation = false;
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
@ -188,7 +199,6 @@ void Game::keydown_event(GUI::KeyEvent& event)
|
||||||
auto_move_eligible_cards_to_foundations();
|
auto_move_eligible_cards_to_foundations();
|
||||||
} else if (event.key() == KeyCode::Key_Space) {
|
} else if (event.key() == KeyCode::Key_Space) {
|
||||||
draw_cards();
|
draw_cards();
|
||||||
invalidate_layout(); // FIXME: Stock stack won't render properly after draw_cards() without this
|
|
||||||
} else if (event.shift() && event.key() == KeyCode::Key_F11) {
|
} else if (event.shift() && event.key() == KeyCode::Key_F11) {
|
||||||
dump_layout();
|
dump_layout();
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,7 @@ private:
|
||||||
void start_game_over_animation();
|
void start_game_over_animation();
|
||||||
void stop_game_over_animation();
|
void stop_game_over_animation();
|
||||||
void create_new_animation_card();
|
void create_new_animation_card();
|
||||||
|
void set_background_fill_enabled(bool);
|
||||||
void check_for_game_over();
|
void check_for_game_over();
|
||||||
void dump_layout() const;
|
void dump_layout() const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue