mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +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
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
// +build js
|
||||||
// +build example jsgo
|
// +build example jsgo
|
||||||
|
|
||||||
package main
|
package main
|
||||||
@ -75,7 +76,7 @@ func loseAndRestoreContext(context js.Value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
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")
|
doc := js.Global().Get("document")
|
||||||
canvas := doc.Call("getElementsByTagName", "canvas").Index(0)
|
canvas := doc.Call("getElementsByTagName", "canvas").Index(0)
|
||||||
context := canvas.Call("getContext", "webgl")
|
context := canvas.Call("getContext", "webgl")
|
||||||
|
Loading…
Reference in New Issue
Block a user