mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-23 17:32:02 +01:00
examples/contextlost: Bug fix: Failed to compile with Go 1.12
This commit is contained in:
parent
5e1f263d6d
commit
2acb604260
@ -56,7 +56,7 @@ func (g *Game) loseAndRestoreContext(context js.Value) {
|
||||
// Edge might not support the extension. See
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context
|
||||
ext := context.Call("getExtension", "WEBGL_lose_context")
|
||||
if ext.IsNull() {
|
||||
if !ext.Truthy() {
|
||||
fmt.Println("Fail to force context lost. Edge might not support the extension yet.")
|
||||
return
|
||||
}
|
||||
@ -83,9 +83,9 @@ func (g *Game) Update(screen *ebiten.Image) error {
|
||||
doc := js.Global().Get("document")
|
||||
canvas := doc.Call("getElementsByTagName", "canvas").Index(0)
|
||||
context := canvas.Call("getContext", "webgl2")
|
||||
if context.IsNull() {
|
||||
if !context.Truthy() {
|
||||
context = canvas.Call("getContext", "webgl")
|
||||
if context.IsNull() {
|
||||
if !context.Truthy() {
|
||||
context = canvas.Call("getContext", "experimental-webgl")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user