A loader for LDtk (Level Designer Toolkit) maps, specifically designed for use with the pyglet game development library.
Project description
pyglet-ldtk
A loader for LDtk (Level Designer Toolkit) maps, specifically designed for use with the pyglet game development library. This module simplifies the process of integrating your LDtk level designs into your pyglet applications, handling everything from parsing LDtk JSON files to rendering complex tile layers and entities.
Features
- LDtk Project Loading: Parses standard
.ldtkproject files and supports external level files. - Tileset Management: Loads tileset images, extracts tile regions, and handles tile flipping.
- Entity Rendering: Renders LDtk entities, including support for basic shapes, custom tile textures, and advanced 9-slice scaling.
- Layer Handling: Processes various LDtk layer types: IntGrid, Entities, Tiles, and AutoLayers.
- Coordinate System Conversion: Automatically converts LDtk's top-left origin coordinates to pyglet's bottom-left origin.
- Batch Rendering: Optimized for pyglet's
Batchsystem for efficient rendering. - IntGrid Visualization: Renders IntGrid layers as colored rectangles for easy debugging or visualization.
Installation
pip install pyglet-ldtk
Usage
(For detailed usage examples, please refer to the tests/ directory for now. A more comprehensive guide will be added here eventually.)
import pyglet
from ldtk import Ldtk
# Load your LDtk project
ldtk_project = Ldtk("path/to/your/project.ldtk")
# Get the first level
level = ldtk_project.levels[0]
# Create a pyglet batch
batch = pyglet.graphics.Batch()
# Add the level's content to the batch
level.addToBatch(batch)
# Basic window setup (example)
window = pyglet.window.Window(level.sizePx[0], level.sizePx[1], caption="LDtk Level")
@window.event
def on_draw():
window.clear()
batch.draw()
pyglet.app.run()
Compatibility
- Python 3.10+
- Pyglet 2.1.11+
Acknowledgment
This repository would not be possible without the following prior art:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyglet_ldtk-0.1.2.tar.gz.
File metadata
- Download URL: pyglet_ldtk-0.1.2.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2568cf1fb588c009ba92cf9627b62da78ec7fb1f2f48a7a00525548b733b5e9f
|
|
| MD5 |
2a5be341ef35b5abb5f7339cb82e6636
|
|
| BLAKE2b-256 |
73afdb70fb30b98fc1985cd80148a382d051d8acb3e3b3a4e6f2d7c549dd75b8
|
Provenance
The following attestation bundles were made for pyglet_ldtk-0.1.2.tar.gz:
Publisher:
pypi-publish.yml on Kaleidosium/pyglet-ldtk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyglet_ldtk-0.1.2.tar.gz -
Subject digest:
2568cf1fb588c009ba92cf9627b62da78ec7fb1f2f48a7a00525548b733b5e9f - Sigstore transparency entry: 746570888
- Sigstore integration time:
-
Permalink:
Kaleidosium/pyglet-ldtk@8ac3625c377dd1ccf623620911610113a62e2aec -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Kaleidosium
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@8ac3625c377dd1ccf623620911610113a62e2aec -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyglet_ldtk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyglet_ldtk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b13dbd7d9358a047b05aa45cb14392c4a68886c68db7a41dc89ff797b1c4791
|
|
| MD5 |
41c98e13de623c36997216abe3f5b5dc
|
|
| BLAKE2b-256 |
5e9685fef76344a4f7c297d8ebbb1922e82762907f3fd00e6368a4de7793aaae
|
Provenance
The following attestation bundles were made for pyglet_ldtk-0.1.2-py3-none-any.whl:
Publisher:
pypi-publish.yml on Kaleidosium/pyglet-ldtk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyglet_ldtk-0.1.2-py3-none-any.whl -
Subject digest:
3b13dbd7d9358a047b05aa45cb14392c4a68886c68db7a41dc89ff797b1c4791 - Sigstore transparency entry: 746570898
- Sigstore integration time:
-
Permalink:
Kaleidosium/pyglet-ldtk@8ac3625c377dd1ccf623620911610113a62e2aec -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Kaleidosium
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@8ac3625c377dd1ccf623620911610113a62e2aec -
Trigger Event:
push
-
Statement type: