mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-03 20:13:56 -07:00
refactor: extract CARD_HEIGHT to shared CardDimensions header (#6668)
* refactor: extract CARD_HEIGHT to shared CardDimensions header Move duplicated CARD_WIDTH/CARD_HEIGHT constants to card_dimensions.h. Fixed documentation in z_value_layer_manager.h. * WIDTH_F used directly instead of casting * Improved consistency and added missing newlines at end of files
This commit is contained in:
parent
14f1925edc
commit
bd5cbb89d4
18 changed files with 108 additions and 78 deletions
29
cockatrice/src/game/card_dimensions.h
Normal file
29
cockatrice/src/game/card_dimensions.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef CARD_DIMENSIONS_H
|
||||
#define CARD_DIMENSIONS_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
/**
|
||||
* @file card_dimensions.h
|
||||
* @brief Canonical card dimension constants for layout and Z-value calculations.
|
||||
*
|
||||
* These values represent the logical pixel dimensions of a standard card graphic.
|
||||
* They are used throughout the game scene for layout, rendering, and Z-value computation.
|
||||
*/
|
||||
namespace CardDimensions
|
||||
{
|
||||
/// Card width in pixels
|
||||
constexpr int WIDTH = 72;
|
||||
/// Card height in pixels
|
||||
constexpr int HEIGHT = 102;
|
||||
|
||||
/// Pre-converted for floating-point contexts (Z-value calculations)
|
||||
constexpr qreal WIDTH_F = static_cast<qreal>(WIDTH);
|
||||
constexpr qreal HEIGHT_F = static_cast<qreal>(HEIGHT);
|
||||
|
||||
/// Half-dimensions for centering and rotation transforms
|
||||
constexpr qreal WIDTH_HALF_F = WIDTH_F / 2;
|
||||
constexpr qreal HEIGHT_HALF_F = HEIGHT_F / 2;
|
||||
} // namespace CardDimensions
|
||||
|
||||
#endif // CARD_DIMENSIONS_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue