Pyroquad Game Engine
This is a Python game engine based on macroquad.
- Install via
pip install pyroquad(in the browser:micropip.install("pyroquad")) - Requires Python >= 3.9
- Supported Platforms: windows, linux, mac, and WASM via Piodide.
Featuring 2D:
view the demo here
and 3D:
How to run in the browser:
place this code inside a
.htmlfile and open in the browser.<style>#glcanvas { width: 800px !important; height: 600px !important; display: block; } </style> <canvas id="glcanvas" width="800" height="600"></canvas> <pre id="out"></pre> <script type="module"> import { loadPyodide } from "https://cdn.jsdelivr.net/pyodide/v314.0.3/full/pyodide.mjs"; const out = document.getElementById("out"); const print = t => out.textContent += t + "\n"; const pyodide = await loadPyodide({ stdout: print, stderr: print }); await pyodide.loadPackage("micropip"); const micropip = pyodide.pyimport("micropip"); await micropip.install("pyroquad"); await pyodide.runPythonAsync(` from pyroquad import * activate_engine() while True: draw_rectangle(x=100, y=100, w=600, h=300, color=Color.GREEN) draw_text(text="Hello rectangle", x=200, y=200, font_size=50, color=Color.RED) next_frame() examples.limit_fps(60) `).catch(e => print(e)); </script>
How to build:
Prerequesites:
Python >= 3.9 ( python >= 3.14 is recommended)
Rust Compiler >= 1.85.0 (Required for the Rust 2024 Edition)
System libraries if using Linux (required for X11, OpenGL, and audio bindings):
Ubuntu / Debian:
sudo apt-get install -y libasound2-dev libx11-dev libxi-dev libgl1-mesa-dev libxcursor-dev libxinerama-dev libxrandr-devFedora:
sudo dnf install alsa-lib-devel libX11-devel libXi-devel mesa-libGL-devel libXcursor-devel libXinerama-devel libXrandr-develArch Linux:
sudo pacman -S alsa-lib libx11 libxi mesa libxcursor libxinerama libxrandrCreate and activate a Python virtual environment:
macOS / Linux:
python3 -m venv .venv
source .venv/bin/activateWindows:
python -m venv .venv
.venv\Scripts\activateInstall the maturin build tool using
pip install maturinCompilation:
run
maturin build --release --features abi_39 --generate-stubsfor python >= 3.9run
maturin build --release --features abi_310 --generate-stubsfor python >= 3.10run
maturin build --release --features abi_314 --generate-stubsfor python >= 3.14(Note: Older ABIs offer better backward compatibility, but newer versions yield performance improvements)
Installation:
- The generated package can be found at:
/target/wheels/- Install the package:
pip install \path\to\your\file.whl --force-reinstall
How to build for the browser (WebAssembly):
In addition to the prerequisites above:
- the
wasm32-unknown-emscriptentarget:rustup target add wasm32-unknown-emscriptenpip install "pyodide-build>=0.39" "maturin>=1.13.2"—pyodide-builddoes not run natively on Windows, so build the wheel on Linux, macOS or WSL- the Emscripten SDK, at the version
pyodide config get emscripten_versionreports. Noemsdk_envactivation needed:emccis looked up via$EMCC,$EMSDK, the project-localemsdk/, thenPATH.- a browser with JSPI (JavaScript Promise Integration) — Chrome 137+. That is what lets synchronous Python (
while True: ... next_frame()) hand the page back between frames.pyodide xbuildenv install 314.0.7 # the Pyodide that --features abi_314 targets python web/get_pyodide.py # fetch that runtime into web/pyodide/ (once) CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUSTFLAGS="$(pyodide config get rustflags)" \ MATURIN_PYEMSCRIPTEN_PLATFORM_VERSION="$(pyodide config get pyodide_abi_version)" \ PYO3_CROSS_PYTHON_VERSION=3.14 \ maturin build --release --target wasm32-unknown-emscripten --out dist --features abi_314 python web/build_web.py # stage dist/*wasm32.whl for the test page python web/serve.py # http://127.0.0.1:8000/web/index.html?script=tests/test_rec.pyThe flags go in
CARGO_TARGET_<TARGET>_RUSTFLAGS, never a bareRUSTFLAGS: this crate has abuild.rs, which is compiled for the host.
For any Agents reading this:
Please refer to AI.md for best practice and an entrypoint into the engine.
Example Code:
Hello rectangle
from pyroquad import *
activate_engine()
while True:
draw_rectangle(x=100, y=100, w=600, h=300, color=Color.GREEN)
draw_text(text="Hello rectangle", x=200, y=200, font_size=50, color=Color.RED)
next_frame()
examples.limit_fps(60)
Textures
from pyroquad import *
activate_engine()
texture = Loading.download_file(
"https://raw.githubusercontent.com/Ludwig-000/pyroquad/main/docs/PyroquadLogo.png"
).to_Texture2D()
while True:
draw_texture(texture)
next_frame()
examples.limit_fps(60)
Cube
from pyroquad import *
activate_engine()
cube = Cube(
position=Vec3.ZERO,
rotation=Vec3.ZERO,
scale=Vec3.ONE,
color=Color.RED)
cam = Camera3D(position=Vec3.splat(2), target=Vec3.ZERO)
while True:
cam.set_camera()
cube.rot += get_delta_time()
draw_all_objects()
next_frame()
examples.limit_fps(60)
Skybox
from pyroquad import *
activate_engine()
skybox_tex = examples.loading_screen_future(
lambda a: download_file_future(a),
["https://raw.githubusercontent.com/Ludwig-000/pyroquad/main/tests/HDR_blue_nebulae_2.png"],
show_rotating_square=True
)[0].to_Texture2D()
player = examples.PlayerCamera(position=Vec3.ONE)
while True:
if KeyCode.Escape in get_keys_pressed():
break
player.update()
draw_skybox(skybox_tex)
draw_grid(
slices=1_000,
spacing=1.0,
axes_color=Color.YELLOW,
other_color=Color.GREEN)
next_frame()
examples.limit_fps(60)
Multiple windows
import multiprocessing
from pyroquad import *
def task(message, color_name):
activate_engine()
prevent_quit()
color = getattr(Color, color_name)
while not is_quit_requested():
clear_background(color)
draw_text(message, 200, 200, Color.GREEN, 60)
next_frame()
examples.limit_fps(60)
if __name__ == "__main__":
seq_data = [("multiple", "YELLOW"), ("windows", "BRICK"), ("using", "ORANGE")]
for msg, color in seq_data:
p = multiprocessing.Process(target=task, args=(msg, color))
p.start()
p.join()
procs = [multiprocessing.Process(target=task, args=("multiprocessing", "BLUE")) for _ in range(5)]
for p in procs: p.start()
for p in procs: p.join()
Rectangle deletes itself (heartbreaking)
from pyroquad import *
activate_engine()
re = Rectangle(Vec2.splat(200), 0, Vec2.splat(100), Color.WHITE)
timer = 120
def t(rec: Rectangle):
global timer, re
timer-= 1
if timer == 0:
del(re)
rec.draw()
re.tick(t)
while True:
next_frame()
examples.limit_fps(60)
Metadata
Release files for pyroquad 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 52.2 MB
Release files / pyroquad-0.2.0-cp314-abi3-win_amd64.whl
| Download URL | pyroquad-0.2.0-cp314-abi3-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.14 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
91e90563962b84ba8532f2f128286e8324f57293f4a28645b204f2e329c3f453
|
|
BLAKE2b-256 checksum How to use checksums |
7430d4e94de16c75e06a7a07a343963fb3682c1567b57b5115cbe838a7e7c074
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyroquad-0.2.0-cp314-abi3-pyemscripten_2026_0_wasm32.whl
| Download URL | pyroquad-0.2.0-cp314-abi3-pyemscripten_2026_0_wasm32.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.14 PyEmscripten 2026.0+ WebAssembly abi3 |
|
SHA-256 checksum How to use checksums |
d54724581d5a2d47f47cf31929c9aac77ec847fafa298ec9a6582e6ad2f13a9f
|
|
BLAKE2b-256 checksum How to use checksums |
2d59b8f2258f008f33e260b1a215047dab2365efbd23289cf7ee99c547e187f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyroquad-0.2.0-cp314-abi3-manylinux_2_28_x86_64.whl
| Download URL | pyroquad-0.2.0-cp314-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a77e44bfeff8f2420bff6b035bff04acf8ae1d44863711746b51ab4f8c56abd5
|
|
BLAKE2b-256 checksum How to use checksums |
06300f28cff5f1a1226f23d9293dfa99c2e1a6ca8e7e60e6ce5cb3be8bdefe91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyroquad-0.2.0-cp314-abi3-macosx_11_0_arm64.whl
| Download URL | pyroquad-0.2.0-cp314-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | CPython 3.14 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f0c86510a65bc92ca20ea503815939695790c30c333bc31b87b6a74bcb24a76f
|
|
BLAKE2b-256 checksum How to use checksums |
efe7542346d6821068ccc7c6ca02267395c63a5578b0c125ab6db9e096dd4bf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyroquad-0.2.0-cp310-abi3-win_amd64.whl
| Download URL | pyroquad-0.2.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1889930125ac6bae14c89c7ebc691b49280ab46576953503f4855d7317bab690
|
|
BLAKE2b-256 checksum How to use checksums |
de98f6cd325df19ae9a4b46cb5f1381d5d42761673cb535207ee7aaf65e22d54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyroquad-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | pyroquad-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a9a2d0b74f43d86658a53118642cc5ba4a987fb14d2cd6aabae640f1a55b8437
|
|
BLAKE2b-256 checksum How to use checksums |
e50f7820670f1bc572d8de580d8599fb2a858a5fdf8a1544cf73989f78ace9ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyroquad-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | pyroquad-0.2.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7367da8e06ae2d78b94f1d207a11d0b4daed9343b8ef49769677e66f32923cfb
|
|
BLAKE2b-256 checksum How to use checksums |
9903d1345521f6240201ef32806144671416ff393e225a78fd07f34d552d8b77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyroquad-0.2.0-cp39-abi3-win_amd64.whl
| Download URL | pyroquad-0.2.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3785a2f59fa5eb9a9024a1e90b24aa58257d687e6cd5b01582ea31be6dcf3fc2
|
|
BLAKE2b-256 checksum How to use checksums |
c3f158555dc30a6162ed67a59642ba6c96a4473a5b3120cd6e2a53acf0a50d94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyroquad-0.2.0-cp39-abi3-manylinux_2_28_x86_64.whl
| Download URL | pyroquad-0.2.0-cp39-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b7b3af3fefb0e81fd3fb835dd0d031b7f51e24d15e10e69911336309a2eecc97
|
|
BLAKE2b-256 checksum How to use checksums |
ded5a130cf3682bea34fee38fef36b94ccc868dcfa3204c3df4c52d6add9e257
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Release files / pyroquad-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | pyroquad-0.2.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a8c442fcabc41061e1eb71e778a6c2ea09e8daa92b012a9031eba66d80fb03b5
|
|
BLAKE2b-256 checksum How to use checksums |
fcab66cebb7ac97be1bb2bf4df8e610c23752972c467b1273c3fbbcdb34a7fa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.16.0
|
Security for pyroquad 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.