Sprite Compiler Advanced Features¶
Advanced features and options for the PixelRoot32 Sprite Compiler to optimize sprite conversion and handle complex scenarios.
Automatic Palette Detection¶
The Sprite Compiler automatically detects if your sprite uses one of the engine's built-in palettes. This simplifies your workflow and ensures color consistency.
Predefined Engine Palettes¶
The engine includes 5 optimized palettes: - PR32 (Default PixelRoot32 palette) - NES (Nintendo style) - GB (GameBoy style) - GBC (GameBoy Color style) - PICO8 (Fantasy console style)
How it works¶
- Detection: When you compile an image, the tool compares all unique colors found in the sprite with the colors in the 5 engine palettes.
- Match: If all colors in your sprite belong to one of these palettes, the compiler:
- Omits generating a color array in the header.
- Assumes you will use the engine's built-in palette definitions at runtime.
- Custom Palette: If your sprite uses colors not found in the engine palettes, it automatically generates a
{PREFIX}_PALETTE_MAPPING[16]array in the header file.
Naming with Prefixes¶
You can organize your generated code by using the --prefix parameter (or the Prefix field in the GUI).
Using Prefixes¶
By default, sprites are named SPRITE_N_.... Using a prefix allows you to create more descriptive names and avoid naming collisions.
Generated names will follow this pattern: - PLAYER_JUM_SPRITE_0_LAYER_0 - PLAYER_JUM_SPRITE_0_2BPP - PLAYER_JUM_SPRITE_0_4BPP - PLAYER_JUM_PALETTE_MAPPING (if a custom palette is used)
Export Modes¶
Layered (1bpp)¶
Best for standard PixelRoot32 rendering. It extracts each color into its own bitmask (1bpp). The engine then renders these layers sequentially.
Packed (2bpp / 4bpp)¶
Generates a single packed array where each pixel uses multiple bits. - 2bpp: 4 colors max (Index 0 is always transparent). - 4bpp: 16 colors max (Index 0 is always transparent).
These modes are more efficient for sprites with many colors as they require only a single draw call.