We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0559249 commit 151b7afCopy full SHA for 151b7af
1 file changed
examples/triangle/js.go
@@ -17,7 +17,17 @@ func (w window) GetSize() (int, int) {
17
}
18
19
func main() {
20
- s, err := InitState(&window{}, &wgpu.SurfaceDescriptor{})
+ document := js.Global().Get("document")
21
+ canvas := document.Call("createElement", "canvas")
22
+ document.Get("body").Call("appendChild", canvas)
23
+
24
+ w := &window{}
25
+ width, height := w.GetSize()
26
+ canvas.Set("width", width)
27
+ canvas.Set("height", height)
28
+ canvas.Set("style", "width:100vw; height:100vh")
29
30
+ s, err := InitState(w, &wgpu.SurfaceDescriptor{Canvas: canvas})
31
if err != nil {
32
panic(err)
33
0 commit comments