Skip to content

Instantly share code, notes, and snippets.

@kneeko
Created September 14, 2016 05:35
Show Gist options
  • Save kneeko/fae01f0341d5dfd6f54cd2e8c5080adb to your computer and use it in GitHub Desktop.
Save kneeko/fae01f0341d5dfd6f54cd2e8c5080adb to your computer and use it in GitHub Desktop.
LÖVE exporter for TexturePacker
local quads = {}
{% for sprite in allSprites %}quads['{{ sprite.fullName }}'] = love.graphics.newQuad({{ sprite.frameRect.x }}, {{ sprite.frameRect.y }},{{ sprite.frameRect.width }}, {{ sprite.frameRect.height }},{{ texture.size.width }}, {{ texture.size.height }})
{% endfor %}
return quads
<exporter version="1.0">
<!-- identifier of the exporter -->
<name>atlas</name>
<!-- display name of the exporter for the combo box -->
<displayName>LÖVE</displayName>
<!-- description of the exporter -->
<description>Exporter for LÖVE using Quads.</description>
<!-- exporter version -->
<version>1.0</version>
<!-- currently only one file allowed - more to come with update -->
<files>
<file>
<!-- name of this file variable -->
<name>lua</name>
<!-- human readable name (for GUI) -->
<displayName>LÖVE lua file</displayName>
<!-- file extension for the file -->
<fileExtension>lua</fileExtension>
<!-- description what the file contains, used in tooltips in the GUI -->
<description>Lua file for LÖVE</description>
<!-- name of the template file -->
<template>atlas.lua</template>
</file>
</files>
<!-- target framework supports trimming -->
<supportsTrimming>true</supportsTrimming>
<!-- target framework supports rotated sprites -->
<supportsRotation>false</supportsRotation>
<!-- rotated sprites direction (cw/ccw) -->
<rotationDirection>cw</rotationDirection>
<!-- supports npot sizes -->
<supportsNPOT>true</supportsNPOT>
<!-- supports file name stripping (remove .png etc) -->
<supportsTrimSpriteNames>yes</supportsTrimSpriteNames>
<!-- supports texure subpath -->
<supportsTextureSubPath>yes</supportsTextureSubPath>
</exporter>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment