This is a Python game engine based on macroquad.
- Install via
pip install pyroquad - Requires Python >= 3.9
- Supported Platforms: windows, linux, mac, (wasm eventually)
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 maturin(optional) Run
cargo run --bin stub_gen --no-default-features --features use-realto gennerate up-to-date python stubs in init.pyi.Stub generation specifically requires python >= 3.10
Compilation:
run
maturin build --release --features abi_39for python >= 3.9run
maturin build --release --features abi_310for python >= 3.10run
maturin build --release --features abi_314for 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
Please refer to AI.md for best practice and an entrypoint into the engine.
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)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)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)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)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()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)
