#[cfg(any( feature = "ldtk_1_3_0", feature = "ldtk_1_2_5", feature = "ldtk_1_2_4", feature = "ldtk_1_2_3", feature = "ldtk_1_2_2", feature = "ldtk_1_2_1", feature = "ldtk_1_2_0", feature = "ldtk_1_1_3", feature = "ldtk_1_1_2", feature = "ldtk_1_1_1", feature = "ldtk_1_1_0", feature = "ldtk_1_0_0", ))] mod assets; mod camera; mod map_query; mod pregen; mod system; #[cfg(any( feature = "ldtk_1_3_0", feature = "ldtk_1_2_5", feature = "ldtk_1_2_4", feature = "ldtk_1_2_3", feature = "ldtk_1_2_2", feature = "ldtk_1_2_1", feature = "ldtk_1_2_0", feature = "ldtk_1_1_3", feature = "ldtk_1_1_2", feature = "ldtk_1_1_1", feature = "ldtk_1_1_0", feature = "ldtk_1_0_0", ))] pub mod ldtk; pub static mut LDTK_TILE_SCALE: AtomicU32 = AtomicU32::new(32); pub fn get_ldtk_tile_scale() -> f32 { unsafe { *LDTK_TILE_SCALE.get_mut() as f32 } } pub fn set_ldtk_tile_scale_u32(scale: u32) { unsafe { LDTK_TILE_SCALE.store(scale, Ordering::Release); } } pub fn set_ldtk_tile_scale_f32(scale: f32) { unsafe { LDTK_TILE_SCALE.store(scale as u32, Ordering::Release); } } mod __plugin { use std::marker::PhantomData; use bevy::ecs::query::ReadOnlyWorldQuery; use bevy::prelude::*; pub struct MicroLDTKPlugin; impl Plugin for MicroLDTKPlugin { fn build(&self, app: &mut App) { #[cfg(any( feature = "ldtk_1_3_0", feature = "ldtk_1_2_5", feature = "ldtk_1_2_4", feature = "ldtk_1_2_3", feature = "ldtk_1_2_2", feature = "ldtk_1_2_1", feature = "ldtk_1_2_0", feature = "ldtk_1_1_3", feature = "ldtk_1_1_2", feature = "ldtk_1_1_1", feature = "ldtk_1_1_0", feature = "ldtk_1_0_0", ))] { app.add_event::<super::system::LevelDataUpdated>() .add_asset::<super::ldtk::Project>() .add_asset_loader(super::ldtk::LdtkLoader) .init_resource::<super::assets::TilesetIndex>() .init_resource::<super::assets::LevelIndex>() .add_systems(Update, super::assets::handle_ldtk_project_events); } } } impl<CameraFilter: ReadOnlyWorldQuery + Send + Sync + 'static> MicroLDTKCameraPlugin<CameraFilter> { pub fn new() -> Self { Self { _p: PhantomData::default(), } } } impl<CameraFilter: ReadOnlyWorldQuery + Send + Sync + 'static> Default for MicroLDTKCameraPlugin<CameraFilter> { fn default() -> Self { Self::new() } } pub struct MicroLDTKCameraPlugin<CameraFilter: ReadOnlyWorldQuery> { _p: PhantomData<CameraFilter>, } impl<CameraFilter: ReadOnlyWorldQuery + Send + Sync + 'static> Plugin for MicroLDTKCameraPlugin<CameraFilter> { fn build(&self, app: &mut App) { app.add_systems( PostUpdate, super::camera::lock_camera_to_level::<CameraFilter>, ); } } } use std::sync::atomic::{AtomicU32, Ordering}; pub use __plugin::{MicroLDTKCameraPlugin, MicroLDTKPlugin}; pub use assets::{LevelIndex, TileMetadata, TilesetIndex}; pub use camera::CameraBounder; pub use ldtk::{LdtkLoader, LdtkProject}; pub use map_query::{CameraBounds, MapQuery}; #[cfg(feature = "autotile")] pub use micro_autotile as autotile; pub use pregen::{write_layer_to_texture, write_map_to_texture, Rasterise}; pub use system::*;