assets.py: output a full JS file that can be sourced directly
This commit is contained in:
parent
ac3216f41f
commit
c82e19470c
@ -304,10 +304,12 @@ def stitch_sprites(metadata, filename_base):
|
|||||||
image_filename = os.path.expanduser(filename_base) + '.png'
|
image_filename = os.path.expanduser(filename_base) + '.png'
|
||||||
print('saving image to', image_filename)
|
print('saving image to', image_filename)
|
||||||
pygame.image.save(output, 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)
|
print('saving json to', json_filename)
|
||||||
with open(json_filename, 'w') as json_file:
|
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.dump(output_json, json_file, sort_keys=True, indent=2)
|
||||||
|
json_file.write(';')
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
|
Loading…
Reference in New Issue
Block a user