mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
LibCards: Add a CardGame base class
For now, the only feature of this is that it sets the background colour from the `Games::Cards::BackgroundColor` config value. Later, other card game configuration and shared behaviour can go here, to save duplicating it in each game.
This commit is contained in:
parent
a01c4c50d1
commit
c5b7ad6004
3 changed files with 71 additions and 1 deletions
30
Userland/Libraries/LibCards/CardGame.h
Normal file
30
Userland/Libraries/LibCards/CardGame.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibConfig/Listener.h>
|
||||
#include <LibGUI/Frame.h>
|
||||
|
||||
namespace Cards {
|
||||
|
||||
class CardGame
|
||||
: public GUI::Frame
|
||||
, public Config::Listener {
|
||||
public:
|
||||
virtual ~CardGame() = default;
|
||||
|
||||
Gfx::Color background_color() const;
|
||||
void set_background_color(Gfx::Color const&);
|
||||
|
||||
protected:
|
||||
CardGame();
|
||||
|
||||
private:
|
||||
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue