From cb65b67530e26a5fc13d700258d5a625cf0b91e7 Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 20 Jan 2024 10:47:53 -0800 Subject: [PATCH] minor rename --- crates/content/src/animautomaton.rs | 6 +++--- crates/content/src/part/effect.rs | 6 +++--- crates/content/src/part/sprite.rs | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/content/src/animautomaton.rs b/crates/content/src/animautomaton.rs index 44b1252..23dfebf 100644 --- a/crates/content/src/animautomaton.rs +++ b/crates/content/src/animautomaton.rs @@ -1,4 +1,4 @@ -use crate::{AnimSectionHandle, Content, SectionEdge, SpriteHandle, SpriteStart}; +use crate::{AnimSectionHandle, Content, SectionEdge, SpriteHandle, StartEdge}; /// A single frame's state #[derive(Debug, Clone)] @@ -74,12 +74,12 @@ impl AnimAutomaton { let sprite = ct.get_sprite(sprite_handle); let (current_section, texture, current_direction) = match sprite.start_at { - SpriteStart::Top { section } => ( + StartEdge::Top { section } => ( section, *sprite.get_section(section).frames.first().unwrap(), AnimDirection::Down, ), - SpriteStart::Bot { section } => ( + StartEdge::Bot { section } => ( section, *sprite.get_section(section).frames.last().unwrap(), AnimDirection::Up, diff --git a/crates/content/src/part/effect.rs b/crates/content/src/part/effect.rs index 57c5dfe..828b972 100644 --- a/crates/content/src/part/effect.rs +++ b/crates/content/src/part/effect.rs @@ -8,7 +8,7 @@ pub(crate) mod syntax { use galactica_util::to_radians; use serde::Deserialize; - use crate::{Content, ContentBuildContext, EffectHandle, SpriteStart}; + use crate::{Content, ContentBuildContext, EffectHandle, StartEdge}; // Raw serde syntax structs. // These are never seen by code outside this crate. @@ -59,8 +59,8 @@ pub(crate) mod syntax { // Match lifetime of first section of sprite let sprite = content.get_sprite(sprite); let sec = match sprite.start_at { - SpriteStart::Top { section } => sprite.get_section(section), - SpriteStart::Bot { section } => sprite.get_section(section), + StartEdge::Top { section } => sprite.get_section(section), + StartEdge::Bot { section } => sprite.get_section(section), }; sec.frame_duration * sec.frames.len() as f32 } else { diff --git a/crates/content/src/part/sprite.rs b/crates/content/src/part/sprite.rs index a23a71f..f89596d 100644 --- a/crates/content/src/part/sprite.rs +++ b/crates/content/src/part/sprite.rs @@ -141,13 +141,13 @@ pub(crate) mod syntax { pub fn resolve_as_start( &self, all_sections: &HashMap, - ) -> Result { + ) -> Result { let e = self .resolve_as_edge(all_sections) .with_context(|| format!("while resolving start edge"))?; match e { - super::SectionEdge::Bot { section } => Ok(super::SpriteStart::Bot { section }), - super::SectionEdge::Top { section } => Ok(super::SpriteStart::Top { section }), + super::SectionEdge::Bot { section } => Ok(super::StartEdge::Bot { section }), + super::SectionEdge::Top { section } => Ok(super::StartEdge::Top { section }), _ => { bail!("bad section start specification `{}`", self.val); } @@ -229,7 +229,7 @@ pub enum SectionEdge { /// Where to start an animation #[derive(Debug, Clone)] -pub enum SpriteStart { +pub enum StartEdge { /// Play the given section from the bottm Bot { /// The section to play @@ -253,7 +253,7 @@ pub struct Sprite { pub handle: SpriteHandle, /// Where this sprite starts playing - pub start_at: SpriteStart, + pub start_at: StartEdge, /// This sprite's animation sections sections: Vec, @@ -271,8 +271,8 @@ impl Sprite { /// Get this sprite's first frame pub fn get_first_frame(&self) -> u32 { match self.start_at { - SpriteStart::Bot { section } => *self.get_section(section).frames.last().unwrap(), - SpriteStart::Top { section } => *self.get_section(section).frames.first().unwrap(), + StartEdge::Bot { section } => *self.get_section(section).frames.last().unwrap(), + StartEdge::Top { section } => *self.get_section(section).frames.first().unwrap(), } } @@ -337,7 +337,7 @@ impl crate::Build for Sprite { content.sprites.push(Self { name: sprite_name, - start_at: SpriteStart::Top { + start_at: StartEdge::Top { section: AnimSectionHandle(0), }, sections: vec![SpriteSection { @@ -373,7 +373,7 @@ impl crate::Build for Sprite { content.sprites.push(Self { name: sprite_name, sections, - start_at: SpriteStart::Bot { + start_at: StartEdge::Bot { section: AnimSectionHandle(0), }, handle: h,