Luma

A lightweight python game engine powered by SDL3


Project maintained by ItzCyzmiX Hosted on GitHub Pages — Theme by mattgraham

Examples

The repository includes examples that show how Luma programs are structured. Run them from the repository root.

Starter boilerplate

python examples/boilerplate.py

boilerplate.py is the smallest complete window, draw callback, update callback, and shutdown example.

Input

python examples/input.py

input.py demonstrates key press and release callbacks, held-key movement, mouse button callbacks, mouse motion, and the tracked mouse position.

Shapes

python examples/shapes.py

shapes.py demonstrates filled and outlined rectangles and circles, thick lines and polygon outlines, points, draw colors, and a background color.

Sprites

python examples/sprites.py

sprites.py demonstrates sprite size and position, rotation, custom rotation centers, all flip modes, alpha, color modulation, and kill().

Spritesheet

python examples/spritesheet.py

spritesheet.py demonstrates selecting a source-image frame with source_rect. Luma uses a regular sprite for spritesheet frames; it does not require a separate spritesheet class.

Fonts

python examples/font.py

font.py demonstrates loading a TTF font, creating text objects with engine.Font.open(...) and font.write(...), and updating drawable text each frame. It also shows changing text content and position at runtime.

Audio

python examples/audio.py

audio.py demonstrates loading a sound through engine.Audio, playback, pause/resume, seeking in milliseconds, volume, looping, and the on_finish callback. It uses the included examples/fx.mp3 file.

Pong

python examples/pong.py

pong.py is a complete procedural game. It demonstrates game state, paddle movement, a simple AI opponent, rectangle collision checks, scoring, and reset logic.

All gameplay rules in these examples are ordinary Python. Luma supplies the window, event loop, timing value, and drawing primitives.