Skip to content

Commit

Permalink
Merge pull request #339 from Dauthdaert/main
Browse files Browse the repository at this point in the history
Add Default to TilemapArrayTexture
  • Loading branch information
StarArawn authored Nov 13, 2022
2 parents 21a783c + 29a564a commit fafb761
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
6 changes: 2 additions & 4 deletions examples/basic.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy::{prelude::*, render::texture::BevyDefault};
use bevy::prelude::*;
use bevy_ecs_tilemap::prelude::*;

mod helpers;
Expand Down Expand Up @@ -65,9 +65,7 @@ fn startup(
array_texture_loader.add(TilemapArrayTexture {
texture: TilemapTexture::Single(asset_server.load("tiles.png")),
tile_size,
format: BevyDefault::bevy_default(),
tile_spacing: Default::default(),
filter: Default::default(),
..Default::default()
});
}
}
Expand Down
17 changes: 16 additions & 1 deletion src/array_texture_preload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use crate::{
prelude::{TilemapSpacing, TilemapTileSize},
TilemapTexture,
};
use bevy::render::render_resource::{FilterMode, TextureFormat};
use bevy::render::{
render_resource::{FilterMode, TextureFormat},
texture::BevyDefault,
};
#[cfg(feature = "render")]
use bevy::{
prelude::{Assets, Image, Res, ResMut, Resource},
Expand All @@ -22,6 +25,18 @@ pub struct TilemapArrayTexture {
pub format: TextureFormat,
}

impl Default for TilemapArrayTexture {
fn default() -> Self {
Self {
texture: Default::default(),
tile_size: Default::default(),
tile_spacing: Default::default(),
filter: Default::default(),
format: BevyDefault::bevy_default(),
}
}
}

/// A bevy world resource that allows you to add atlas textures for
/// loading into the array texture cache.
#[derive(Resource, Default, Debug, Clone)]
Expand Down

0 comments on commit fafb761

Please sign in to comment.