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

Animated Knight's Tour visualizer using MXVK Python sprites. More...

Go to the source code of this file.

Classes

class  knight::KnightsTourWindow
class  knight.Position
class  knight::Tour

Namespaces

namespace  knight

Functions

int knight.lround (float value)
int knight.main ()
 knight.parse_args ()
tuple[int, int] knight.parse_resolution (str value)

Variables

 knight.EXAMPLE_DIR = Path(__file__).resolve().parent

Detailed Description

Animated Knight's Tour visualizer using MXVK Python sprites.

Implements Warnsdorff-style move selection, board rendering, and interactive tour playback through a Python VK_Window subclass. It also demonstrates sprite generation from one-pixel NumPy textures, joystick polling, screenshots, and explicit resource release.

Running the example

python3 python-examples/knight/knight.py --resolution 960x720 --enable-vsync

Controls

  • Space: advance one Knight's Tour move.
  • Enter or right mouse button: restart the tour.
  • Left mouse button: start a tour at the selected board cell.
  • S: save a screenshot.
  • Escape: exit.

Design notes

Tour owns the search state and is independent of Vulkan. KnightsTourWindow maps that state into reusable sprites and text during proc().

Definition in file knight.py.