Skip to main content

32Blit asset preparation and upload tools

Project description

32blit Tools

Build Status Coverage Status PyPi Package Python Versions

This toolset is intended for use with the 32Blit console to prepare assets and upload games.

Running

The 32Blit toolset contains subcommands for each tool, you can list them with:

32blit --help
  • image - Convert images/sprites for 32Blit
  • font - Convert fonts for 32Blit
  • map - Convert popular tilemap formats for 32Blit
  • raw - Convert raw/binary or csv data for 32Blit
  • pack - Pack a collection of assets for 32Blit
  • cmake - Generate CMake configuration for the asset packer
  • flash - Flash a binary or save games/files to 32Blit
  • metadata - Tag a 32Blit .blit file with metadata
  • relocs - Prepend relocations to a game binary
  • version - Print the current 32blit version

To run a tool, append its name after the 32blit command, eg:

32blit version

Tools

Metadata

Build metadata, and add it to a .blit file.

Flash

Flash and manage games on your 32Blit over USB serial.

Relocs

Collate a list of addresses that need patched to make a .blit file relocatable and position-independent.

Cmake

Generate CMake files for metadata information and/or asset pipeline inputs/outputs.

Assets

You will typically create assets using the "asset pipeline", configured using an assets.yml file which lists all the files you want to include, and how they should be named in code.

An assets.yml file might look like:

# Define an output target for the asset builder
# in this case we want a CSource (and implicitly also a header file)
# type auto-detection will notice the ".cpp" and act accordingly
assets.cpp:
  prefix: asset_
  # Include assets/sprites.png
  # and place it in a variable named "asset_sprites"
  # Since it ends in ".png" the builder will run "sprites_packed" to convert our source file
  assets/sprites.png:
    name: sprites
    palette: assets/sprites.act
    strict: true  # Fail if a colour does not exist in the palette
    transparent: 255,0,255

  # Include assets/level.tmx
  # and place it in a variable named "asset_level_N_tmx"
  # Since it ends in ".tmx" the builder will run "map_tiled" to convert our source file
  assets/level*.tmx:

Fonts

Converts a ttf file or image file into a 32Blit font.

Supported formats:

  • Image .png, .gif
  • Font .ttf

Images

All image assets are handled by Pillow so most image formats will work, be careful with lossy formats since they may add unwanted colours to your palette and leave you with oversized assets.

Supported formats:

  • 8bit PNG .png
  • 24bit PNG .png

Options:

  • palette - Image or palette file (Adobe .act, Pro Motion NG .pal, GIMP .gpl) containing the asset colour palette
  • transparent - Transparent colour (if palette isn't an RGBA image), should be either hex (FFFFFF) or R,G,B (255,255,255)
  • packed - (Defaults to true) will pack the output asset into bits depending on the palette size. A 16-colour palette would use 4-bits-per-pixel.
  • strict - Only allow colours that are present in the palette image/file

Maps/Levels

Supported formats:

Raw Binaries/Text Formats

Supported formats:

  • CSV .csv
  • Binary .bin, .raw

Changelog

0.7.0

  • Reworked Tiled maps support (requires updated SDK) - thanks @Daft-Freak
  • Metadata CMake tool now escapes quotes - thanks @Daft-Freak
  • New project setup tool "32blit setup" for downloading/configuring a boilerplate project - thanks @DaftFreak
  • Fixed asset builder throwing a cryptic error if no valid input files were found

0.6.1

  • Ensure the minimum required version of click is installed - thanks @LordEidi
  • Add separate launch command (in SDK v0.1.11 and later) and --launch flag to install - thanks @Daft-Freak
  • Support 16bit tile indexes - thanks @ThePythonator
  • Output URL/Category metadata for SDL builds - thanks @Daft-Freak

0.6.0

  • Significant code refactor and fixes by @Ali1234
  • Tools have been ported to Click
  • New 32blit install command that installs files/blits intelligently

0.5.0

  • Significant code refactor and fixes by @Ali1234
  • Metadata dump fixed to support RL images
  • Bugfix to incorrect transparent colour being selected
  • Configurable empty_tile for .tmx maps - specifies a tile ID for unset/empty tiles to be remapped to
  • Optional struct output type for .tmx maps with width, height layer count and empty_tile
  • .tmx map layers are now sorted
  • Should not break compatibility, but use 0.4.x if you don't need the new features

0.4.0

  • Breaks metadata compatibility with previous versions!
  • Add URL field for GitHub URL
  • Add Category field to categorise games/apps
  • Add file associations field to identify supported filetypes

0.3.2

  • Allow use of user-specified serial port if VID/PID are empty
  • Support handling multiple sets of options in CMake tool

0.3.1

  • Fixed "32blit game.blit" to save (to SD) instead of flash again

0.3.0

  • New: RLE Encoding support for spritesheets
  • Flasher: refined shorthands- "32blit flash game.blit" and "32blit game.blit" will flash a game.
  • Flasher: fixed a bug where it would reset an open connection and break during a flash

0.2.0

  • New: Version tool: 32blit version
  • Packer: Format support for wildcard asset names

0.1.4

  • New: migrated PIC relocs tool into tools

0.1.3

  • Packer: Fix asset path handing to be relative to working directory

0.1.2

  • Flasher: Add list/del commands
  • Packer: Fix bug where asset packer shared class instances and state
  • Metadata: Find images when building from a config not in working directory
  • Metadata: Require only one of --file or --config options

0.1.1

  • Export metadata config to CMake
  • Add support for packing metadata splash to icns format for macOS

0.1.0

  • Fix palettes to support 256 colours (count will be 0)
  • Parse metadata and relocations with Construct
  • Breaking: Packed image format has changed!

0.0.9

  • Add support for PIC reloc'd binaries with RELO header
  • Add string arg support for asset filename to cmake tool

0.0.8

  • Add autoreset from game to firmware when running flash save
  • Add flash info to determine if in game or firmware
  • Add metadata dependency output from cmake tool
  • Fix asset dependency output to include additional files like palette
  • Redirect errors to stderr
  • Quiet! Use -vvvv for info, warnings, errors and debug information.

0.0.7

  • Add metadata tool - tags binary with metadata from a .yml file
  • Fix relative paths for packer palette files
  • Add support for subdirectories to 32blit flash save

0.0.6

  • Font tool (thanks @Daft-Freak)
  • Flash command with multi-target function (thanks @Daft-Freak)
  • Bugfixes to palette handling (thanks @Daft-Freak)
  • Bugfixes to package recognition (seemed to affect Python 3.8 on Windows)
  • Friendly (ish) error message when a .tmx tilemap with 0-index tiles is used (tmx is 1-indexed for valid tiles)

0.0.5

  • Output data length symbols (thanks @Daft-Freak)
  • Fix --packed to be default, again (packed can be disabled with --packed no)
  • Various other tweaks
  • Start of 32blit file upload support

0.0.4

  • Default images to packed (packed arg now takes a bool)
  • Fix bug in sprite payload size (thanks @Daft-Freak)

0.0.3

  • Fix packaging mishap so tool actually works

0.0.2

  • Real initial release
  • Pack, cmake and asset commands working
  • Very beta!

0.0.1

  • Initial Release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

32blit-0.7.0.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

32blit-0.7.0-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file 32blit-0.7.0.tar.gz.

File metadata

  • Download URL: 32blit-0.7.0.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for 32blit-0.7.0.tar.gz
Algorithm Hash digest
SHA256 ecf39693627edc8dd12ff8ffead150ceed075f4c3ed749a70585ebef0bafc8e4
MD5 3fdf36b2249737e319eae6c8259da115
BLAKE2b-256 8523b398a86cc38c095ee0ea1a3a75ae0f1e34ea5e46e529e28247e0e88f2a48

See more details on using hashes here.

File details

Details for the file 32blit-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: 32blit-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for 32blit-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ff6e57159d8084d852f666f2eb6a0f3ac8a44bce11973dbf65fe0f2108e43f4
MD5 dbc43219c534c65ce6d2d5bc50995fed
BLAKE2b-256 6930d4512054c22fff33c8e386e248c7b91852e81babd91401bbdaa37c99b4ef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page