From 4fc9c1d710636a0376313b20eb5544f490452edf Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 5 May 2021 12:19:10 -0400 Subject: Solitaire: Refactor painting logic to accomodate to-be-added widgets A series of events led to this change: The goal is to add more widgets to the Solitaire GML, such as a GUI::Statusbar. To do so without this change, the window ends up with some black artifacts between the main Solitaire frame and the added elements, because the GML specifies the main widget to have fill_with_background_color=false. However, setting that property to true results in the background color of the widget interferring with the Solitaire frame trying to manually paint its background green. This results in flickering and some elements in the Solitaire frame being painted over by the main background color. To avoid all of that behavior, this sets fill_with_background_color=true and the Solitaire frame's background color to green in the GML. Further, the frame now only queues a paint update on the specific Gfx::Rect areas that need to be updated. This also means we no longer need to track if a stack of cards is dirty, because we only trigger a paint event for dirty stacks. --- Userland/Games/Solitaire/Solitaire.gml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Userland/Games/Solitaire/Solitaire.gml') diff --git a/Userland/Games/Solitaire/Solitaire.gml b/Userland/Games/Solitaire/Solitaire.gml index e588ef1d58..d72f90c547 100644 --- a/Userland/Games/Solitaire/Solitaire.gml +++ b/Userland/Games/Solitaire/Solitaire.gml @@ -1,10 +1,12 @@ @GUI::Widget { - fill_with_background_color: false + fill_with_background_color: true layout: @GUI::VerticalBoxLayout { } @Solitaire::Game { name: "game" + fill_with_background_color: true + background_color: "green" } } -- cgit v1.2.3