mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +00:00
Spider: Migrate to CardGame
This commit is contained in:
parent
c709dc154f
commit
163a74e3e2
4 changed files with 9 additions and 7 deletions
|
@ -196,7 +196,7 @@ void Game::detect_victory()
|
|||
|
||||
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);
|
||||
|
||||
|
@ -206,11 +206,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,7 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -8,8 +9,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <LibCards/CardGame.h>
|
||||
#include <LibCards/CardStack.h>
|
||||
#include <LibGUI/Frame.h>
|
||||
|
||||
using Cards::Card;
|
||||
using Cards::CardStack;
|
||||
|
@ -28,7 +29,7 @@ enum class GameOverReason {
|
|||
Quit,
|
||||
};
|
||||
|
||||
class Game final : public GUI::Frame {
|
||||
class Game final : public Cards::CardGame {
|
||||
C_OBJECT(Game)
|
||||
public:
|
||||
static constexpr int width = 10 + 10 * Card::width + 90 + 10;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
@Spider::Game {
|
||||
name: "game"
|
||||
fill_with_background_color: true
|
||||
background_color: "green"
|
||||
}
|
||||
|
||||
@GUI::Statusbar {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (c) 2021, Mustafa Quraish <mustafa@serenityos.org>
|
||||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -44,7 +45,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-spider"sv));
|
||||
|
||||
Config::pledge_domain("Spider");
|
||||
Config::pledge_domains({ "Games", "Spider" });
|
||||
Config::monitor_domain("Games");
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue