diff --git a/src/cards/hand.rs b/src/cards/hand.rs deleted file mode 100644 index d2b9322..0000000 --- a/src/cards/hand.rs +++ /dev/null @@ -1,4 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component)] -pub struct Hand; diff --git a/src/cards/mod.rs b/src/cards/mod.rs deleted file mode 100644 index 3fb6364..0000000 --- a/src/cards/mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -use crate::lofpara_atlas::*; -use bevy::prelude::*; - -pub mod hand; - -#[derive(Component)] -pub struct Card; - -#[derive(Event)] -pub struct CreateCard { - parent: Option, -} - -pub fn on_create_card( - event: On, - mut commands: Commands, - atlas_layout: Res, - atlas_sprite: Res, -) { - commands.spawn(( - Card, - Transform::from_xyz(0., 0., 0.), - /*Sprite { - image: atlas_sprite.get(), - image_mode: SpriteImageMode::Auto, - texture_atlas: Some(TextureAtlas { layout: , index: () }) - },*/ - )); -} diff --git a/src/lofpara_atlas.rs b/src/lofpara_atlas.rs index 86e8e42..542b35f 100644 --- a/src/lofpara_atlas.rs +++ b/src/lofpara_atlas.rs @@ -1,43 +1,18 @@ use bevy::prelude::*; #[derive(Resource)] -pub struct LofparaAtlasLayout(Handle); - -impl LofparaAtlasLayout { - pub fn get(&self) -> Handle { - return self.0.clone(); - } -} - -#[derive(Resource)] -pub struct LofparaAtlasImage(Handle); - -impl LofparaAtlasImage { - pub fn get(&self) -> Handle { - return self.0.clone(); - } -} +pub struct LofparaAtlas(TextureAtlasLayout); pub struct LofparaAtlasPlugin; impl Plugin for LofparaAtlasPlugin { fn build(&self, app: &mut App) { - app.add_systems(Startup, startup_image); + let mut atlas = TextureAtlasLayout::new_empty(UVec2::new(1920, 1080)); + //Card, index = 0 + atlas.add_texture(URect::new(0, 0, 258, 363)); + //Cardholder, index = 1 + atlas.add_texture(URect::new(259, 0, 166, 166)); + + app.insert_resource(LofparaAtlas(atlas)); } } - -fn startup_image( - mut commands: Commands, - asset_server: Res, - mut atlas_layouts: ResMut>, -) { - commands.insert_resource(LofparaAtlasImage(asset_server.load("atlas.png"))); - - let mut atlas_layout = TextureAtlasLayout::new_empty(UVec2::new(1920, 1080)); - //Card, index = 0 - atlas_layout.add_texture(URect::new(0, 0, 258, 363)); - //Cardholder, index = 1 - atlas_layout.add_texture(URect::new(259, 0, 166, 166)); - - commands.insert_resource(LofparaAtlasLayout(atlas_layouts.add(atlas_layout))); -} diff --git a/src/main.rs b/src/main.rs index 5c7e7cc..cff54c9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,6 @@ use bevy::prelude::*; use crate::lofpara_atlas::LofparaAtlasPlugin; -mod cards; mod lofpara_atlas; fn main() {