Skip to content

Commit

Permalink
Comment out ImageToSprite progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldom-SE committed Dec 15, 2024
1 parent 0790c23 commit f8877c9
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 431 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ target/
/Cargo.lock
.vscode/
imported_assets/
.DS_Store
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ anyhow = "1.0"
event-listener = "5.3"
serde = "1.0"
line_drawing = { version = "1.0", optional = true }
kiddo = { version = "4.2" }
seldom_singleton = "0.2.0"
bevy_turborand = { version = "0.9.0", optional = true }
seldom_map_nav = { version = "0.7.0", optional = true }
Expand Down
3 changes: 2 additions & 1 deletion src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl<P: Pixel> PxImage<P> {
self.image.len()
}

#[allow(unused)]
pub(crate) fn iter_mut(&mut self) -> impl Iterator<Item = &mut P> {
self.image.iter_mut()
}
Expand Down Expand Up @@ -178,7 +179,7 @@ pub(crate) struct PxImageSliceMut<'a, P: Pixel> {
slice: IRect,
}

impl<'a, P: Pixel> PxImageSliceMut<'a, P> {
impl<P: Pixel> PxImageSliceMut<'_, P> {
/// First `usize` is the index in the slice. Second `usize` is the index in the image.
pub(crate) fn for_each_mut(&mut self, f: impl Fn(usize, usize, &mut P)) {
let row_min = self.slice.min.x.clamp(0, self.width as i32) as usize;
Expand Down
3 changes: 2 additions & 1 deletion src/palette.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ static ASSET_PALETTE_INITIALIZED: AtomicBool = AtomicBool::new(false);
/// Notifies after `ASSET_PALETTE_INITIALIZED` is set
static ASSET_PALETTE_JUST_INITIALIZED: Event = Event::new();

#[allow(static_mut_refs)]
pub(crate) async fn asset_palette() -> &'static Palette {
if ASSET_PALETTE_INITIALIZED.load(Ordering::SeqCst) {
// SAFETY: Checked above
Expand All @@ -159,7 +160,7 @@ pub(crate) async fn asset_palette() -> &'static Palette {

just_initialized.await;
// SAFETY: `just_initialized` finished waiting, so `ASSET_PALETTE_INITIALIZED` is set
return unsafe { ASSET_PALETTE.as_ref() }.unwrap();
unsafe { ASSET_PALETTE.as_ref() }.unwrap()
}

fn load_asset_palette(palette: LoadingAssetPaletteParam, mut cmd: Commands) {
Expand Down
25 changes: 12 additions & 13 deletions src/particle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@ use crate::{position::PxLayer, prelude::*, set::PxSet};
const TIME_OFFSET: Duration = Duration::from_secs(60 * 60 * 24);

pub(crate) fn plug<L: PxLayer>(app: &mut App) {
app.configure_sets(PostUpdate, PxSet::UpdateEmitters.before(PxSet::Draw))
.add_systems(
PostUpdate,
app.add_systems(
PostUpdate,
(
(
(
(simulate_emitters::<L>, insert_emitter_time),
(apply_deferred, update_emitters::<L>)
.chain()
.in_set(PxSet::UpdateEmitters),
)
.chain(),
despawn_particles.before(PxSet::Draw),
),
);
(simulate_emitters::<L>, insert_emitter_time),
(apply_deferred, update_emitters::<L>)
.chain()
.in_set(PxSet::UpdateEmitters),
)
.chain(),
despawn_particles,
),
);
}

/// Possible sprites for an emitter's particles
Expand Down
Loading

0 comments on commit f8877c9

Please sign in to comment.