summaryrefslogtreecommitdiff
path: root/Userland/Games/Spider
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-08-20 14:18:12 +0100
committerAndreas Kling <kling@serenityos.org>2022-08-22 12:50:41 +0200
commit163a74e3e2f73bca7f68e34fc087a735a120eaff (patch)
tree54f88270bcb3cdf7f2e95835944572c68e4160d1 /Userland/Games/Spider
parentc709dc154fc07fcf0a9b314a161907afd1afa301 (diff)
downloadserenity-163a74e3e2f73bca7f68e34fc087a735a120eaff.zip
Spider: Migrate to CardGame
Diffstat (limited to 'Userland/Games/Spider')
-rw-r--r--Userland/Games/Spider/Game.cpp6
-rw-r--r--Userland/Games/Spider/Game.h5
-rw-r--r--Userland/Games/Spider/Spider.gml1
-rw-r--r--Userland/Games/Spider/main.cpp4
4 files changed, 9 insertions, 7 deletions
diff --git a/Userland/Games/Spider/Game.cpp b/Userland/Games/Spider/Game.cpp
index 1bd5bb5928..7d57d0b98d 100644
--- a/Userland/Games/Spider/Game.cpp
+++ b/Userland/Games/Spider/Game.cpp
@@ -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()) {
diff --git a/Userland/Games/Spider/Game.h b/Userland/Games/Spider/Game.h
index b11156b6d0..263d464088 100644
--- a/Userland/Games/Spider/Game.h
+++ b/Userland/Games/Spider/Game.h
@@ -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;
diff --git a/Userland/Games/Spider/Spider.gml b/Userland/Games/Spider/Spider.gml
index 1ed45a5299..12c560b0ce 100644
--- a/Userland/Games/Spider/Spider.gml
+++ b/Userland/Games/Spider/Spider.gml
@@ -5,7 +5,6 @@
@Spider::Game {
name: "game"
fill_with_background_color: true
- background_color: "green"
}
@GUI::Statusbar {
diff --git a/Userland/Games/Spider/main.cpp b/Userland/Games/Spider/main.cpp
index 86b346c406..8dca996dc1 100644
--- a/Userland/Games/Spider/main.cpp
+++ b/Userland/Games/Spider/main.cpp
@@ -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"));