Fix flickering bug by ensuring game canvas dimensions are even numbers in Phaser config

オープン
#7,164 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript

調査の方向性

リポジトリのファイルやテストは指定されていません。まず、issue に示されている Phaser ゲーム設定を見つけ、その canvas の寸法がどのように計算されているかを調べてください。レンダリング中にビューポートの奇数または小数の寸法によってちらつきや視覚的なアーティファクトが発生しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

A rendering flicker occurred when the Phaser game canvas width or height was an odd number. This issue was caused by subpixel rendering and rounding errors when the canvas size had fractional pixels. The solution was to adjust the game configuration to force both the width and height to be even numbers by subtracting 1 if they were odd. This ensures smoother rendering and prevents visual artifacts during gameplay.

If you want it more formal or detailed, just tell me!

     const config = {
            type: Phaser.AUTO,
            width: window.innerWidth % 2 === 1 ? window.innerWidth - 1 : window.innerWidth ,
            height: window.innerHeight % 2 === 1 ? window.innerHeight - 1 : window.innerHeight ,
           
            
            backgroundColor: '#2d2d2d',
            parent: gameRef.current,
            pixelArt: true,
            physics: {
                default: 'arcade',
                arcade: {
                    gravity: { y: 0 },
                    debug: false
                }
            },
            scene: [firstScene, ...Object.values(othersScenes)], // Aquí va el nombre de tu clase de escena

            // --- AÑADE ESTA SECCIÓN ---
            plugins: {
                global: [{
                    key: 'rexVirtualJoystick',
                    plugin: rexvirtualjoystickplugin, // El nombre de la clase del plugin
                    start: true
                }]
            }
        };

https://phaser.discourse.group/t/roundpixels-is-causing-jittering-with-cameras-main-startfollow/11880/8

I saw the solution in this post, I would like to know what is happening since my game is currently small and there should be no problems.

主要言語
JavaScript
スター
40.7k
フォーク
7.2k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

phaserjs/phaser のほかの issue

phaserjs/phaser の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。