Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added pomme-client/assets/gui/title/edition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions pomme-client/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ pub(crate) fn valid_asset_key(asset_key: &str) -> bool {
pub const POMME_ICON_PNG: &[u8] =
include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/icon.png"));

/// The "Rust Edition" banner under the title logo, laid out like the jar's
/// `edition.png`.
pub const POMME_EDITION_PNG: &[u8] = include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/assets/gui/title/edition.png"
));

pub fn load_image(path: &Path) -> Result<image::DynamicImage, image::ImageError> {
image::open(path).or_else(|_| {
let data = std::fs::read(path).map_err(image::ImageError::IoError)?;
Expand Down
19 changes: 11 additions & 8 deletions pomme-client/src/renderer/pipelines/menu_overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3894,24 +3894,27 @@ fn build_sprite_atlas(
}

// `LogoRenderer` blits only the top 44/64 of minecraft.png and 14/16 of
// edition.png. The files are supersampled and packs may use any size, so
// crop by fraction; a row-major prefix is contiguous, so it's a truncate.
for (id, asset_key, logical_h, used_h) in [
// edition.png. Both are supersampled, so crop by fraction; a row-major
// prefix is contiguous, so it's a truncate.
for (id, image, logical_h, used_h) in [
(
SpriteId::MinecraftLogo,
"minecraft/textures/gui/title/minecraft.png",
crate::assets::load_image(&resolve_asset_path(
jar_assets_dir,
asset_index,
"minecraft/textures/gui/title/minecraft.png",
)),
64u32,
44u32,
),
(
SpriteId::MinecraftEdition,
"minecraft/textures/gui/title/edition.png",
image::load_from_memory(crate::assets::POMME_EDITION_PNG),
16,
14,
),
] {
let path = resolve_asset_path(jar_assets_dir, asset_index, asset_key);
match crate::assets::load_image(&path) {
match image {
Ok(img) => {
let rgba = img.to_rgba8();
let (w, h) = (rgba.width(), rgba.height());
Expand All @@ -3921,7 +3924,7 @@ fn build_sprite_atlas(
images.push((id, raw, w, used, 0.0));
}
Err(e) => {
tracing::warn!("Failed to load title sprite {asset_key}: {e}");
tracing::warn!("Failed to load title sprite {id:?}: {e}");
images.push((id, vec![255, 0, 255, 255], 1, 1, 0.0));
}
}
Expand Down
Loading