Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade bevy_ecs_tilemap to 0.8 #134

Merged
merged 1 commit into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ members = ["macros"]

[dependencies]
bevy_ecs_ldtk_macros = { version = "0.4", optional = true, path = "macros" }
bevy_ecs_tilemap = "0.7"
bevy_ecs_tilemap = "0.8"
bevy = { version = "0.8", default-features = false, features = ["bevy_sprite"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
8 changes: 4 additions & 4 deletions src/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ pub fn spawn_level(
.insert_bundle(SpatialBundle::default())
.id();

storage.set(&TilePos::default(), Some(tile_entity));
storage.set(&TilePos::default(), tile_entity);

let tile_size = TilemapTileSize {
x: level.px_wid as f32,
y: level.px_hei as f32,
};
let texture = TilemapTexture(white_image_handle.clone());
let texture = TilemapTexture::Single(white_image_handle.clone());

commands
.entity(background_entity)
Expand Down Expand Up @@ -437,10 +437,10 @@ pub fn spawn_level(
.extend(1.);

let texture = match tileset_definition {
Some(tileset_definition) => TilemapTexture(
Some(tileset_definition) => TilemapTexture::Single(
tileset_map.get(&tileset_definition.uid).unwrap().clone(),
),
None => TilemapTexture(white_image_handle.clone()),
None => TilemapTexture::Single(white_image_handle.clone()),
};

let metadata_map: HashMap<i32, TileMetadata> = tileset_definition
Expand Down
5 changes: 4 additions & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ pub(crate) fn set_all_tiles_with_func(
let tile_pos = TilePos { x, y };
let tile_entity = func(tile_pos)
.map(|tile_bundle| commands.spawn_bundle(tile_bundle).insert(tilemap_id).id());
storage.set(&tile_pos, tile_entity);
match tile_entity {
Some(tile_entity) => storage.set(&tile_pos, tile_entity),
None => storage.remove(&tile_pos),
}
}
}
}
Expand Down