MXVK Vulkan Framework 0.35.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
tetris Directory Reference

Files

 
__init__.py
 Package marker for the 2D mxvk_wrap Tetris example.
 
main.py
 A small 2D Tetris clone made with mxvk_wrap sprites and fonts.

Detailed Description

mxvk_wrap 2D Tetris

A compact, playable 2D Tetris clone written with mxvk_wrap. It uses the block, background, and font files in this directory's data/ folder, and a Font passed to App.draw_text() for the HUD without changing the window font. Completed rows flash with the supplied gray block texture before collapsing. Gravity and the clear animation run on a fixed 60 Hz simulation step, so their timing does not depend on the rendering frame rate. The HUD also shows the next tetromino. The background uses data/background.frag.spv, an animated custom fragment shader driven by mouse position, render resolution, and elapsed time. Its paired data/sprite.vert.spv is included so the example does not depend on the current working directory for its custom shader pipeline.

From the repository root, build the MXVK Python extension:

cmake -S . -B build-python -DPYTHON_MODULE=ON -DEXAMPLES=OFF
cmake --build build-python --target mxvk_ext -j
PYTHONPATH=build-python:python-examples python3 python-examples/mxvk_wrap/examples/tetris/main.py

Controls: Left/Right to move, Up to rotate, Down to soft drop, Space to hard drop, R to restart after game over, and Escape to quit.