clarify usage

pull/2/head
cosmonaut 2022-07-25 11:53:35 -07:00
parent 7c5b5a8aac
commit e9452a7aef
2 changed files with 8 additions and 4 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.12)
project(Cram C)
option(BUILD_CLI "Build command line executable" ON)
option(BUILD_SHARED_LIBS "Build shared library" ON)
option(BUILD_SHARED_LIBS "Build shared library" OFF)
SET(LIB_MAJOR_VERSION "0")
SET(LIB_MINOR_VERSION "3")

View File

@ -8,13 +8,13 @@ Cram uses the maximal rectangles algorithm with the best area fit heuristic to p
Cram ships with a default command line interface implemented in C, but if you wish you can configure CMake to build a shared library which will allow you to bind its essential functions to another language.
Usage
Command Line Usage
-----
```sh
Usage: cram input_dir output_dir atlas_name [--padding padding_value] [--notrim] [--dimension max_dimension]
Usage: cramcli input_dir output_dir atlas_name [--padding padding_value] [--notrim] [--dimension max_dimension]
```
Cram expects input in PNG and outputs a PNG and a JSON metadata file that you can use to properly display the images in your game. Cram will recursively walk all the subdirectories of `input_dir` to generate your texture atlas.
Cram CLI expects input images to be in PNG format and will output a PNG and a JSON metadata file that you can use to properly display the images in your game. Cram will recursively walk all the subdirectories of `input_dir` to generate your texture atlas.
Padding is set to 0 by default. If you need to use linear filtering, set padding to at least 1. If you need to use texture compression, set padding to at least 4.
@ -22,6 +22,10 @@ Trimming is on by default. Use `--notrim` if for some weird reason you want it o
Max dimension value is set to 8192 by default since that is a common max texture size for basically every GPU out there. Use `--dimension [max_dimension]` to override this maximum.
API Usage
---------
If you would rather use Cram to build your own tool, you must configure CMake with BUILD_SHARED_LIBS set to ON so the library can be called. You can also set BUILD_CLI to OFF. See `cram.h` for the API; basically you are going to initialize the packing context, add the image files you want to pack, and call the pack function. Then you can get the pixel and packed image metadata. The pixel data is just RGBA32 colors - you are responsible for how you wish to write the pixel data to a file, and also for how you wish to serialize and deserialize the packer metadata. Make sure to call `Cram_Destroy` once you are done to free the native memory allocations.
Dependencies
------------
Cram depends on the C runtime.