Create a folder in any place convenient for you. Then open a terminal inside it and run the command:
npm install @daniil_sv/xcoder -g
After the first launch, you will go through a small configuration process during which working folders will be created.
Run command:
xcoder
After that you will see options menu
This version has some changes compared to "original" python one. The main goal is to provide maximum flexibility by removing dumb restrictions.. Because of this, here all information about textures is contained in readable json and not in binary .xcod files. Json is composed of a list of textures that can be changed or added to. Below is a table with a description of each parameter of such a texture. Each parameter can be optional
- All descriptions are taken from "supercell-swf
Name | Type | Description | Possible values |
---|---|---|---|
pixelFormat | string OR number | Texture pixel type | GL_RGBA8, GL_RGBA4, GL_RGB5_A1, GL_RGB565, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE8 or index of these values |
linear | boolean | If enabled, writes a pixel linearly. Otherwise, it uses a special pixel blocking system. | true, false |
downscaling | boolean | Allows you to use mipmaps on texture. | true, false |
magFilter | string OR number | Mag filter | GL_LINEAR, GL_NEAREST, GL_LINEAR_MIPMAP_NEAREST or index of these values |
minFilter | string OR number | Min filter | GL_LINEAR, GL_NEAREST, GL_LINEAR_MIPMAP_NEAREST or index of these values |
width | number | Texture width. If it does not match the size of the actual texture, it will be prompted to change it or ignore it. | Any positive number to 8096 |
height | number | Texture height. If it does not match the size of the actual texture, it will be prompted to change it or ignore it. | Any positive number to 8096 |
To decode sc to png you need to copy your files to Sc-Textures/In-SC-Textures/
and run the operation in XCoder, after that get folders with output in Sc-Textures/Out-Textures/
.
Folders contain textures and a "json" file with information about them.
To decode file, run following command:
sc2tex
Command arguments:
-i, --input : Required parameter. Path to folder with files or path to file. If a folder is specified and no output is specified, creates a new folder with "_textures" prefix that will contain processed files.
-o, --output : Optional parameter. Name of output folder.
Examples:
sc2tex -i sc/ui_highres_tex.sc -o sc/ui_textures
OR
sc2tex -i sc/
output will automatically be "sc_textures/".
You have 2 ways:
- "Decode" and modify existing files and add them to
Sc-Textures/In-Textures/
. - You can create textures from scratch. Create a folder in
Sc-Textures/In-Textures/
with name of texture and put png there. Json file is optional.
After that, you can get files in Sc-Textures/Out-SC-Textures/
.
To encode textures, run following command:
tex2sc
Command arguments:
-i, --input : Required parameter. Path to folder with .png textures.
-o, --output : Optional parameter. Name of output folder.
Example:
tex2sc -i ui_highres_tex -o ui_highres_tex.sc
There are also changes here. In Python version, compressor could only decompress csv files. This one supports compression of all files. Be careful if you want to compress or decompress a .sc file, make sure its name ends in ".sc".
Place your files in Compressing/In-Compressed-files/
, start decompression operation and take files in Compressing/Out-files
.
To decompress file, run following command:
sc-decompress
Command arguments:
-i, --input : Required parameter. Path to folder with files or path to file. If a folder is specified and no output is specified, creates a new folder with "_decompressed" prefix that will contain processed files.
-o, --output : Optional parameter. Name of output file. If not specified and if input is a file then it will be overwritten.
Examples:
sc-decompress -i sc/ui.sc -o sc/ui_decompressed.sc
OR
sc-decompress -i sc/
output will automatically be "sc_decompressed/".
Place your files in Compressing/In-files/
, start compression operation and take files in Compressing/Out-compressed-files/
.
Uses compression method currently selected in XCoder.
To compress file, run following command:
sc-compress
Command arguments:
-i, --input : Required parameter. Path to folder with files or path to file. If a folder is specified and no output is specified, creates a new folder with "_compressed" prefix that will contain processed files.
-o, --output : Optional parameter. Name of output file. If not specified and if input is a file then it will be overwritten.
Examples:
sc-compress -i sc/ui_decompressed.sc -o sc/ui.sc
OR
sc-decompress -i sc/
output will automatically be "sc_compressed/".
- @Daniil-SV - All code
- @Vorono4ka & @MasterDevX - Сode for console and general concept
- Sprite decoding feature
- Decoding to JSON