Quickstart

Get a window open in under 20 lines.

Common Imports

from simvx.core import Node, Node2D, Node3D, Signal, Property, Vec2, Vec3
from simvx.core import InputMap, Input, Key, MouseButton
from simvx.core import Camera3D, MeshInstance3D, Mesh, Material, WorldEnvironment
from simvx.core import Sprite2D, Text2D, AudioStreamPlayer
from simvx.graphics import App

Every example on this page builds on these. Import only what you use.

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

import math
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), math.radians(90) * dt)  # 90°/sec

App(width=1280, height=720, title="3D Quickstart").run(Game())

Rotation APIs take radians; use math.radians() when thinking in degrees.

What’s Happening

  1. Node subclass — Override ready() for setup, process(dt) for per-frame logic, draw() for 2D rendering.

  2. InputInputMap.add_action() binds named actions to Key enums. Input.get_vector() returns a normalised direction.

  3. App — Creates a Vulkan window and runs the game loop. One line to launch.

Next Steps