入力デバイスの検出と制限

Phaserについて調査中。
マウス操作、タッチ操作でスコアは差がでるので、検知だったり制限する方法が知りたかったので調べた結果のメモ。


create() {
  if (this.sys.game.device.input.mouse) {
    // マウス入力のみを有効化
    this.input.mouse.enabled = true;
    this.input.touch.enabled = false;
  } else if (this.sys.game.device.input.touch) {
    // タッチ入力のみを有効化
    this.input.mouse.enabled = false;
    this.input.touch.enabled = true;
  }
}
投稿日時: 2024-07-27 02:54:27
更新日時: 2024-07-28 02:37:28

内部リンク

最近の投稿

タグ

アーカイブ

その他