iffy: A spritesheet helper library

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
YoungNeer
Party member
Posts: 118
Joined: Wed May 15, 2019 7:49 am

iffy: A spritesheet helper library

Post by YoungNeer » Tue Dec 03, 2019 8:00 am

Have you ever used Kenney's assets? Then you may know that all of Kenney's assets are "game-ready". Meaning you don't have to tweak anything or do some extra work to load those assets.
Every spritesheet of Kenney - unless it's a tileset or has animations in it - has an XML file by the same name.

Let me give you context. Here's a spritesheet made by Kenney (on left is the image 'diceRed.png' and on right is the metafile diceRed.xml)
spritesheetXML.png
spritesheetXML.png (32.36 KiB) Viewed 3753 times
How would you go about this? Well with iffy you'd do something like this:-

Code: Select all

iffy=require 'iffy'

iffy.newSpriteSheet("diceRed.png")

function love.draw()
	iffy.drawSprite('diceRed6.png')
end
and that'd draw the 6-faced die on the screen at (0,0)!

Github Link
Attachments
iffyDemo2.love
(8.02 KiB) Downloaded 126 times
iffyDemo1.love
(132.48 KiB) Downloaded 131 times
My Github- your contribution is highly appreciated

monolifed
Party member
Posts: 140
Joined: Sat Feb 06, 2016 9:42 pm

Re: iffy: A spritesheet helper library

Post by monolifed » Tue Dec 03, 2019 5:14 pm

Here something I used while working with Kenney's sprite sheets. It converts the specific xml format to a lua table

User avatar
YoungNeer
Party member
Posts: 118
Joined: Wed May 15, 2019 7:49 am

Re: iffy: A spritesheet helper library

Post by YoungNeer » Wed Dec 04, 2019 4:27 am

ingsoc451 wrote:
Tue Dec 03, 2019 5:14 pm
Here something I used while working with Kenney's sprite sheets. It converts the specific xml format to a lua table
Iffy too converts that specific xml format to lua table - it returns all the quads in a neat hashtable format! But you don't need to store that to any table since iffy stores a cache and you can draw a sprite using iffy.drawSprite or be more specific with iffy.draw
My Github- your contribution is highly appreciated

monolifed
Party member
Posts: 140
Joined: Sat Feb 06, 2016 9:42 pm

Re: iffy: A spritesheet helper library

Post by monolifed » Wed Dec 04, 2019 9:42 am

You only need to convert it one time. It looks like it converts it everytime

User avatar
YoungNeer
Party member
Posts: 118
Joined: Wed May 15, 2019 7:49 am

Re: iffy: A spritesheet helper library

Post by YoungNeer » Wed Dec 04, 2019 12:07 pm

ingsoc451 wrote:
Wed Dec 04, 2019 9:42 am
You only need to convert it one time. It looks like it converts it everytime
It doesn't!! It may look like it cause "it is looking for cache" when there is no cache to speeden up the process of acessing things - especially for drawSprite function!
My Github- your contribution is highly appreciated

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests