Skip to content

Commit

Permalink
Merge pull request #3 from eLVas/update_to_bevy_0.8
Browse files Browse the repository at this point in the history
Update to bevy 0.8
  • Loading branch information
MrGVSV authored Sep 21, 2022
2 parents a0e6d60 + ed2a8b2 commit 0a6f24e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_tile_atlas"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
authors = ["Gino Valente <[email protected]>"]
description = "A TextureAtlas builder for ordered tilesets"
Expand All @@ -11,17 +11,17 @@ readme = "README.md"
exclude = ["assets/**/*", ".github/**/*"]

[dependencies]
bevy_asset = { version = "0.7", default-features = false }
bevy_ecs = { version = "0.7", default-features = false }
bevy_log = { version = "0.7", default-features = false, optional = true }
bevy_math = { version = "0.7", default-features = false }
bevy_render = { version = "0.7", default-features = false }
bevy_sprite = { version = "0.7", default-features = false }
bevy_utils = { version = "0.7", default-features = false }
bevy_asset = { version = "0.8", default-features = false }
bevy_ecs = { version = "0.8", default-features = false }
bevy_log = { version = "0.8", default-features = false, optional = true }
bevy_math = { version = "0.8", default-features = false }
bevy_render = { version = "0.8", default-features = false }
bevy_sprite = { version = "0.8", default-features = false }
bevy_utils = { version = "0.8", default-features = false }
thiserror = "1.0.30"

[dev-dependencies]
bevy = "0.7"
bevy = "0.8"

[features]
default = ["debug"]
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This crate is essentially an augmentation of Bevy's own `TextureAtlasBuilder`.
Add to your `[dependencies]` list in `Cargo.toml`:

```toml
bevy_tile_atlas = "0.3.0"
bevy_tile_atlas = "0.4.0"
```

## Usage
Expand Down Expand Up @@ -58,6 +58,7 @@ fn build_tileset(handles: Vec<Handle<Image>>, textures: &mut Assets<Image>) -> T

| bevy | bevy_tile_atlas |
|------|-----------------|
| 0.8 | 0.4.0 |
| 0.7 | 0.3.0 |
| 0.6 | 0.2.0 |
| 0.5 | 0.1.4 |
Expand Down
6 changes: 3 additions & 3 deletions examples/atlas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn load_tiles(
asset_server.load_untyped("tiles/grass.png"),
];
handles.0 = tiles;
state.set(AppState::CreateTileset).unwrap();
state.overwrite_set(AppState::CreateTileset).unwrap();
}

fn create_atlas(
Expand All @@ -74,7 +74,7 @@ fn create_atlas(
let mut is_first = true;

for handle in &handles.0 {
if let Some(texture) = textures.get(handle) {
if let Some(texture) = textures.get(&handle.typed_weak()) {
if let Ok(index) = builder.add_texture(handle.clone().typed::<Image>(), texture) {
println!("Added texture at index: {}", index);
}
Expand All @@ -98,7 +98,7 @@ fn display_atlas(
mut commands: Commands,
mut atlases: ResMut<Assets<TextureAtlas>>,
) {
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
commands.spawn_bundle(Camera2dBundle::default());

let atlas = atlas_res.0.take().unwrap();
let handle = atlas.texture.clone();
Expand Down
2 changes: 1 addition & 1 deletion src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl TextureStore for Assets<Image> {
}

fn get<H: Into<HandleId>>(&self, handle: H) -> Option<&Image> {
self.get(handle)
self.get(&Handle::weak(handle.into()))
}
}

Expand Down

0 comments on commit 0a6f24e

Please sign in to comment.