Skip to content

Commit

Permalink
include textureFileName, realTextureFileName and size in plist metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
cgytrus committed Sep 10, 2023
1 parent 09968da commit 5c39096
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/util/spritesheet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use image::{imageops, ImageFormat, RgbaImage};
use serde_json::json;
use texture_packer::exporter::ImageExporter;
use texture_packer::{TexturePacker, TexturePackerConfig};
use texture_packer::texture::Texture;

use crate::cache::CacheBundle;
use crate::rgba4444::RGBA4444;
Expand Down Expand Up @@ -166,11 +167,17 @@ fn initialize_spritesheet_bundle(
// Using BTreeMap to make sure all packings for the same input produce
// identical output via sorted keys

let texture_file_name = mod_info.id.to_owned()
+ "/" + bundle.png.file_name().unwrap().to_str().unwrap();

// Write plist
let plist_file = json!({
"frames": frame_info,
"metadata": {
"format": 3
"format": 3,
"realTextureFileName": texture_file_name,
"size": format!("{{{},{}}}", texture_packer.width(), texture_packer.height()),
"textureFileName": texture_file_name
}
});

Expand Down

0 comments on commit 5c39096

Please sign in to comment.