Skip to content

ilyagolota/Zwoptex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Library for packing sprite sheets.

Zwoptex is a ruby library to pack images into sprite sheets. It requires ChunkyPNG and Plist gems.

Usage

images = {
  'fiskemel.png' => ChunkyPNG::Image.from_file('images/fiskemel.png'),
  'kridt.png' => ChunkyPNG::Image.from_file('images/kridt.png'),
  'skalle.png' => ChunkyPNG::Image.from_file('images/skalle.png')
}

# creating an atlas
atlas = Zwoptex::Atlas.new(1024, 1024, images)

# arrange images using tree algorithm
atlas.pack_using_tree! :spacing => 2

# save coords data
plist_content = atlas.format_cocos2d_plist(:texture_filename => 'atlas.png')
File.write 'atlas.plist', plist_content

# save image
image = atlas.render_image
image.save 'atlas.png', :compression => Zlib::BEST_COMPRESSION

About

Ruby library for automating atlas creation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages