TexturePacker Custom Exporter

A place to post your custom classes and engine extensions to share with the community.

TexturePacker Custom Exporter

Postby Sandstedt » Fri Jan 13, 2017 9:30 am

I recently created a custom exporter for TexturePacker (requires the full license) for the Isogenic Game Engine.
(Guide how to make one here: https://www.codeandweb.com/texturepacker/documentation#custom-exporter-template-file)

Place these files in a folder named isogenic in your custom exporter folder (Set this in TexturePackers's Preferences > Exporter Directory).

exporter.xml
Code: Select all
<exporter version="1.0">

    <name>IGE</name>
    <nameAlias>IGEexporter</nameAlias>
    <displayName>IGE</displayName>
    <description>Isogenic Game Engine exporter for TexturePacker</description>
    <version>1.0</version>
   
    <files>
        <file>
            <name>datafile</name>
            <displayName>MyDataFile</displayName>
            <fileExtension>js</fileExtension>
            <description>IGE js custom exporter for TexturePacker</description>
            <template>isogenic.js</template>
            <optional>false</optional>
            <hasSeparateAutoSDFiles>all</hasSeparateAutoSDFiles>
            <hasSeparateMultiPackFiles>true</hasSeparateMultiPackFiles>
        </file>
    </files>

    <supportsTrimming>true</supportsTrimming>
    <supportsRotation>true</supportsRotation>
    <rotationDirection>cw</rotationDirection>
    <supportsNPOT>true</supportsNPOT>
    <supportsPivotPoint>false</supportsPivotPoint>
    <textureSizeFactor>1</textureSizeFactor>

</exporter>


isogenic.js
Code: Select all
// Created with TexturePacker (http://www.codeandweb.com/texturepacker)
// Sprite sheet: {{texture.fullName}} ({{texture.size.width}} x {{texture.size.height}})
// {{smartUpdateKey}}

self.gameTextures.{{texture.trimmedName}} = new IgeSpriteSheet('assets/{{texture.fullName}}', [
   {% for sprite in allSprites %}[{{sprite.frameRect.x}}, {{sprite.frameRect.y}}, {{sprite.frameRect.width}}, {{sprite.frameRect.height}}, "{{sprite.trimmedName}}"]{% if not forloop.last %}, {% endif %}{% endfor %}
]);


This is an example of the generated JavaScript file:
Code: Select all
self.gameTextures.sprite = new IgeSpriteSheet('assets/sprite.png', [
   [1, 1, 177, 427, "sprite-01"], [1, 430, 177, 427, "sprite-02"], [1, 859, 177, 427, "sprite-03"], [1, 1288, 177, 427, "sprite-04"]
]);


Restart texture packer and then you can choose IGE from the Framework export settings.
User avatar
Sandstedt
 
Posts: 15
Joined: Fri Oct 21, 2016 4:17 pm

Re: TexturePacker Custom Exporter

Postby Kurobuta » Tue May 02, 2017 7:40 am

How do I fix ?? help me plz.
Kurobuta
 
Posts: 2
Joined: Tue May 02, 2017 6:02 am

Re: TexturePacker Custom Exporter

Postby Sandstedt » Tue May 02, 2017 3:44 pm

Kurobuta wrote:How do I fix ?? help me plz.

what do you need help with?

Attached the files in 2 zip files so you dont have to copy paste :)
Attachments
isogenic-compressed.zip
TexturePacker Custom Exporter for Isogenic Engine - compressed version
(1.16 KiB) Downloaded 7 times
isogenic.zip
TexturePacker Custom Exporter for Isogenic Engine
(1.07 KiB) Downloaded 7 times
User avatar
Sandstedt
 
Posts: 15
Joined: Fri Oct 21, 2016 4:17 pm


Return to Custom Code

Who is online

Users browsing this forum: No registered users and 1 guest
cron