1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:27:45 +00:00

Chess: Make chess widget resilient to missing piece images

Display a warning when some images are missing, instead of crashing.

Also, don't keep old images around when loading a new set, and make use
of get_piece_graphic() more often.
This commit is contained in:
Sam Atkins 2023-11-07 17:48:31 +00:00 committed by Andreas Kling
parent 39579436c1
commit 0875ef770f
2 changed files with 42 additions and 31 deletions

View file

@ -139,6 +139,7 @@ private:
Color m_marking_secondary_color { Color::from_argb(0x6655dd55) };
Chess::Color m_side { Chess::Color::White };
HashMap<Chess::Piece, RefPtr<Gfx::Bitmap const>> m_pieces;
bool m_any_piece_images_are_missing { false };
Chess::Square m_moving_square { 50, 50 };
Gfx::IntPoint m_drag_point;
bool m_dragging_piece { false };