hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
11.12k stars 664 forks source link

Can WebAssembly (Wasm) be supported to run in environments without DOM, such as in WeChat Mini Programs? #3048

Closed zhanjunjie2019 closed 4 months ago

zhanjunjie2019 commented 4 months ago

Operating System

What feature would you like to be added?

Currently, I'm attempting to run a game using Wasm in WeChat or Douyin Mini Programs. However, due to the absence of DOM in this environment, it results in the following error message.

image

I found that the issue lies in "ebiten\internal\ui\ui_js.go", where using "js.Global().Get("window")" results in obtaining undefined. Could you provide support that is compatible with such environments?

Why is this needed?

No response

hajimehoshi commented 4 months ago

Ebitengine uses a canvas so cannot support an environment where this doesn't exist.