Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/megamarc/PyTilengine
Python binding for Tilengine 2D retro graphics engine
https://github.com/megamarc/PyTilengine
Last synced: 3 days ago
JSON representation
Python binding for Tilengine 2D retro graphics engine
- Host: GitHub
- URL: https://github.com/megamarc/PyTilengine
- Owner: megamarc
- License: mit
- Created: 2018-10-09T20:21:46.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-10-10T08:36:47.000Z (about 2 years ago)
- Last Synced: 2024-08-02T05:11:58.726Z (3 months ago)
- Language: Python
- Size: 162 KB
- Stars: 26
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Tilengine logo](Tilengine.png)
# PyTilengine
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
## About PyTilengine
PyTilengine is the Python binding for Tilengine. It is not a direct 1:1 API translation of the original C library, but it uses familiar Python constructions as classes, lists, etc, and has its own documentation.## Contents
* */src* directory contains the single `tilengine.py` module with the binding itself
* */samples* directory contains various examples ready to run and test
* */doc* directory contains the source files for the sphinx documentation tool## Prerequisites
Tilengine native shared library must be installed separately. Please refer to https://github.com/megamarc/Tilengine about how to do it.## Installation
No install step is required. Just make sure that the Tilengine library and the `tilengine.py` modules are accessible from within your own project## Documentation
Online version of the generated docs can be found in the following address:
http://www.tilengine.org/doc_python/## Basic program
The following program does these actions:
1. Import required classes from tilengine binding
2. Initialize the engine with a resolution of 400x240, one layer, no sprites and 20 animation slots
3. Set the loading path to the assets folder
4. Load a *tilemap*, the asset that contains background layer data
5. Attach the loaded tilemap to the allocated background layer
6. Create a display window with default parameters: windowed, auto scale and CRT effect enabled
7. Run the window loop, updating the display at each iteration until the window is closedSource code:
```python
from tilengine import Engine, Window, Tilemapengine = Engine.create(400, 240, 1, 0, 20)
engine.set_load_path("assets/sonic")
foreground = Tilemap.fromfile("sonic_md_fg1.tmx")
engine.layers[0].setup(foreground)window = Window.create()
while window.process():
window.draw_frame()
```Resulting output:
![Test](test.png)
## Running the samples
To run the samples, just open a terminal window inside the "samples" directory and run any of these commands:
```python
python column_offset.py
python dkc.py
python mode7.py
python mosaic.py
python pixel_map.py
python platformer.py
python test.py
python vertical.py
```## License
PyTilengine is released under the permissive MIT license