Pixel Art Render Texture
Demonstrates how the pixelArt game configuration affects the rendering of scaled sprites when drawn to a RenderTexture, ensuring sharp edges without blurring.
800 × 600
class Example extends Phaser.Scene
{
preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
this.load.image('mushroom', 'assets/sprites/mushroom16x16.png');
}
create ()
{
const rt = this.add.renderTexture(0, 0, 800, 600).setOrigin(0);
const mushroom = this.add.image(200, 300, 'mushroom').setScale(16);
rt.draw(mushroom, 400, 0).render();
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
type: Phaser.AUTO,
parent: 'game-container',
width: 800,
height: 600,
backgroundColor: '#2d2d88',
pixelArt: true,
scene: Example
};
const game = new Phaser.Game(config);