diff --git a/Userland/Games/Solitaire/Game.cpp b/Userland/Games/Solitaire/Game.cpp index a3fc67f156..14e4ce5631 100644 --- a/Userland/Games/Solitaire/Game.cpp +++ b/Userland/Games/Solitaire/Game.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Till Mayer - * Copyright (c) 2021, Sam Atkins + * Copyright (c) 2021-2022, Sam Atkins * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause @@ -539,7 +539,7 @@ void Game::mark_intersecting_stacks_dirty(Card& intersecting_card) void Game::paint_event(GUI::PaintEvent& event) { - static Gfx::Color s_background_color = palette().color(background_role()); + Gfx::Color background_color = this->background_color(); GUI::Frame::paint_event(event); @@ -554,11 +554,11 @@ void Game::paint_event(GUI::PaintEvent& event) if (!m_focused_cards.is_empty()) { for (auto& focused_card : m_focused_cards) - focused_card.clear(painter, s_background_color); + focused_card.clear(painter, background_color); } for (auto& stack : m_stacks) { - stack.draw(painter, s_background_color); + stack.draw(painter, background_color); } if (!m_focused_cards.is_empty()) { diff --git a/Userland/Games/Solitaire/Game.h b/Userland/Games/Solitaire/Game.h index b3afd1c803..e619e5d317 100644 --- a/Userland/Games/Solitaire/Game.h +++ b/Userland/Games/Solitaire/Game.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Till Mayer - * Copyright (c) 2021, Sam Atkins + * Copyright (c) 2021-2022, Sam Atkins * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause @@ -9,9 +9,8 @@ #pragma once #include +#include #include -#include -#include using Cards::Card; using Cards::CardStack; @@ -29,7 +28,7 @@ enum class GameOverReason { NewGame, }; -class Game final : public GUI::Frame { +class Game final : public Cards::CardGame { C_OBJECT(Game) public: static constexpr int width = 640; diff --git a/Userland/Games/Solitaire/Solitaire.gml b/Userland/Games/Solitaire/Solitaire.gml index c2089f680a..d0a992c605 100644 --- a/Userland/Games/Solitaire/Solitaire.gml +++ b/Userland/Games/Solitaire/Solitaire.gml @@ -5,7 +5,6 @@ @Solitaire::Game { name: "game" fill_with_background_color: true - background_color: "green" } @GUI::Statusbar { diff --git a/Userland/Games/Solitaire/main.cpp b/Userland/Games/Solitaire/main.cpp index 47719acb88..d36207b824 100644 --- a/Userland/Games/Solitaire/main.cpp +++ b/Userland/Games/Solitaire/main.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2020, Till Mayer * Copyright (c) 2021, the SerenityOS developers. + * Copyright (c) 2022, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ @@ -29,7 +30,8 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-solitaire"sv)); - Config::pledge_domain("Solitaire"); + Config::pledge_domains({ "Games", "Solitaire" }); + Config::monitor_domain("Games"); TRY(Core::System::pledge("stdio recvfd sendfd rpath"));