Hey we have all the cardscargo run

main
Elijah Voigt 2 years ago
parent f4da4356cf
commit 29eede8fa8

@ -0,0 +1,36 @@
open_circle_white.png filter=lfs diff=lfs merge=lfs -text
shaded_circle_green.png filter=lfs diff=lfs merge=lfs -text
shaded_circle_purple.png filter=lfs diff=lfs merge=lfs -text
filled_circle_white.png filter=lfs diff=lfs merge=lfs -text
open_circle_green.png filter=lfs diff=lfs merge=lfs -text
shaded_squiggle_white.png filter=lfs diff=lfs merge=lfs -text
filled_diamond_green.png filter=lfs diff=lfs merge=lfs -text
open_squiggle_purple.png filter=lfs diff=lfs merge=lfs -text
filled_squiggle_red.png filter=lfs diff=lfs merge=lfs -text
open_circle_red.png filter=lfs diff=lfs merge=lfs -text
open_circle_purple.png filter=lfs diff=lfs merge=lfs -text
open_squiggle_white.png filter=lfs diff=lfs merge=lfs -text
shaded_squiggle_red.png filter=lfs diff=lfs merge=lfs -text
filled_circle_green.png filter=lfs diff=lfs merge=lfs -text
filled_squiggle_green.png filter=lfs diff=lfs merge=lfs -text
shaded_diamond_purple.png filter=lfs diff=lfs merge=lfs -text
shaded_diamond_white.png filter=lfs diff=lfs merge=lfs -text
shaded_squiggle_purple.png filter=lfs diff=lfs merge=lfs -text
filled_diamond_purple.png filter=lfs diff=lfs merge=lfs -text
shaded_circle_red.png filter=lfs diff=lfs merge=lfs -text
filled_circle_purple.png filter=lfs diff=lfs merge=lfs -text
shaded_squiggle_green.png filter=lfs diff=lfs merge=lfs -text
open_diamond_purple.png filter=lfs diff=lfs merge=lfs -text
open_diamond_white.png filter=lfs diff=lfs merge=lfs -text
open_squiggle_red.png filter=lfs diff=lfs merge=lfs -text
shaded_circle_white.png filter=lfs diff=lfs merge=lfs -text
shaded_diamond_green.png filter=lfs diff=lfs merge=lfs -text
filled_squiggle_purple.png filter=lfs diff=lfs merge=lfs -text
open_diamond_green.png filter=lfs diff=lfs merge=lfs -text
filled_diamond_white.png filter=lfs diff=lfs merge=lfs -text
filled_squiggle_white.png filter=lfs diff=lfs merge=lfs -text
open_diamond_red.png filter=lfs diff=lfs merge=lfs -text
open_squiggle_green.png filter=lfs diff=lfs merge=lfs -text
shaded_diamond_red.png filter=lfs diff=lfs merge=lfs -text
filled_circle_red.png filter=lfs diff=lfs merge=lfs -text
filled_diamond_red.png filter=lfs diff=lfs merge=lfs -text

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 786 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 786 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 786 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 694 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 583 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 705 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

After

Width:  |  Height:  |  Size: 128 B

@ -11,11 +11,21 @@ impl Plugin for BootPlugin {
} }
/// loads assets for the game /// loads assets for the game
pub(crate) fn load(mut commands: Commands, server: Res<AssetServer>) { pub(crate) fn load(
mut commands: Commands,
server: Res<AssetServer>,
mut texture_atlases: ResMut<Assets<TextureAtlasLayout>>,
) {
let cards: HashMap<Card, Sprite> = Deck::iter_cards() let cards: HashMap<Card, Sprite> = Deck::iter_cards()
.map(|card| { .map(|card| {
let sprite_info = card.sprite();
let texture_atlas = TextureAtlas {
layout: texture_atlases.add(sprite_info.1),
index: sprite_info.2 as usize,
};
let sprite = Sprite { let sprite = Sprite {
image: server.load(card.sprite()), image: server.load(sprite_info.0),
texture_atlas: Some(texture_atlas),
..default() ..default()
}; };

@ -57,28 +57,33 @@ pub(crate) struct Card {
} }
impl Card { impl Card {
pub(crate) fn sprite(&self) -> String { pub(crate) fn sprite(&self) -> (String, TextureAtlasLayout, u8) {
let fname = {
let col = match self.color { let col = match self.color {
ItemColor::Red => "cr", ItemColor::Red => "red",
ItemColor::Green => "cg", ItemColor::Green => "green",
ItemColor::Purple => "cp", ItemColor::Purple => "purple",
};
let num = match self.number {
ItemNumber::One => "n1",
ItemNumber::Two => "n2",
ItemNumber::Three => "n3",
}; };
let pat = match self.pattern { let pat = match self.pattern {
ItemPattern::Solid => "pso", ItemPattern::Solid => "filled",
ItemPattern::Striped => "pst", ItemPattern::Striped => "shaded",
ItemPattern::Open => "pop", ItemPattern::Open => "open",
}; };
let shape = match self.shape { let shape = match self.shape {
ItemShape::Oval => "so", ItemShape::Oval => "circle",
ItemShape::Diamond => "sd", ItemShape::Diamond => "diamond",
ItemShape::Squiggle => "ss", ItemShape::Squiggle => "squiggle",
};
format!("{}_{}_{}.png", pat, shape, col)
}; };
format!("{}_{}_{}_{}.png", col, num, pat, shape) let num = match self.number {
ItemNumber::One => 0,
ItemNumber::Two => 1,
ItemNumber::Three => 2,
};
let layout = TextureAtlasLayout::from_grid(UVec2 { x: 20, y: 32 }, 3, 1, None, None);
(fname, layout, num)
} }
} }

@ -8,7 +8,7 @@ use bevy::prelude::*;
fn main() { fn main() {
App::new() App::new()
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest()))
.add_plugins(( .add_plugins((
deck::DeckPlugin, deck::DeckPlugin,
debug::DebugPlugin, debug::DebugPlugin,

Loading…
Cancel
Save