Skip to main content
The protocol repo ships three drivers under examples/. Each is a Vite project with the same scripts: dev starts the dev server that Drawdy’s development mode hot-reloads from, build packs dist/<driver-id>.drawdyx (dots in the id become dashes, so drawdy.hello builds dist/drawdy-hello.drawdyx), and typecheck runs tsc. From the repo root:

Drawdy Hello

drawdy-hello

drawdy.hello: says hello to the drawdy main loop. One source file.
Shows the smallest useful driver: subscription:scene:elements-added, command:camera:get-info, and command:camera:fly-to-elements.

Math Symbols

drawdy-math-symbols

drawdy.math-symbols: drag Greek letters, operators, and math notation straight onto the canvas.
Shows:
  • A webview: command:webview:create, command:webview:post-message, subscription:webview:message, and acquireDrawdyApi() from the webview API inside it.
  • An action button: command:dom:create-action-button, subscription:dom:element-clicked, command:dom:element-rect.
  • Preview elements during drag and drop: command:scene:create-drawdy-preview-elements, command:scene:delete-drawdy-preview-elements, then command:scene:add-drawdy-elements.
  • Text editing: subscription:scene:text-edit, command:scene:update-text-edit.
  • Also subscription:dom:theme-changed, subscription:keyboard:control-keys, command:scene:query-tool-state, command:camera:screen-to-canvas, and command:camera:get-viewport-rect.

Physics Engine

drawdy-physics-engine

drawdy.physics-engine: simulate selected elements as 2D rigid bodies: gravity, collisions, and impulse response.
Shows:
  • Context menus: command:context-menu:add, command:context-menu:remove, subscription:context-menu:clicked.
  • Reading the selection: command:scene:get-selected-ids, command:scene:get-drawdy-elements.
  • The preview-transform lifecycle: command:scene:begin-preview, command:scene:preview-transforms, command:scene:end-preview, plus command:scene:update-drawdy-elements.
  • Scene events elements-added, elements-updated, elements-removed, elements-replaced, and subscription:camera:moved-rapid.
  • A physics engine under src/engine/ (broadphase, narrowphase, impulses, frame clock) with Jest tests: pnpm --filter drawdy-physics-engine test.