dreamstack/examples/streaming-physics.ds

29 lines
864 B
Text
Raw Normal View History

-- DreamStack Streaming Physics
-- Physics scene that streams body positions to remote receivers.
-- Receivers see balls and boxes moving in real time.
--
-- Run with:
-- cargo run -p ds-stream &
-- dreamstack stream examples/streaming-physics.ds
let gravity_y = 980
stream main on "ws://localhost:9100/source/physics" { mode: signal }
view main = column [
text "Streaming Physics"
scene { width: 700, height: 450, gravity_y: gravity_y } [
circle { x: 200, y: 80, radius: 35, color: "#8b5cf6" }
circle { x: 350, y: 50, radius: 50, color: "#6366f1" }
rect { x: 500, y: 100, width: 80, height: 50, color: "#10b981" }
circle { x: 150, y: 180, radius: 25, color: "#f59e0b" }
]
row [
button "Anti-Gravity" { click: gravity_y = -500 }
button "Normal" { click: gravity_y = 980 }
button "Zero-G" { click: gravity_y = 0 }
]
]