https://github.com/timothymtorres/simple-image-textures
A library to easily load TexturePacker images into CoronaSDK
https://github.com/timothymtorres/simple-image-textures
Last synced: about 1 year ago
JSON representation
A library to easily load TexturePacker images into CoronaSDK
- Host: GitHub
- URL: https://github.com/timothymtorres/simple-image-textures
- Owner: timothymtorres
- License: mit
- Created: 2019-03-14T13:19:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-14T13:52:48.000Z (over 7 years ago)
- Last Synced: 2025-03-17T13:55:45.609Z (over 1 year ago)
- Language: Lua
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://github.com/timothymtorres/Simple-Image-Textures/commits/master)
[](https://github.com/timothymtorres/Simple-Image-Textures/blob/master/LICENSE.txt)
[](http://isitmaintained.com/project/timothymtorres/simple-image-textures "Average time to resolve an issue")

# Simple Image Textures
*Simple Image Textures* (SIT) is a library used to quickly load image sheets into CoronaSDK with [TexturePacker](https://www.codeandweb.com/texturepacker)(™). Instead of having to manually load each individual image sheet into a project, this library loads them all into a table for easy access. Just point SIT to the directory(s) where the resources are located and it does all the heavy lifting.
I created SIT initially as a added feature for another library called [Berry](https://github.com/ldurniat/Berry). After the feature was added, I decided to also make it into a stand alone tool that other developers (hopefully) might find useful.
### Quick Start Guide
```lua
local SIT = require('simple_image_textures')
SIT.new(directory) -- ie. "graphics/images/stuff"
image = display.newImageRect( SIT.getTexture(texture_name) )
image.x, image.y = 100, 100
```
### SIT.new(directory)
SIT will scan through the given directory and all sub-directories for Texturepacker files and load them. **Both the matching Texturepacker images and lua files provided must have the same name and be in the same directory**.
### SIT.getTexture(name)
This returns an image sheet, frame, width, and height for a texturepack image. Simply pass the name of the image to the method like so: `display.newImageRect( SIT.getTexture('crowbar'))` (assuming image is named crowbar.png) and you will have a quick image to load. No need to deal with multiple image sheets, sizes, or frames.