Home >Backend Development >Golang >How to compile Raylib to WASM in Golang?

How to compile Raylib to WASM in Golang?

王林
王林forward
2024-02-06 08:36:04655browse

如何在 Golang 中将 Raylib 编译为 WASM?

Question content

I am 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, 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 don't know why this library won't compile, and I can't find anything online. It's also possible that it fails to compile the entire Raylib library and go doesn't get this far because there are a lot of error messages, but I don't know.


Correct answer


I don’t think it’s possible at the moment. Check out issues #69 and #119

on the raylib-go repository

The above is the detailed content of How to compile Raylib to WASM in Golang?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete