Minor fix

master
Mark 2024-01-25 22:03:45 -08:00
parent cb68e9d376
commit e6512d83fa
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
1 changed files with 4 additions and 4 deletions

View File

@ -18,14 +18,14 @@ pub struct UiSprite {
impl UiSprite { impl UiSprite {
pub fn from(ct: &Content, ui: &UiSpriteConfig) -> Self { pub fn from(ct: &Content, ui: &UiSpriteConfig) -> Self {
Self::from_with_sprite(ct, ui, ui.sprite.unwrap())
}
pub fn from_with_sprite(ct: &Content, ui: &UiSpriteConfig, sprite: SpriteHandle) -> Self {
if ui.sprite.is_none() { if ui.sprite.is_none() {
unreachable!("called `UiSprite.from()` on a UiSprite with a None sprite!") unreachable!("called `UiSprite.from()` on a UiSprite with a None sprite!")
} }
Self::from_with_sprite(ct, ui, ui.sprite.unwrap())
}
pub fn from_with_sprite(ct: &Content, ui: &UiSpriteConfig, sprite: SpriteHandle) -> Self {
return Self { return Self {
anim: SpriteAutomaton::new(ct, sprite), anim: SpriteAutomaton::new(ct, sprite),
mask: ui.mask, mask: ui.mask,