Extract variable for output_variable_name

This commit is contained in:
Gwilym Kuiper 2021-07-21 21:01:24 +01:00
parent 53952d8e34
commit 47c5c0f86e
2 changed files with 3 additions and 1 deletions

View file

@ -57,6 +57,7 @@ pub fn convert_image(settings: ImageConverterConfig) {
rust_generator::generate_code( rust_generator::generate_code(
&mut writer, &mut writer,
"test",
&optimisation_results, &optimisation_results,
&image, &image,
settings.tile_size, settings.tile_size,

View file

@ -7,13 +7,14 @@ use crate::TileSize;
pub(crate) fn generate_code( pub(crate) fn generate_code(
output: &mut dyn Write, output: &mut dyn Write,
output_variable_name: &str,
results: &Palette16OptimisationResults, results: &Palette16OptimisationResults,
image: &Image, image: &Image,
tile_size: TileSize, tile_size: TileSize,
crate_prefix: String, crate_prefix: String,
) -> io::Result<()> { ) -> io::Result<()> {
writeln!(output, "#[allow(non_upper_case_globals)]")?; writeln!(output, "#[allow(non_upper_case_globals)]")?;
writeln!(output, "pub const {}: {}::display::tile_data::TileData = {{", "test", crate_prefix)?; writeln!(output, "pub const {}: {}::display::tile_data::TileData = {{", output_variable_name, crate_prefix)?;
writeln!( writeln!(
output, output,