Configuration (pxl.toml)

Project configuration file for Pixelsrc builds and exports.

Overview

Create a pxl.toml file in your project root to configure the build system. The only required field is project.name.

[project]
name = "my-game"

Full Example

[project]
name = "my-game"
version = "1.0.0"
src = "assets/pxl"
out = "dist"

[defaults]
scale = 2
padding = 4

[atlases.characters]
sources = ["sprites/player/**", "sprites/enemies/**"]
max_size = [2048, 2048]
padding = 2
power_of_two = true

[atlases.ui]
sources = ["sprites/ui/**"]
max_size = [1024, 1024]
nine_slice = true

[animations]
sources = ["anims/**"]
preview = true
preview_scale = 4
sheet_layout = "vertical"

[export.generic]
enabled = true
atlas_format = "json"

[export.godot]
enabled = true
resource_path = "res://sprites"
animation_player = true
sprite_frames = true

[export.unity]
enabled = true
pixels_per_unit = 32
filter_mode = "point"

[export.libgdx]
enabled = true

[validate]
strict = true
unused_palettes = "warn"
missing_refs = "error"

[watch]
debounce_ms = 200
clear_screen = false

Sections

[project]

Project metadata and directory configuration.

FieldTypeDefaultDescription
namestringrequiredProject name
versionstring"0.1.0"Project version
srcpath"src/pxl"Source directory for .pxl files
outpath"build"Output directory for rendered assets
[project]
name = "my-game"
version = "1.0.0"
src = "assets/sprites"
out = "dist/sprites"

[defaults]

Default settings applied to all outputs unless overridden.

FieldTypeDefaultDescription
scaleinteger1Default scale factor for rendering
paddinginteger1Default padding between sprites in atlases
[defaults]
scale = 2
padding = 4

[atlases.<name>]

Define named atlas configurations. Multiple atlases can be defined.

FieldTypeDefaultDescription
sourcesarrayrequiredGlob patterns for sprite sources
max_size[w, h][1024, 1024]Maximum atlas dimensions
paddingintegerfrom defaultsPadding between sprites
power_of_twobooleanfalseConstrain to power-of-two dimensions
nine_slicebooleanfalsePreserve nine-slice metadata
[atlases.characters]
sources = ["sprites/player/**", "sprites/enemies/**"]
max_size = [2048, 2048]
padding = 2
power_of_two = true

[atlases.ui]
sources = ["sprites/ui/**"]
max_size = [1024, 1024]
nine_slice = true

[animations]

Animation output configuration.

FieldTypeDefaultDescription
sourcesarray["animations/**"]Glob patterns for animation files
previewbooleanfalseGenerate preview GIFs
preview_scaleinteger1Scale factor for previews
sheet_layoutstring"horizontal"Layout: horizontal, vertical, or grid
[animations]
sources = ["anims/**", "characters/*/walk.pxl"]
preview = true
preview_scale = 4
sheet_layout = "vertical"

[export.generic]

Generic JSON export configuration.

FieldTypeDefaultDescription
enabledbooleantrueEnable generic JSON export
atlas_formatstring"json"Output format identifier
[export.generic]
enabled = true
atlas_format = "json"

[export.godot]

Godot game engine export configuration.

FieldTypeDefaultDescription
enabledbooleanfalseEnable Godot export
atlas_formatstring"godot"Output format identifier
resource_pathstring"res://assets/sprites"Godot resource path prefix
animation_playerbooleantrueGenerate AnimationPlayer resources
sprite_framesbooleantrueGenerate SpriteFrames resources
[export.godot]
enabled = true
resource_path = "res://sprites"
animation_player = true
sprite_frames = true

Generated files:

  • .tres resource files for atlases
  • AnimationPlayer resources for animations
  • SpriteFrames resources for animated sprites

[export.unity]

Unity game engine export configuration.

FieldTypeDefaultDescription
enabledbooleanfalseEnable Unity export
atlas_formatstring"unity"Output format identifier
pixels_per_unitinteger16Pixels per Unity unit
filter_modestring"point"Texture filter: point or bilinear
[export.unity]
enabled = true
pixels_per_unit = 32
filter_mode = "point"

Generated files:

  • .asset meta files for sprites
  • Sprite slicing data for atlases
  • Animation clips for animated sprites

[export.libgdx]

libGDX game framework export configuration.

FieldTypeDefaultDescription
enabledbooleanfalseEnable libGDX export
atlas_formatstring"libgdx"Output format identifier
[export.libgdx]
enabled = true

Generated files:

  • .atlas files in libGDX TexturePacker format
  • Region definitions for sprite lookup

[validate]

Validation settings for the build process.

FieldTypeDefaultDescription
strictbooleanfalseTreat warnings as errors
unused_paletteslevel"warn"How to handle unused palettes
missing_refslevel"error"How to handle missing references

Validation levels: error, warn, ignore

[validate]
strict = true
unused_palettes = "error"
missing_refs = "warn"

[watch]

Watch mode configuration.

FieldTypeDefaultDescription
debounce_msinteger100Debounce delay in milliseconds
clear_screenbooleantrueClear terminal between rebuilds
[watch]
debounce_ms = 200
clear_screen = false

Minimal Configuration

The simplest valid configuration:

[project]
name = "my-project"

This uses all default values:

  • Source: src/pxl/
  • Output: build/
  • Scale: 1
  • No exports enabled (except generic JSON)

Environment Variables

Some settings can be overridden via environment variables or command-line flags:

SettingCLI FlagEnvironment Variable
Source directory--src-
Output directory--out or -o-
Verbose output--verbose or -v-

Validation

The configuration is validated on load. Common validation errors:

ErrorCause
project.name must be non-emptyMissing or empty project name
defaults.scale must be positiveScale set to 0
atlases.\<name\>.sources must contain at least one glob patternEmpty sources array
atlases.\<name\>.max_size dimensions must be positiveZero dimension in max_size
export.unity.pixels_per_unit must be positiveZero pixels_per_unit with Unity enabled