LordXido commited on
Commit
19de9b4
·
verified ·
1 Parent(s): d0ec1e8

Update world.wgsl

Browse files
Files changed (1) hide show
  1. world.wgsl +20 -10
world.wgsl CHANGED
@@ -1,19 +1,29 @@
1
- // world.js — v9.2
2
  export class World {
3
- constructor(gpu) {
 
4
  this.gpu = gpu;
5
  this.t = 0;
6
-
7
- if (gpu.mode === "gpu") {
8
- console.log("[World] GPU mode active");
9
- // Future: bind pipelines here
10
- } else {
11
- console.log("[World] CPU mode active");
12
- }
13
  }
14
 
15
  update(dt) {
16
  this.t += dt;
17
- // Deterministic state evolution hook
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
  }
 
 
1
  export class World {
2
+ constructor(canvas, gpu) {
3
+ this.ctx = canvas.getContext("2d");
4
  this.gpu = gpu;
5
  this.t = 0;
 
 
 
 
 
 
 
6
  }
7
 
8
  update(dt) {
9
  this.t += dt;
10
+ }
11
+
12
+ apply(cmd) {
13
+ // placeholder for language → world binding
14
+ }
15
+
16
+ render() {
17
+ const w = this.ctx.canvas.width = this.ctx.canvas.clientWidth;
18
+ const h = this.ctx.canvas.height = this.ctx.canvas.clientHeight;
19
+
20
+ this.ctx.fillStyle = "#000";
21
+ this.ctx.fillRect(0, 0, w, h);
22
+
23
+ this.ctx.fillStyle = "#00ffd0";
24
+ const r = 40 + Math.sin(this.t) * 20;
25
+ this.ctx.beginPath();
26
+ this.ctx.arc(w / 2, h / 2, r, 0, Math.PI * 2);
27
+ this.ctx.fill();
28
  }
29
  }