refactor(engine,wasm,data): route all klondike/card_game imports through solitaire_core
All downstream crates now import Foundation, KlondikePile, Tableau, Klondike, Session, Suit, Rank exclusively from solitaire_core. solitaire_core is the single version-pin point for the upstream crates. - solitaire_engine: 19 files updated, klondike direct dep removed - solitaire_wasm: use statement updated, klondike direct dep removed - solitaire_data: unused klondike dep removed - Cargo.lock: klondike no longer a direct dep of engine/wasm/data - Full workspace clippy clean, all tests pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ use bevy::color::Color;
|
||||
use bevy::prelude::*;
|
||||
use bevy::sprite::Anchor;
|
||||
use bevy::window::WindowResized;
|
||||
use klondike::{Foundation, KlondikePile, Tableau};
|
||||
use solitaire_core::{Foundation, KlondikePile, Tableau};
|
||||
use solitaire_core::card::{Card, Rank, Suit};
|
||||
use solitaire_core::game_state::{DrawMode, GameState};
|
||||
|
||||
@@ -230,7 +230,7 @@ pub struct StockEmptyLabel;
|
||||
/// The badge is spawned as a *top-level* world entity (not parented to the
|
||||
/// stock [`PileMarker`]) and its `Transform` is recomputed each frame from
|
||||
/// `LayoutResource` so it tracks the stock pile through window resizes.
|
||||
/// The chip sits in the top-right corner of the stock pile and is hidden
|
||||
/// The chip sits in the bottom-right corner of the stock pile and is hidden
|
||||
/// while the stock is empty — the existing `↺` overlay
|
||||
/// ([`StockEmptyLabel`]) covers the recycle hint instead, so the two
|
||||
/// indicators never render simultaneously.
|
||||
@@ -301,13 +301,18 @@ pub struct CardShadow;
|
||||
#[derive(Component, Debug)]
|
||||
pub struct CardBackFrame;
|
||||
|
||||
/// Fill colour for the face-down card border frame. Medium gray so it reads as
|
||||
/// a neutral "edge" without competing with the suit colours on face-up cards.
|
||||
const CARD_BACK_FRAME_COLOR: Color = Color::srgb(0.38, 0.38, 0.38);
|
||||
/// Fill colour for the face-down card border frame. Light-medium gray so it
|
||||
/// reads as a clear "edge" without competing with the suit colours on face-up
|
||||
/// cards. Brightened from `0.38` to `0.48` (≈ #7a7a7a) after a Pixel_7 smoke
|
||||
/// test showed face-down `back_0.png` (≈ #1a1a1a) was nearly invisible against
|
||||
/// the very dark `#151515` felt — the old gray was too close to the back fill
|
||||
/// to define a crisp perimeter.
|
||||
const CARD_BACK_FRAME_COLOR: Color = Color::srgb(0.48, 0.48, 0.48);
|
||||
|
||||
/// Extra width/height (in world units) added to each side of the card to form
|
||||
/// the visible border. 3 world units ≈ 3 dp on a 1× screen.
|
||||
const CARD_BACK_FRAME_PADDING: f32 = 3.0;
|
||||
/// the visible border. Widened from `3.0` to `6.0` so the frame peeks out as a
|
||||
/// clearly readable perimeter at phone density (420 dpi) rather than a hairline.
|
||||
const CARD_BACK_FRAME_PADDING: f32 = 6.0;
|
||||
|
||||
/// Returns the `(offset, padding, alpha)` triple used to paint a per-card
|
||||
/// shadow given whether its parent card is currently part of the dragged
|
||||
@@ -1901,19 +1906,22 @@ fn update_stock_empty_indicator(
|
||||
// ---------------------------------------------------------------------------
|
||||
// Stock-pile remaining-count badge
|
||||
//
|
||||
// Shows a small "N" chip pinned to the top-right corner of the stock pile so
|
||||
// Shows a small "N" chip pinned to the bottom-right corner of the stock pile so
|
||||
// the player can see how many cards remain before the next recycle. The
|
||||
// existing `StockEmptyLabel` (`↺` overlay) covers the empty-stock case, so
|
||||
// the badge hides itself when the stock has zero cards — the two indicators
|
||||
// never render at the same time.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Inset (in pixels) from the top-right corner of the stock pile sprite to
|
||||
/// the centre of the count badge. Must satisfy `|x| >= STOCK_BADGE_SIZE.x / 2`
|
||||
/// so the badge right edge stays inside the stock pile and never overlaps the
|
||||
/// adjacent waste pile — critical on Android where `H_GAP_DIVISOR = 32` gives
|
||||
/// an inter-pile gap of only ~4 px.
|
||||
const STOCK_BADGE_INSET: Vec2 = Vec2::new(-20.0, -8.0);
|
||||
/// Inset (in pixels) from the bottom-right corner of the stock pile sprite to
|
||||
/// the centre of the count badge. Anchoring to the bottom-right keeps the chip
|
||||
/// clear of the rank/suit pip in the card's top-left corner. Both components
|
||||
/// move the centre *inward* from that corner: `x` is subtracted from the right
|
||||
/// edge, `y` is added to the bottom edge. The `x` magnitude must satisfy
|
||||
/// `x >= STOCK_BADGE_SIZE.x / 2` so the badge right edge stays inside the stock
|
||||
/// pile and never overlaps the adjacent waste pile — critical on Android where
|
||||
/// `H_GAP_DIVISOR = 32` gives an inter-pile gap of only ~4 px.
|
||||
const STOCK_BADGE_INSET: Vec2 = Vec2::new(20.0, 8.0);
|
||||
|
||||
/// Width / height of the badge background sprite, in world pixels. Sized so
|
||||
/// a 2-digit count (max "24") fits comfortably with `TYPE_BODY` (14 pt) text.
|
||||
@@ -1928,8 +1936,9 @@ fn stock_card_count(game: &GameState) -> usize {
|
||||
}
|
||||
|
||||
/// Returns the world-space `Vec3` for the centre of the stock-count badge,
|
||||
/// given the current `Layout`. The badge sits at the top-right corner of
|
||||
/// the stock pile sprite, inset by [`STOCK_BADGE_INSET`].
|
||||
/// given the current `Layout`. The badge sits at the bottom-right corner of
|
||||
/// the stock pile sprite, inset by [`STOCK_BADGE_INSET`], so it stays clear of
|
||||
/// the rank/suit pip in the card's top-left corner.
|
||||
fn stock_badge_translation(layout: &Layout) -> Vec3 {
|
||||
// Empty layouts don't contain a Stock entry — fall back to origin so
|
||||
// the badge stays in a deterministic spot until the layout is filled.
|
||||
@@ -1939,8 +1948,9 @@ fn stock_badge_translation(layout: &Layout) -> Vec3 {
|
||||
.copied()
|
||||
.unwrap_or(Vec2::ZERO);
|
||||
let half = layout.card_size * 0.5;
|
||||
let x = pile_pos.x + half.x + STOCK_BADGE_INSET.x;
|
||||
let y = pile_pos.y + half.y + STOCK_BADGE_INSET.y;
|
||||
// Anchor to the bottom-right corner, then move the centre inward.
|
||||
let x = pile_pos.x + half.x - STOCK_BADGE_INSET.x;
|
||||
let y = pile_pos.y - half.y + STOCK_BADGE_INSET.y;
|
||||
Vec3::new(x, y, Z_STOCK_BADGE)
|
||||
}
|
||||
|
||||
@@ -2357,7 +2367,7 @@ fn update_tableau_fan_frac(
|
||||
.into_iter()
|
||||
.map(|tableau| {
|
||||
game.0
|
||||
.pile(klondike::KlondikePile::Tableau(tableau))
|
||||
.pile(solitaire_core::KlondikePile::Tableau(tableau))
|
||||
.into_iter()
|
||||
.filter(|c| c.face_up)
|
||||
.count()
|
||||
|
||||
Reference in New Issue
Block a user