Code Monkey home page Code Monkey logo

cocos2dx-sprite-stitcher's Introduction

Cocos2dx-Sprite-Stitcher

https://www.youtube.com/watch?v=kc1TuY8kIj0

##Dependencies: Imagemagick, bash, etc1tool from android sdk

##Command line tools:

  1. png2etc1 converts PNG files to ETC1 format compressed (PKM) files
  2. png2stitch will convert a large png (greater than 1024x1024px) to a set of tiles, to be passed into SpriteStitcher Cocos2dx class.
  3. png2etc1_a converts PNG files to ETC1 format but with their alpha channel encoded into a seperate file.
  4. png2stitch_a will convert a large png into tiles, but each tile has its own alpha map

##Command line tool usage:

  1. png2etc1 file1.png file2.png file3.png ... outputs a .pkm for every infile
  2. png2etc1_a file1.png file2.png file3.png ... outputs a .pkm & _alpha.pkm for every infile
  3. png2stitch image_name.png outputs folder image_name, containing a number of .pkm tiles <= 1024x1024 depending on image size
  4. png2stitch_a image_name.png same as png_stitch but each tile also comes with an alpha map

##Download Cocos2d-x project files:

  1. shaders/ folder, place this in your Cocos2d-x project's Resources/ directory
  2. SpriteStitch.cpp and SpriteStitch.h, use this class inside your Cocos2d-x project to obtain a SpriteStitch node
  3. To add a class this class into your Windows or Linux build, edit CMakeLists.txt at the root of your project directory to add the files, then run cmake -G "Unix Makefiles" (or appropriate generator-name) in your proj.linux/ or proj.win32/ folder

##SpriteStitch class usage:

  1. Initialize a SpriteStitch object from the output of png2stitch: node = SpriteStitch::createFromFolder("level1", true); First argument is the folder outputted from png2stitch, second argument is if it has an alpha mask, true/false

  2. Create ETC1 compressed sprite with alpha: sprite = SpriteStitch::createETCASprite("Sprite.pkm", "Sprite_alpha.pkm"); First argument is the sprite's pkm image file, the second is the sprite's alpha mask (created with png2etc_a)

cocos2dx-sprite-stitcher's People

Contributors

krogank9 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.