- Add scene container to AST, lexer, parser, analyzer, and codegen
- Add circle/rect/line as UI elements for physics body declaration
- Compile scene {} to canvas + async WASM init + Rapier2D PhysicsWorld
- Reactive gravity via DS.effect() — bodies wake on gravity change
- Mouse drag interaction with impulse-based body movement
- Compile-time hex color parsing for body colors
- Fix is_signal_ref matching numeric literals (700.value bug)
- Fix body variable uniqueness (next_node_id per body)
- Fix gravity signal detection (check AST Ident before emit_expr)
- Add physics.ds example with 5 bodies + 4 gravity control buttons
- Update DREAMSTACK.md and IMPLEMENTATION_PLAN.md with Phase 10-11
- 39 tests pass across all crates, 22KB output
24 lines
843 B
Text
24 lines
843 B
Text
-- DreamStack Physics Demo
|
|
-- Rapier2D-powered rigid body physics, driven from the .ds language
|
|
-- Gravity, collision, rotation — all from a scene declaration
|
|
|
|
let gravity_y = 980
|
|
|
|
view main = column [
|
|
text "⚡ DreamStack 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" }
|
|
rect { x: 300, y: 200, width: 60, height: 60, color: "#14b8a6" }
|
|
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 }
|
|
button "🪐 Heavy" { click: gravity_y = 2000 }
|
|
]
|
|
]
|