1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 07:17:34 +00:00

FlappyBug: Only paint areas which need to be painted

Drawing the entire PNG background is rather expensive. Instead, only
draw the rects that are updating.
This commit is contained in:
Timothy Flynn 2021-07-10 17:15:38 -04:00 committed by Andreas Kling
parent e2299b52de
commit dd65f52331
2 changed files with 17 additions and 4 deletions

View file

@ -148,6 +148,8 @@ private:
float m_difficulty {};
float m_restart_cooldown {};
const RefPtr<Gfx::Bitmap> m_background_bitmap { Gfx::Bitmap::load_from_file("/res/icons/flappybug/background.png") };
const Gfx::IntRect m_score_rect { 10, 10, 20, 20 };
const Gfx::IntRect m_text_rect { game_width / 2 - 80, game_height / 2 - 40, 160, 80 };
};
}