Skip to content

Commit

Permalink
ImageToSprite progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldom-SE committed Dec 13, 2024
1 parent 9872fbe commit 0790c23
Show file tree
Hide file tree
Showing 3 changed files with 288 additions and 182 deletions.
7 changes: 3 additions & 4 deletions src/palette.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl AssetLoader for PaletteLoader {

/// A palette. Palettes are loaded from images containing pixels
/// that represent what colors the game may display. You may use up to 255 colors.
/// The bottom-left pixel in the palette is used as the background color.
/// The top-left pixel in the palette is used as the background color.
#[derive(Asset, Clone, TypePath, Debug)]
pub struct Palette {
pub(crate) size: UVec2,
Expand All @@ -89,7 +89,7 @@ type LoadingAssetPaletteParam<'w> = AssetSingleton<'w, LoadingAssetPaletteHandle
impl Palette {
/// Create a palette from an [`Image`]
pub fn new(palette: &Image) -> Palette {
let colors = palette
let (colors, _, _) = palette
.convert(TextureFormat::Rgba8UnormSrgb)
.unwrap()
.data
Expand All @@ -109,8 +109,7 @@ impl Palette {
(colors, color, i + 1)
}
},
)
.0;
);

Palette {
size: UVec2::new(
Expand Down
Loading

0 comments on commit 0790c23

Please sign in to comment.