printing all cards fitting roughly on screen for debug

main
Elijah Voigt 2 years ago
parent 1bea9e0a91
commit 2d78802153

@ -14,20 +14,26 @@ impl Plugin for SetupPlugin {
/// Setup drawing our cards on the screen /// Setup drawing our cards on the screen
pub(crate) fn setup_cards(mut commands: Commands, deck: Res<Deck>) { pub(crate) fn setup_cards(mut commands: Commands, deck: Res<Deck>) {
let size = 75.0;
Deck::iter_cards().enumerate().for_each(|(i, this_card)| { Deck::iter_cards().enumerate().for_each(|(i, this_card)| {
let this = deck let this = deck
.cards .cards
.get(&this_card) .get(&this_card)
.expect(format!("fech card sprite {:?}", this_card).as_str()) .expect(format!("fech card sprite {:?}", this_card).as_str())
.clone(); .clone();
let new_this = Sprite {
custom_size: Some(Vec2::new(size, size)),
..this
};
// for a 9x9 grid we want x to wrap every 9 and y to increment every 9 // for a 9x9 grid we want x to wrap every 9 and y to increment every 9
// TODO: Determine based on screen size what this offset and scaling should be
let x = i % 9; let x = i % 9;
let y = i / 9; let y = i / 9;
let l = 100.0; let l = size;
let x_off = -50.0 * 7.0; let x_off = -(size / 2.0) * 9.0;
let y_off = -50.0 * 5.0; let y_off = -(size / 2.0) * 8.0;
let t = Transform::from_xyz(l * (x as f32) + x_off, l * (y as f32) + y_off, 0.0); let t = Transform::from_xyz(l * (x as f32) + x_off, l * (y as f32) + y_off, 0.0);
commands.spawn((this, this_card, t)); commands.spawn((new_this, this_card, t));
}); });
} }

Loading…
Cancel
Save