Jump to content

Pointer Off on Android w/ Recent Phaser 2 Versions


Abandoned Refrigerator
 Share

Recommended Posts

I'm using PhaserCE 2.10.0 and I've setup my game in (256) x (256*aspectRatio) in portrait mode using the SHOW_ALL scale method to size up to the screen. Everything's been going pretty well, but now I've run into a  weird issue. I'm just not sure if it's a bug I should report or if I should just be doing something different.

On android(in chrome and the cocoon dev app) pointer coordinates(read via input.pointer#.x|y) max out at 104. On desktop, it works just fine, with x coordinates maxing at 255 and y maxing dependent on the screen aspect ratio.

Here's a debug shot of my input dev view where I touched 2 fingers down near the center of the screen and moved them to opposite corners of the view.

Screenshot_20180221-232245.thumb.jpg.4c2b0898800fd358601c8999ea8bfa6e.jpg

I've tried a few different versions of Phaser 2.10.1, 2.7.10, and 2.4.9 and found that the issue goes away with 2.4.9. Obviously, I could just use an old version for now but... I don't wanna.

Anyone with more Phaser experience know what might have changed to cause this?

If it helps, here's my init call:

    App.game = new Phaser.Game({
        width: scale.width,
        height: scale.height,
        renderer: Phaser.AUTO,
        antialias: false,
        resolution: 1
    })

Boot state setup:

Boot.prototype.create = function _Boot_create() {

    this.game.time.advancedTiming = App.debug

    this.game.renderer.renderSession.roundPixels = true

    this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL

    this.game.scale.pageAlignHorizontally = true
    this.game.scale.pageAlignVertically = true

    this.game.scale.refresh()

    this.game.state.start("load")

}

Play state create:

Play.prototype.create = function _Play_create() {

    var scale = Util.scale()
    this.world.resize(scale.width, 5*scale.height)
    this.physics.arcade.gravity.y = 750

    this.stage.backgroundColor = "#aaddff"

    this.player = new Player(this)
    new Floor(this, this.game.world.height)
    new Platform(this, 64, this.game.world.height - 64, 64, 1)

    this.camera.follow(this.player.sprite)

    this.controls = new Input(this)

}

Input setup for Play state:

var Input = function _Input ( scene ) {

    this.scene = scene
    this.cursors = this.scene.input.keyboard.createCursorKeys()
    this.scene.input.gamepad.start()
    this.pad1 = this.scene.input.gamepad.pad1
    this.p1 = this.scene.input.pointer1
    this.p2 = this.scene.input.pointer2

    this.butt = 0
    this.scene.input.gamepad.onDownCallback = function (e) {
        this.butt = e
    }
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...