diff --git a/internal/devicescale/impl_js.go b/internal/devicescale/impl_js.go index ea2f9cb90..3f7c3db0f 100644 --- a/internal/devicescale/impl_js.go +++ b/internal/devicescale/impl_js.go @@ -19,10 +19,6 @@ import ( ) func impl(x, y int) float64 { - if go2cpp := js.Global().Get("go2cpp"); go2cpp.Truthy() { - return go2cpp.Get("devicePixelRatio").Float() - } - window := js.Global().Get("window") if !window.Truthy() { return 1 diff --git a/internal/gamepad/gamepad_js.go b/internal/gamepad/gamepad_js.go index 364c706ac..2ec341314 100644 --- a/internal/gamepad/gamepad_js.go +++ b/internal/gamepad/gamepad_js.go @@ -22,7 +22,6 @@ import ( var ( object = js.Global().Get("Object") - go2cpp = js.Global().Get("go2cpp") ) type nativeGamepadsImpl struct { @@ -38,7 +37,7 @@ func (g *nativeGamepadsImpl) init(gamepads *gamepads) error { } func (g *nativeGamepadsImpl) update(gamepads *gamepads) error { - // TODO: Use the gamepad events instead of navigator.getGamepads after go2cpp is removed. + // TODO: Use the gamepad events instead of navigator.getGamepads. defer func() { for k := range g.indices { @@ -112,10 +111,6 @@ type nativeGamepadImpl struct { } func (g *nativeGamepadImpl) hasOwnStandardLayoutMapping() bool { - // With go2cpp, the controller must have the standard - if go2cpp.Truthy() { - return true - } return g.mapping == "standard" } diff --git a/internal/graphicsdriver/opengl/context_js.go b/internal/graphicsdriver/opengl/context_js.go index 91826f6d8..39b2d11cd 100644 --- a/internal/graphicsdriver/opengl/context_js.go +++ b/internal/graphicsdriver/opengl/context_js.go @@ -96,7 +96,7 @@ const ( ) var ( - webGL2MightBeAvailable = !forceWebGL1 && (js.Global().Get("WebGL2RenderingContext").Truthy() || js.Global().Get("go2cpp").Truthy()) + webGL2MightBeAvailable = !forceWebGL1 && (js.Global().Get("WebGL2RenderingContext").Truthy()) ) func uint8ArrayToSlice(value js.Value, length int) []byte { @@ -152,9 +152,6 @@ func (c *context) initGL() error { if !gl.Truthy() { return fmt.Errorf("opengl: getContext failed") } - } else if go2cpp := js.Global().Get("go2cpp"); go2cpp.Truthy() { - gl = go2cpp.Get("gl") - c.webGLVersion = webGLVersion2 } c.gl = c.newGL(gl) diff --git a/internal/ui/input_js.go b/internal/ui/input_js.go index 096a44bf0..12198c90e 100644 --- a/internal/ui/input_js.go +++ b/internal/ui/input_js.go @@ -277,29 +277,6 @@ func (in *Input) updateTouchesFromEvent(e js.Value) { } } -func (i *Input) updateForGo2Cpp() { - if !go2cpp.Truthy() { - return - } - - for k := range i.touches { - delete(i.touches, k) - } - touchCount := go2cpp.Get("touchCount").Int() - for idx := 0; idx < touchCount; idx++ { - id := go2cpp.Call("getTouchId", idx) - x := go2cpp.Call("getTouchX", idx) - y := go2cpp.Call("getTouchY", idx) - if i.touches == nil { - i.touches = map[TouchID]pos{} - } - i.touches[TouchID(id.Int())] = pos{ - X: x.Int(), - Y: y.Int(), - } - } -} - func isKeyString(str string) bool { // From https://www.w3.org/TR/uievents-key/#keys-unicode, // diff --git a/internal/ui/ui_js.go b/internal/ui/ui_js.go index d295db75b..2cf17950a 100644 --- a/internal/ui/ui_js.go +++ b/internal/ui/ui_js.go @@ -100,7 +100,6 @@ var ( canvas js.Value requestAnimationFrame = js.Global().Get("requestAnimationFrame") setTimeout = js.Global().Get("setTimeout") - go2cpp = js.Global().Get("go2cpp") ) var ( @@ -109,9 +108,6 @@ var ( ) func init() { - if go2cpp.Truthy() { - return - } documentHasFocus = document.Get("hasFocus").Call("bind", document) documentHidden = js.Global().Get("Object").Call("getOwnPropertyDescriptor", js.Global().Get("Document").Get("prototype"), "hidden").Get("get").Call("bind", document) } @@ -238,20 +234,15 @@ func (u *userInterfaceImpl) DeviceScaleFactor() float64 { } func (u *userInterfaceImpl) outsideSize() (float64, float64) { - switch { - case document.Truthy(): + if document.Truthy() { body := document.Get("body") bw := body.Get("clientWidth").Float() bh := body.Get("clientHeight").Float() return bw, bh - case go2cpp.Truthy(): - w := go2cpp.Get("screenWidth").Float() - h := go2cpp.Get("screenHeight").Float() - return w, h - default: - // Node.js - return 640, 480 } + + // Node.js + return 640, 480 } func (u *userInterfaceImpl) suspended() bool { @@ -262,10 +253,6 @@ func (u *userInterfaceImpl) suspended() bool { } func (u *userInterfaceImpl) isFocused() bool { - if go2cpp.Truthy() { - return true - } - if !documentHasFocus.Invoke().Bool() { return false } @@ -294,7 +281,6 @@ func (u *userInterfaceImpl) updateImpl(force bool) error { if err := gamepad.Update(); err != nil { return err } - u.input.updateForGo2Cpp() a := u.DeviceScaleFactor() if u.lastDeviceScaleFactor != a { @@ -618,15 +604,12 @@ func (u *userInterfaceImpl) Run(game Game) error { } func (u *userInterfaceImpl) updateScreenSize() { - switch { - case document.Truthy(): + if document.Truthy() { body := document.Get("body") bw := int(body.Get("clientWidth").Float() * u.DeviceScaleFactor()) bh := int(body.Get("clientHeight").Float() * u.DeviceScaleFactor()) canvas.Set("width", bw) canvas.Set("height", bh) - case go2cpp.Truthy(): - // TODO: Implement this } }