-
Notifications
You must be signed in to change notification settings - Fork 8
Upgrade to bevy 0.7 #5
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
base: main
Are you sure you want to change the base?
Changes from all commits
98dfc80
c904ec3
e8f7c31
f23b742
7ca9e06
a4c2323
006c1c5
d79e2ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,14 @@ fn main() { | |
.add_plugins(DefaultPlugins) | ||
.add_plugin(TilemapPlugin) | ||
.add_plugin(loader::AseLoaderDefaultPlugin) | ||
.add_system(exit_on_esc_system.system()) | ||
.add_system(exit_on_esc_system) | ||
.add_state(AppState::Loading) | ||
.add_system_set(SystemSet::on_enter(AppState::Loading).with_system(load_sprites.system())) | ||
.add_system_set(SystemSet::on_enter(AppState::Loading).with_system(load_sprites)) | ||
.add_system_set( | ||
SystemSet::on_update(AppState::Loading).with_system(check_loading_sprites.system()), | ||
SystemSet::on_update(AppState::Loading).with_system(check_loading_sprites), | ||
) | ||
.add_system_set(SystemSet::on_enter(AppState::Game).with_system(spawn_camera.system())) | ||
.add_system_set(SystemSet::on_enter(AppState::Game).with_system(spawn_tiles.system())) | ||
.add_system_set(SystemSet::on_enter(AppState::Game).with_system(spawn_camera)) | ||
.add_system_set(SystemSet::on_enter(AppState::Game).with_system(spawn_tiles)) | ||
.run() | ||
} | ||
|
||
|
@@ -64,7 +64,7 @@ fn set_tiles(layer_builder: &mut LayerBuilder<TileBundle>) { | |
..Tile::default() | ||
}; | ||
let tile_pos = UVec2::new(x as u32, y as u32); | ||
layer_builder.set_tile(tile_pos, tile.into()).unwrap(); | ||
layer_builder.set_tile(tile_pos.into(), tile.into()).unwrap(); | ||
} | ||
} | ||
} | ||
|
@@ -77,16 +77,16 @@ fn spawn_tiles( | |
) { | ||
for (_, tileset) in tilesets.iter() { | ||
let texture_handle = tileset.texture.clone(); | ||
let material_handle = materials.add(ColorMaterial::texture(texture_handle)); | ||
//let material_handle = materials.add(ColorMaterial::from(texture_handle)); | ||
// The layer_settings method of Tileset is implemented in the "bevy_ecs_tilemap" feature. | ||
let settings = tileset.layer_settings(UVec2::new(3, 3), UVec2::new(3, 3)); | ||
let settings = tileset.layer_settings(MapSize(3, 3), ChunkSize(3, 3)); | ||
|
||
let (mut layer_builder, layer_entity) = | ||
LayerBuilder::<TileBundle>::new(&mut commands, settings, 0u16, 0u16); | ||
|
||
set_tiles(&mut layer_builder); | ||
|
||
map_query.build_layer(&mut commands, layer_builder, material_handle); | ||
map_query.build_layer(&mut commands, layer_builder, texture_handle); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed these because build_layer doesn't accept ColorMaterial. I made this change quickly without understanding what the example is trying to do, I'll fix it soon |
||
|
||
let map_entity = commands.spawn().id(); | ||
let mut map = Map::new(0u16, map_entity); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ pub(crate) struct SpriteData<T> { | |
} | ||
impl SpriteData<Image> { | ||
pub(crate) fn new(ase: &AsepriteFile, frame: u32) -> Self { | ||
let img = ase.frame(frame).image(); | ||
let img = &ase.frame(frame).image(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know why I did this, I'll look into that |
||
let size = Extent3d { | ||
width: ase.width() as u32, | ||
height: ase.height() as u32, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mean to leave these comments in.