An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

[![GitHub last commit](https://img.shields.io/github/last-commit/timothymtorres/simple-image-textures.svg)](https://github.com/timothymtorres/Simple-Image-Textures/commits/master)
[![GitHub](https://img.shields.io/github/license/timothymtorres/simple-image-textures.svg)](https://github.com/timothymtorres/Simple-Image-Textures/blob/master/LICENSE.txt)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/timothymtorres/simple-image-textures.svg)](http://isitmaintained.com/project/timothymtorres/simple-image-textures "Average time to resolve an issue")

![Texturepacker Image](https://www.codeandweb.com/o/img/texturepacker512-512.png)

# 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.