mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:17:44 +00:00
Hearts: Add support for playing more than one hand
This changes the game so that more than one hand can be played. Once one player has 100 or more points the game ends. A score card is shown between each hand. Fixes #7374.
This commit is contained in:
parent
e636ed43eb
commit
87ace131bc
6 changed files with 226 additions and 33 deletions
32
Userland/Games/Hearts/ScoreCard.h
Normal file
32
Userland/Games/Hearts/ScoreCard.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Player.h"
|
||||
#include <AK/Function.h>
|
||||
#include <LibGUI/Frame.h>
|
||||
|
||||
namespace Hearts {
|
||||
|
||||
class ScoreCard : public GUI::Frame {
|
||||
C_OBJECT(ScoreCard);
|
||||
|
||||
Gfx::IntSize recommended_size();
|
||||
|
||||
private:
|
||||
ScoreCard(Player (&players)[4], bool game_over);
|
||||
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
|
||||
static constexpr int column_width = 70;
|
||||
static constexpr int cell_padding = 5;
|
||||
|
||||
Player (&m_players)[4];
|
||||
bool m_game_over { false };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue