From c82e19470c64725658698f00680033f68c64a509 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Thu, 3 Oct 2019 16:37:47 -0400 Subject: [PATCH] assets.py: output a full JS file that can be sourced directly --- scripts/assets.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/assets.py b/scripts/assets.py index d163bd2..9b30224 100644 --- a/scripts/assets.py +++ b/scripts/assets.py @@ -304,10 +304,12 @@ def stitch_sprites(metadata, filename_base): image_filename = os.path.expanduser(filename_base) + '.png' print('saving image to', image_filename) pygame.image.save(output, image_filename) - json_filename = os.path.expanduser(filename_base) + '.json' + json_filename = os.path.expanduser(filename_base) + '.js' print('saving json to', json_filename) with open(json_filename, 'w') as json_file: + json_file.write(' const spritesheet_json = ') json.dump(output_json, json_file, sort_keys=True, indent=2) + json_file.write(';') def main(args):