mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-27 00:14:40 -07:00
[Game] Playmats (#7101)
* [Game] Playmats Took 19 seconds Took 1 minute * [Playmats] Add fixed override and configurable fallbacks to settings. Took 29 minutes Took 43 seconds * Add main to test. Took 1 minute Took 29 seconds * Move settings to own group Took 11 minutes * Some attempts to refresh macOS compositor Took 2 minutes * Try something else Took 17 minutes * Don't manipulate live list Took 11 minutes * Change things about resolution, address comments. Took 45 minutes Took 12 minutes * Comments. Took 14 minutes Took 8 seconds * Re-order settings menu location Took 2 minutes * Rename PlaymatResolution to Info and add enums Took 8 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
74a454552a
commit
9eafd90a91
52 changed files with 1931 additions and 28 deletions
|
|
@ -10,11 +10,13 @@ set(UTILITY_SOURCES libcockatrice/utility/expression.cpp libcockatrice/utility/l
|
|||
)
|
||||
|
||||
set(UTILITY_HEADERS
|
||||
libcockatrice/utility/card_ref.h
|
||||
libcockatrice/utility/color.h
|
||||
libcockatrice/utility/expression.h
|
||||
libcockatrice/utility/levenshtein.h
|
||||
libcockatrice/utility/macros.h
|
||||
libcockatrice/utility/passwordhasher.h
|
||||
libcockatrice/utility/playmat_params.h
|
||||
libcockatrice/utility/string_limits.h
|
||||
libcockatrice/utility/dice_limits.h
|
||||
libcockatrice/utility/counter_limits.h
|
||||
|
|
|
|||
52
libcockatrice_utility/libcockatrice/utility/playmat_params.h
Normal file
52
libcockatrice_utility/libcockatrice/utility/playmat_params.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef COCKATRICE_PLAYMAT_PARAMS_H
|
||||
#define COCKATRICE_PLAYMAT_PARAMS_H
|
||||
|
||||
#include "card_ref.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
/**
|
||||
* @struct PlaymatParams
|
||||
* @ingroup Decks
|
||||
* @brief Positioning parameters for a playmat card image.
|
||||
*
|
||||
* Controls how the cropped card art is positioned within the
|
||||
* combined table+stack play area. The coordinate system is
|
||||
* relative to the cropped art source image.
|
||||
*/
|
||||
struct PlaymatParams
|
||||
{
|
||||
double marginPctL = 0.07; ///< Left margin as fraction of card width (0.0–0.95).
|
||||
double marginPctR = 0.07; ///< Right margin as fraction of card width (0.0–0.95).
|
||||
double verticalOffset = 0.33; ///< Vertical position within card (0.0=top, 1.0=bottom).
|
||||
double zoom = 1.0; ///< Scale factor (0.1–4.0).
|
||||
|
||||
bool operator==(const PlaymatParams &other) const
|
||||
{
|
||||
return qFuzzyCompare(marginPctL, other.marginPctL) && qFuzzyCompare(marginPctR, other.marginPctR) &&
|
||||
qFuzzyCompare(verticalOffset, other.verticalOffset) && qFuzzyCompare(zoom, other.zoom);
|
||||
}
|
||||
|
||||
bool operator!=(const PlaymatParams &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct PlaymatInfo
|
||||
* @ingroup Decks
|
||||
* @brief A resolved playmat (card + positioning parameters).
|
||||
*/
|
||||
struct PlaymatInfo
|
||||
{
|
||||
CardRef card; ///< The card whose art is used as playmat.
|
||||
PlaymatParams params; ///< Positioning parameters for the playmat card image.
|
||||
|
||||
bool operator==(const PlaymatInfo &other) const
|
||||
{
|
||||
return card == other.card && params == other.params;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_PLAYMAT_PARAMS_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue