A pygame rendering engine for top-down tile sets.
Project description
Tile Forge
This is a package for rendering top-down maps from a provided tile set image.
Class Diagram
---
title: Class Relations
---
classDiagram
Renderer *-- Tileset
Renderer *-- Map
class Tileset {
+ all_properties: dict[int, set[int]]
+ tile_size: int
+ path: str
+ load()
+ get_scaled_tiles(scale: int)
+ has_property(tile_index: int, property_id: int): bool
+ set_property(tile_index: int, property_index: int): void
+ remove_property(tile_index: int, property_index: int): void
+ toggle_property(tile_index: int, property_index: int): void
}
class Map {
+ width: int
+ height: int
+ layers: list[Layer]
+ set_layers(layers: list[Layer])
+ set_layer_count(count: int)
+ add_layer(layer: Layer)
+ cell_has_property(tileset: Tileset, pos: tuple[int, int], property_id: int): bool
}
class Renderer {
- __map: Map
- __tileset: Tileset
+ render_tile_size: int
+ tiles: list[Surface]
+ set_render_scale(scale: int)
+ render(surface: Surface, offset: [int, int], callback): void
}
Usage
import pygame
from tileforge import Tileset, Map, Renderer
pygame.init()
# You need a pygame surface to render the map, so make sure to initialize pygame first
surface = pygame.Surface((640, 480)) # Create a surface to render on
# Load the tileset and map
tileset = Tileset("path/to/tileset.png", 32)
tileset.load()
# Create a map with the loaded tileset
map = Map(10, 10) # 10x10
# Create a renderer and render the map
renderer = Renderer(tileset, map)
renderer.render(surface)
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
tileforge-0.1.5.tar.gz
(6.4 kB
view details)
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 tileforge-0.1.5.tar.gz.
File metadata
- Download URL: tileforge-0.1.5.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5d5d99c1db27a80271dbfe9a61d32190ce7bbb28fd0462c3ede094ae9394da6
|
|
| MD5 |
febe4f3c8b077c520f84d313b9d9b938
|
|
| BLAKE2b-256 |
567200790723b0a413d02b215ecae091a008058a1c1b272dcd316ace3b34fe75
|
File details
Details for the file tileforge-0.1.5-py3-none-any.whl.
File metadata
- Download URL: tileforge-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af31e490556a981a62bffcaf533bfc44deac38566632927f6cb2cf30c9837e6c
|
|
| MD5 |
4a22d1587a3d2b3ba6ce2bd0133e00cc
|
|
| BLAKE2b-256 |
82cd17039f23a0a6f6895e5bdb84f5f0b0b892d8b93aa17b70fb14c5311ccf78
|