mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
Solitaire: Migrate to CardGame
This commit is contained in:
parent
c5b7ad6004
commit
f9f25271b3
4 changed files with 10 additions and 10 deletions
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
@Solitaire::Game {
|
||||
name: "game"
|
||||
fill_with_background_color: true
|
||||
background_color: "green"
|
||||
}
|
||||
|
||||
@GUI::Statusbar {
|
||||
|
|
|
@ -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"));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue