diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-08-20 14:17:37 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-22 12:50:41 +0200 |
commit | f9f25271b335b587d0c64605af110d0205dd0a0b (patch) | |
tree | 3daba466c146a47af318c260cfb4b5fe97d378c7 | |
parent | c5b7ad60047a49f7cbbd6435184b84ddec93506a (diff) | |
download | serenity-f9f25271b335b587d0c64605af110d0205dd0a0b.zip |
Solitaire: Migrate to CardGame
-rw-r--r-- | Userland/Games/Solitaire/Game.cpp | 8 | ||||
-rw-r--r-- | Userland/Games/Solitaire/Game.h | 7 | ||||
-rw-r--r-- | Userland/Games/Solitaire/Solitaire.gml | 1 | ||||
-rw-r--r-- | Userland/Games/Solitaire/main.cpp | 4 |
4 files changed, 10 insertions, 10 deletions
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 <till.mayer@web.de> - * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> + * Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org> * 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 <till.mayer@web.de> - * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> + * Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org> * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause @@ -9,9 +9,8 @@ #pragma once #include <AK/Array.h> +#include <LibCards/CardGame.h> #include <LibCards/CardStack.h> -#include <LibGUI/Frame.h> -#include <LibGUI/Painter.h> 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 <till.mayer@web.de> * Copyright (c) 2021, the SerenityOS developers. + * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -29,7 +30,8 @@ ErrorOr<int> 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")); |