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: 115
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 340 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 15 times
iffyDemo1.love
(132.48 KiB) Downloaded 16 times
My Github- your contribution is highly appreciated

User avatar
ingsoc451
Citizen
Posts: 96
Joined: Sat Feb 06, 2016 9:42 pm
Location: Oceania

Re: iffy: A spritesheet helper library

Post by ingsoc451 » 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
Attachments
convert_sheet.lua
(2.02 KiB) Downloaded 11 times
eom

User avatar
YoungNeer
Party member
Posts: 115
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

User avatar
ingsoc451
Citizen
Posts: 96
Joined: Sat Feb 06, 2016 9:42 pm
Location: Oceania

Re: iffy: A spritesheet helper library

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

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

User avatar
YoungNeer
Party member
Posts: 115
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 5 guests