Jump to content

Custom Button: touch events


Vivern
 Share

Recommended Posts

var customButton = game.add.sprite(game.world.centerX, game.world.centerY, 'button');customButton.inputEnabled = true;customButton.events.onInputOver.add(onBtnOver, customButton);customButton.events.onInputDown.add(onBtnDown, customButton);

When  touch custom button on ipad simultaneously activated events onInputOver and onInputDown, but should only onInputDown?

 

Possible for mobile devices to use another (not events.onInput) input-touch system embedded in Phaser?

 

Event onInputOver - used for Desktop.

Link to comment
Share on other sites

Because touch devices have no concept of 'hover', they tend to fire the hover event at the same time as a touch in order to catch situations where a hover event has been set. When writing cross-platform code you should take into account whether the device is touch enabled (via the game.device.touch property, which will be true if a touch device is present) and alter your input methods accordingly.

Link to comment
Share on other sites

Thanks. 

 

>>When writing cross-platform code you should take into account whether the device is touch enabled (via the game.device.touch property, which will be true if a touch device is present) and alter your input methods accordingly.

 

- it was my plan "B". I expected that phaser auto-detects the device and adjusts the input-touch.
 

>>via the game.device.touch property

 

- Potentially check can be defined using  game.device.desktop

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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