feat(engine): add CardPlugin with procedural card rendering

Each card is a parent Sprite (white for face-up, blue for face-down) with
a Text2d child showing rank+suit (e.g. "AH", "10C", "KS"). Hearts and
diamonds render red; clubs and spades black. Face-down labels are hidden.
Tableau cards fan downward; other piles stack at the same position with a
small z-offset.

Sync runs in PostStartup for the initial deal and in Update after every
StateChangedEvent. To avoid a one-frame lag, downstream plugins run after
the new GameMutation system set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-04-23 16:22:49 -07:00
parent d92b4a8648
commit 0a87f0f8f2
4 changed files with 446 additions and 3 deletions
+8 -1
View File
@@ -12,6 +12,12 @@ use crate::events::{
};
use crate::resources::{DragState, GameStateResource, SyncStatusResource};
/// System set for `GamePlugin`'s state-mutating systems. Downstream plugins
/// that read the resulting `StateChangedEvent` should schedule themselves
/// `.after(GameMutation)` so updates propagate within a single frame.
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
pub struct GameMutation;
/// Registers game resources, events, and the systems that route user intent
/// (events) into mutations on `GameState`.
pub struct GamePlugin;
@@ -39,7 +45,8 @@ impl Plugin for GamePlugin {
handle_move,
handle_undo,
)
.chain(),
.chain()
.in_set(GameMutation),
);
}
}