How kitao/pyxel works
Pyxel is a Python retro-game engine. A developer writes a game using the Python API; its native binding exposes Rust engine functionality, which handles graphics, input, audio, resources, and the platform loop. The repository also provides a resource editor and command-line workflows for running and packaging apps, plus a browser runtime. The README and tree establish these product capabilities, but the sampled source does not expose all internal core call paths, so uncertain engine-to-subsystem links are omitted.
Main entry points: lib.rs PyO3 binding · app.py Editor application · __init__.py Python API · mml_studio.py MML Studio
Components 22
Game authoring
- Python API
python/pyxel/__init__.py
Engine runtime
- PyO3 binding
crates/pyxel-binding/src/lib.rs - Engine core
crates/pyxel-core/src/pyxel.rs - Graphics and canvas
crates/pyxel-core/src/graphics.rs - Input handling
crates/pyxel-core/src/input.rs - Audio playback
crates/pyxel-core/src/audio.rs - MML parsing
crates/pyxel-core/src/mml_parser.rs - Platform backend
crates/pyxel-core/src/platform/facade.rs - SDL2 backend
crates/pyxel-core/src/platform/sdl2/platform_sdl2.rs
Resources and editor
- Resource API
crates/pyxel-binding/src/resource_wrapper.rs - Resource data
crates/pyxel-core/src/resource_data.rs - Resource handling
crates/pyxel-core/src/resource.rs
User interfaces
- Editor launcher
python/pyxel/cli.py - Editor application
python/pyxel/editor/app.py - Image editor
python/pyxel/editor/image_editor.py - Tilemap editor
python/pyxel/editor/tilemap_editor.py - Sound editor
python/pyxel/editor/sound_editor.py - Music editor
python/pyxel/editor/music_editor.py - Browser runtime
wasm/pyxel.js - MML Studio
web/mml-studio/mml_studio.py
Other components
- Game developer
- Browser user
Connections 22
- Game developer → Python API: calls
- Python API → PyO3 binding: invokes native API
- PyO3 binding → Engine core: exposes engine
- PyO3 binding → Resource API: registers functions
- Resource API → Resource handling: loads and saves
- Resource handling → Resource data: reads and writes
- Engine core → Platform backend: uses platform
- Platform backend → SDL2 backend: dispatches
- Editor launcher → Editor application: launches editor
- Editor application → Python API: uses engine API
- Editor application → Image editor: hosts editor
- Editor application → Tilemap editor: hosts editor
- Editor application → Sound editor: hosts editor
- Editor application → Music editor: hosts editor
- Browser user → Browser runtime: starts app
- Browser runtime → Python API: loads Pyxel
- MML Studio → Python API: uses engine API
- MML Studio → MML parsing: supplies MML
- PyO3 binding → Graphics and canvas: wraps API
- PyO3 binding → Input handling: wraps API
- PyO3 binding → Audio playback: wraps API
- Audio playback → MML parsing: parses sound text