gowebassemblyraylib

How can I compile Raylib to WASM in Golang?


I'm trying to compile Raylib to WASM in Golang, but when I run the command env GOOS=js GOARCH=wasm go build . Go can't seem to compile rcamera, and it gives me the following error message

# github.com/gen2brain/raylib-go/raylib
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:196:27: undefined: GetMouseDelta
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:220:56: undefined: GetFrameTime
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:226:6: undefined: IsKeyDown
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:229:6: undefined: IsKeyDown
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:232:6: undefined: IsKeyDown
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:235:6: undefined: IsKeyDown
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:238:6: undefined: IsKeyDown
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:241:6: undefined: IsKeyDown
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:246:8: undefined: IsGamepadAvailable
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:248:29: undefined: IsMouseButtonDown
../../.go/pkg/mod/github.com/gen2brain/raylib-go/[email protected]/rcamera.go:248:29: too many errors

I have no clue why the library won't compile, and I can't find anything online. It's also possible it can't compile the entire Raylib library and go just doesn't get that far because there's to many error messages, but I have no clue.


Solution

  • I don't think it is possible at the moment. Take a look at issues #69 and #119 on the raylib-go repository