Skip to main content

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 graphSprite, 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 FilterChain to compose them; pooled render targets
  • RenderTexture — draw once, render forever (trails, painting, destructible terrain)
  • AnimationJuggler, 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

passer_2d-0.9.0.tar.gz (110.1 kB view details)

Uploaded Source

Built Distribution

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

passer_2d-0.9.0-py3-none-any.whl (88.4 kB view details)

Uploaded Python 3

File details

Details for the file passer_2d-0.9.0.tar.gz.

File metadata

  • Download URL: passer_2d-0.9.0.tar.gz
  • Upload date:
  • Size: 110.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for passer_2d-0.9.0.tar.gz
Algorithm Hash digest
SHA256 d65aea1ae8ee2becc9ebb3487f73272ea5cde693e14f41e120b9870ec2d485d8
MD5 77c797c15b00b9e6ed112970a744f175
BLAKE2b-256 905f15cde5d6fde5db4e56a8ae1b47e15b2a5678cbc498ab4fd8836f7220523f

See more details on using hashes here.

File details

Details for the file passer_2d-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: passer_2d-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 88.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for passer_2d-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f9e409caad5991ea75d16ea51e3c5e16e4f92e56f97f90c91152bdfa1b1ca31
MD5 ac43a60738e6391389aec5bfffd65dbf
BLAKE2b-256 f73d57f56f12d759473f2c63dd153d75289cd392a74abafb99158e52d0d283f4

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