Flash-style 2D display list for Python, in the spirit of Sparrow/Starling: scene graph, mesh batching, custom shader styles, stencil masks, filters and distance-field text on moderngl + pyglet
Project description
Passer
A Python 2D game framework in the spirit of Sparrow and Starling — the Flash-style display list, reborn on moderngl (rendering) and pyglet (window, input, audio).
The sparrow (genus Passer) flies again — this time in Python.
Leggi il README in italiano.
from passer import App, Quad
app = App(400, 300, "Hello Passer")
quad = app.stage.add_child(Quad(100, 100, color=0xFF3355))
quad.align_pivot()
quad.x, quad.y = 200, 150
app.run(lambda dt: setattr(quad, "rotation", quad.rotation + dt))
Why
Sparrow brought Flash's display list to iOS, and Starling carried it to a whole generation of 2D games: a scene graph with hierarchical transforms, tweens, jugglers and texture atlases — an ergonomics the Python 2D ecosystem (flat sprite lists) never had. Passer brings that architecture to Python, with a batching renderer on modern OpenGL that can be tested headless, down to the pixel.
Features
- Scene graph —
Sprite,Quad,Image,Mesh, hierarchical transforms (pivot, scale, rotation, skew), bubbling events, touch and keyboard input, hit testing that follows actual geometry - Starling 2 rendering core — CPU-transformed mesh batching
(
MeshBatch/BatchProcessor): one draw call per state run - Mesh styles — plug your own GLSL shader into any mesh without
breaking batching (
MeshStyle/MeshEffect) - Distance field text & shapes — crisp at any scale, with outline, glow and drop shadow in a single pass; built-in SDF generator (exact euclidean distance transform, pure Python)
- Masks — stencil-based, rotated and nested, inverted masks included
- Blend modes — add, multiply, screen, erase, mask, below + custom
- Canvas & Polygon — filled polygons (ear-clipping triangulation), circles, rounded rectangles, quadratic/cubic Bézier paths
- Filters — blur, color matrix, drop shadow, glow, and
FilterChainto compose them; pooled render targets - RenderTexture — draw once, render forever (trails, painting, destructible terrain)
- Animation —
Juggler,Tween(with transitions),MovieClip, delayed calls - Text — AngelCode bitmap fonts, embedded 8px "mini" font (plus its distance-field twin, generated at runtime)
- AssetManager — enqueue folders, load with progress, fetch everything by name; atlas regions found automatically
- Desktop citizenship — letterbox scaling (fit/integer/stretch), fullscreen, mouse wheel, hover
Install
pip install passer-2d
Requires Python ≥ 3.10 and OpenGL 3.3. Linux, Windows and macOS (everything pyglet + moderngl support).
Tested where it counts
The whole rendering pipeline is exercised by 134 tests that render on a headless standalone GL context and assert on real pixels — masks, blend modes, filters, distance fields, triangulation. No window needed; they run in CI.
Demos
The demos/ folder is a tour: a mini platformer with the
original Sparrow assets, vector night scenes, playing cards drawn with
Bézier curves, plasma shaders, stencil-mask lanterns, drop shadows,
SDF typography, and the three-line AssetManager pantry.
Heritage & license
Passer is a conceptual port of the Sparrow Framework and of Starling 2
(© Gamua GmbH, Simplified BSD) — same architecture, pythonic API
(snake_case, properties, duck typing). Passer itself is released
under the Simplified BSD license; see LICENSE.md.
A heads-up for contributors: the codebase is documented in Italian (docstrings and comments) — the author's native tongue. The API itself is plain English.
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 passer_2d-0.8.0.tar.gz.
File metadata
- Download URL: passer_2d-0.8.0.tar.gz
- Upload date:
- Size: 103.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22cc0b43a5527eecb19d8208c1b3abdc2021293214e99fa4c52aedb34b6aadfd
|
|
| MD5 |
edc0a9837346b1c6b444dc607948b513
|
|
| BLAKE2b-256 |
890c9ede5411d4e3e8da5fc2b4bdb680347fb7bc875e21db2decdfd4f0af46d7
|
File details
Details for the file passer_2d-0.8.0-py3-none-any.whl.
File metadata
- Download URL: passer_2d-0.8.0-py3-none-any.whl
- Upload date:
- Size: 83.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa2865b32199b1dba704be7baca8967a2b84beeed45941996f0831d5f3548889
|
|
| MD5 |
02b748d3e6b371c852655d705da2cfaf
|
|
| BLAKE2b-256 |
fb2ddd71658330a7e3ee533c7028be36f2d829aea789d84e7304a6105975d88f
|