mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
examples/contextlost: Bug fix: Add 'js' build tag
Importing 'syscall/js' requires 'js' environment.
This commit is contained in:
parent
2aa79e0aa4
commit
80ae508d29
@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build js
|
||||
// +build example jsgo
|
||||
|
||||
package main
|
||||
@ -75,7 +76,7 @@ func loseAndRestoreContext(context js.Value) {
|
||||
}
|
||||
|
||||
func update(screen *ebiten.Image) error {
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeySpace) && js.Global() != js.Null() {
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeySpace) {
|
||||
doc := js.Global().Get("document")
|
||||
canvas := doc.Call("getElementsByTagName", "canvas").Index(0)
|
||||
context := canvas.Call("getContext", "webgl")
|
||||
|
Loading…
Reference in New Issue
Block a user