mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
parent
75721e6fc1
commit
72248fa3ef
@ -338,6 +338,9 @@ func init() {
|
|||||||
|
|
||||||
// Keyboard
|
// Keyboard
|
||||||
canvas.Call("addEventListener", "keydown", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
canvas.Call("addEventListener", "keydown", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
||||||
|
// Focus the canvas explicitly to activate tha game (#961).
|
||||||
|
canvas.Call("focus")
|
||||||
|
|
||||||
e := args[0]
|
e := args[0]
|
||||||
// Don't 'preventDefault' on keydown events or keypress events wouldn't work (#715).
|
// Don't 'preventDefault' on keydown events or keypress events wouldn't work (#715).
|
||||||
theUI.input.Update(e)
|
theUI.input.Update(e)
|
||||||
@ -358,6 +361,9 @@ func init() {
|
|||||||
|
|
||||||
// Mouse
|
// Mouse
|
||||||
canvas.Call("addEventListener", "mousedown", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
canvas.Call("addEventListener", "mousedown", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
||||||
|
// Focus the canvas explicitly to activate tha game (#961).
|
||||||
|
canvas.Call("focus")
|
||||||
|
|
||||||
e := args[0]
|
e := args[0]
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
theUI.input.Update(e)
|
theUI.input.Update(e)
|
||||||
@ -384,6 +390,9 @@ func init() {
|
|||||||
|
|
||||||
// Touch
|
// Touch
|
||||||
canvas.Call("addEventListener", "touchstart", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
canvas.Call("addEventListener", "touchstart", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
||||||
|
// Focus the canvas explicitly to activate tha game (#961).
|
||||||
|
canvas.Call("focus")
|
||||||
|
|
||||||
e := args[0]
|
e := args[0]
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
theUI.input.Update(e)
|
theUI.input.Update(e)
|
||||||
|
Loading…
Reference in New Issue
Block a user