Quickstart¶
Get a window open in under 20 lines.
2D — Moving Rectangle¶
from simvx.core import Node2D, InputMap, Key, Input, Vec2
from simvx.graphics import App
class Player(Node2D):
def ready(self):
InputMap.add_action("left", [Key.A, Key.LEFT])
InputMap.add_action("right", [Key.D, Key.RIGHT])
InputMap.add_action("up", [Key.W, Key.UP])
InputMap.add_action("down", [Key.S, Key.DOWN])
def process(self, dt):
self.position += Input.get_vector("left", "right", "up", "down") * 200 * dt
def draw(self, renderer):
renderer.draw_rect((self.position.x, self.position.y), (60, 60), colour=(51, 102, 255))
App(width=800, height=600, title="Quickstart").run(Player(position=Vec2(370, 270)))
Save as quickstart.py and run:
uv run python quickstart.py
3D — Spinning Cube¶
from simvx.core import Node, Camera3D, MeshInstance3D, Mesh, Material
from simvx.graphics import App
class Game(Node):
def ready(self):
cam = Camera3D(position=(0, 3, 8))
cam.look_at((0, 0, 0))
self.add_child(cam)
self.cube = self.add_child(MeshInstance3D(mesh=Mesh.cube(), material=Material(colour=(1, 0, 0))))
def process(self, dt):
self.cube.rotate((0, 1, 0), 90 * dt)
App(width=1280, height=720, title="3D Quickstart").run(Game())
What’s Happening¶
Node subclass — Override
ready()for setup,process(dt)for per-frame logic,draw()for 2D rendering.Input —
InputMap.add_action()binds named actions toKeyenums.Input.get_vector()returns a normalised direction.App — Creates a Vulkan window and runs the game loop. One line to launch.
Next Steps¶
Your First 2D Game — Build a complete Pong game step by step
Your First 3D Game — Build a 3D asteroid dodger
Cheatsheet — Quick reference for common patterns