Texture Packer for Game Development Using MaxRects Algorithm

Overview

Overview Build Status Build status

Texture Packer for Game Development Using MaxRects Algorithm.

Note: The game assets used in this example were download from Grassland Tileset, thanks Clint Bellanger for made so many awesome game resources.

Contributing

Don't hesitate to make a pull request. All kinds of contribution are welcome.
Note: Please follow the coding style of the existed codes.

Building(Linux/OSX)

$ cd ./src
$ make

Building(Windows)

$ cd .\src
$ nmake -f Makefile.mak

Usage

usage: squeezerw [options] <sprite image dir>
    options:
        --width <output width>
        --height <output height>
        --allowRotations <1/0/true/false/yes/no>
        --border <1/0/true/false/yes/no>
        --outputTexture <output texture filename>
        --outputInfo <output sprite info filename>
        --infoHeader <output header template>
        --infoBody <output body template>
        --infoSplit <output body split template>
        --infoFooter <output footer template>
        --verbose
        --version
    format specifiers of infoHeader/infoBody/infoFooter:
        %W: output width
        %H: output height
        %n: image name
        %w: image width
        %h: image height
        %x: left on output image
        %y: top on output image
        %l: trim offset left
        %t: trim offset top
        %c: original width
        %r: original height
        %f: 1 if rotated else 0
        and '\n', '\r', '\t'

Example

$ cd ./src
$ make

$ ./squeezerw ../example/images --verbose --width 512 --height 256 --border 1 --outputTexture ../example/squeezer.png --outputInfo ../example/squeezer.xml

$ ./squeezerw ../example/images --verbose --width 512 --height 256 --border 1 --outputTexture ../example/squeezer.png --outputInfo ../example/squeezer.json --infoHeader "{\"textureWidth\":\"%W\", \"textureHeight\":\"%H\", \"items\":[\n" --infoFooter "]}" --infoBody "{\"name\":\"%n\", \"width\":\"%w\", \"height\":\"%h\", \"left\":\"%x\", \"top\":\"%y\", \"rotated\":\"%f\", \"trimOffsetLeft\":\"%l\", \"trimOffsetTop\":\"%t\", \"originWidth\":\"%c\", \"originHeight\":\"%r\"}" --infoSplit "\n,"

Licensing

Licensed under the MIT license except lodepng.c and lodepng.h.

Note: lodepng used in this project to decode and encode png format. For the license used in lodepng please visit lodepng directly.

References

  1. http://www.blackpawn.com/texts/lightmaps/
  2. http://clb.demon.fi/projects/more-rectangle-bin-packing
  3. http://wiki.unity3d.com/index.php?title=MaxRectsBinPack
  4. https://github.com/juj/RectangleBinPack
  5. http://opengameart.org/content/flare-weapon-icons-2
You might also like...
Scrollytroller is a crank-based USB controller, initially inteneded for use with Playdate's Pulp web-based game development tool
Scrollytroller is a crank-based USB controller, initially inteneded for use with Playdate's Pulp web-based game development tool

Scrollytroller Scrollytroller is a crank-based USB controller, initially inteneded for use with Playdate's Pulp web-based game development tool. This

Building game development ecosystem for @ziglang!
Building game development ecosystem for @ziglang!

If you are new to low-level graphics programming or you would like to learn about some zig-gamedev libraries I recommend starting with intro applicati

a minimal C++, SDL2, OpenGL abstraction for general game and application development

hept the hept abstraction is a minimal lightweight layer above C++ and SDL dependencies: - SDL2 - C++17 or above - GLM example use: #include "hept.h"

Solves a given NxN wordsearch in under 0.3 seconds at most using Rabin-Karp string algorithm.

ASSIGNMENT 2 The Information of the Creator: ASSIGNMENT 2 Author: Lukas Waschuk CCID: lwaschuk Date: 03-20-2021 The Purpose of Your Program: This prog

Daily challenge on algorithm, using different languages.

👨‍💻 DailyChallenges Content General Information Setup Usage Languages Enhancements 📢 General Information These Daily challenges are aimed at growin

Implementation of Linking Loader Algorithm using CPP.

Linking Loader Implementation in CPP Instructions for executing the file First run the Linking_Loader_PASS1.cpp file using the cmd - g++ Linking_Load

Sorting Algorithm Visualiser using C and CSFML. Helps to visualise how different sorts works.
Sorting Algorithm Visualiser using C and CSFML. Helps to visualise how different sorts works.

Project Name: Sorting Algorithm Visualizer About Project: This is a Sorting Algorithm Visualizer implemented using C programming language with GUI. It

Game Boy and Game Boy Color Emulator

SkyBoy A simple game boy emulator written to keep my skills sharp. The majority of the code was written in a 7 day sprint. It supports most common Gam

In this project ı'am trying to implement dijkstra algorithm with adjacency list representation.

AirportCheapestPath In this project, I have tried to make a flight advisor program to the 3rd party users. To do that, This program gets the data of a

Owner
Jeremy HU
Computer programmer, working on a 3D modeling software as my side project: https://github.com/huxingyi/dust3d
Jeremy HU
Sprite sheet packer

SpriteSheet Packer Sprite sheet generator base on Qt created by Aleksey Makaseev. Features Support multiple screen resolutions Pack multiple sprite sh

null 291 Dec 26, 2022
Simple font renderer library written in Opengl 3.3 using stb_truetype.h to load a packed bitmap into texture of a .ttf font.

mv_easy_font Simple font renderer library written in Opengl 3.3 using stb_truetype.h to load a packed bitmap into texture of a .ttf font. Uses instanc

null 27 May 13, 2022
Stack-based texture generation tool written in C99!

Stack-based texture generation tool written in C99! Brought to you by @zaklaus and contributors Introduction zpl.texed is a cross-platform stack-based

zpl | pushing the boundaries of simplicity. 20 Dec 20, 2022
Fast single source file BC7/BPTC texture encoder with perceptual metric support

Note: Since this repo was created, we've released two new codecs with better BC7 encoders: https://github.com/richgel999/bc7enc_rdo https://github.com

Rich Geldreich 144 Nov 23, 2022
Builds atlas texture from a bunch of input images.

Atlasc @septag atlasc is a command-line program that builds atlas texture from a bunch of input images. Main Features Cross-platform. Runs on linux/ma

Sepehr Taghdisian 74 Aug 30, 2022
Basis Universal GPU Texture Codec

basis_universal Basis Universal Supercompressed GPU Texture Codec Basis Universal is a "supercompressed" GPU texture data interchange system that supp

null 2.3k Dec 28, 2022
Single source file ASTC texture decompression in C++ (derived from Google's open source Android project)

astc_dec astc_dec is a single source file ASTC texture decompressor with the Apache 2.0 license, derived from Google's open source Android sources. Th

Rich Geldreich 29 Dec 5, 2022
An efficient texture-free GLSL procedural noise library

Wombat An efficient texture-free GLSL procedural noise library Source: https://github.com/BrianSharpe/Wombat Derived from: https://github.com/BrianSha

Brian Sharpe 200 Dec 18, 2022
Kit: a magical, high performance programming language, designed for game development

Kit: a magical, high performance programming language, designed for game development

Kit Programming Language 988 Dec 10, 2022