-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Open
Description
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
}]
}
};
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.
Metadata
Metadata
Assignees
Labels
No labels