diff --git a/src/main.rs b/src/main.rs index 27bac37..81d8daf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,10 @@ use amethyst::{ assets::Processor, core::transform::TransformBundle, prelude::*, - renderer::{types::DefaultBackend, RenderingSystem, SpriteSheet}, + renderer::{ + sprite_visibility::SpriteVisibilitySortingSystem, types::DefaultBackend, RenderingSystem, + SpriteSheet, + }, utils::application_root_dir, window::WindowBundle, }; @@ -24,6 +27,11 @@ fn main() -> amethyst::Result<()> { let game_data = GameDataBuilder::default() .with_bundle(WindowBundle::from_config_path(display_config))? .with_bundle(TransformBundle::new())? + .with( + SpriteVisibilitySortingSystem::new(), + "sprite_visibility_system", + &["transform_system"], + ) .with( Processor::::new(), "sprite_sheet_processor", diff --git a/src/render.rs b/src/render.rs index 032445b..ed0f89a 100644 --- a/src/render.rs +++ b/src/render.rs @@ -1,7 +1,7 @@ use amethyst::{ ecs::prelude::{ReadExpect, Resources, SystemData}, renderer::{ - pass::DrawFlat2DDesc, + pass::DrawFlat2DTransparentDesc, rendy::{ factory::Factory, graph::{ @@ -75,7 +75,8 @@ impl GraphCreator for RenderGraph { // Add additional draw groups here for things like UI let pass = builder.add_node( SubpassBuilder::new() - .with_group(DrawFlat2DDesc::new().builder()) // Draw sprites + // Draw sprites with transparency + .with_group(DrawFlat2DTransparentDesc::new().builder()) .with_color(color) .with_depth_stencil(depth) .into_pass(),