Skip to main content

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.10.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tileforge-0.1.10-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file tileforge-0.1.10.tar.gz.

File metadata

  • Download URL: tileforge-0.1.10.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for tileforge-0.1.10.tar.gz
Algorithm Hash digest
SHA256 4187a80e90ea6b6685569a21673dc1e0d84bfab3d4208f8e1375612cc06a53eb
MD5 0000e724130e49c80ff84d7a085b56d4
BLAKE2b-256 4cfa58327cfb5c870a616842e45f77484004edc10bb0a03b1009a47807f92b6c

See more details on using hashes here.

File details

Details for the file tileforge-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: tileforge-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for tileforge-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 5a48066020edfb11dae92c6e2a1f527a04e76becb86b7daa92b39538552cc1c5
MD5 2f7591e8e92763682d9c5b0512cbe287
BLAKE2b-256 963261378f4b3b8bce7c08745406f38460f57f7f1111cc3504f9c33860834254

See more details on using hashes here.

Supported by

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