(loadFrom "nat-archive-tool" "src/nat/Lib.kiss") // Named entries without Images should be given an image generated with the name's text (defNew [] (super ->[archive e] ?(and !(hasComponent e Images) (hasComponent e Name)) ->[archive e] { (let [name (readComponent e Name) sprite (new FlxText 0 0 0 name 16) bitmapData sprite.pixels // Source: https://gist.github.com/miltoncandelero/0c452f832fa924bfdd60fe9d507bc581 &mut bytes (new ByteArray)] (set bytes (bitmapData.encode bitmapData.rect (new PNGEncoderOptions true) bytes)) (let [path (joinPath archive.archiveDir "files" "textImage${name}.png")] (File.saveBytes path bytes) (archive.addFiles e [path]))) }))