From 6f10fa74f93e101ed02ae55db8dd17e92f99eb6e Mon Sep 17 00:00:00 2001 From: ne0ndrag0n Date: Sat, 13 Feb 2021 22:24:58 -0500 Subject: [PATCH] output palette --- src/reskit/tileset.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/reskit/tileset.rs b/src/reskit/tileset.rs index 3ce7d5f..2ec1624 100644 --- a/src/reskit/tileset.rs +++ b/src/reskit/tileset.rs @@ -68,8 +68,17 @@ pub fn generate( image_filename: &str, output_filename: &str ) { } } + let mut output_palette: Vec< u8 > = Vec::new(); + for i in 0..palette.len() { + let bytes = palette[ i ].to_be_bytes(); + for i in 0..4 { + output_palette.push( bytes[ i ] ); + } + } + let output_try = File::create( output_filename ); if let Ok( mut output_file ) = output_try { + output_file.write( &output_palette ).unwrap(); output_file.write( &body ).unwrap(); utility::print_good( format!( "converted file {}", image_filename ).as_str() ); } else {