Jump to content

Disable antialiasing


mariogarranz
 Share

Recommended Posts

Does anybody know how can I scale a game while keeping the pixel art look intact?

The game constructor recieves a parameter called "antialias". I set it to false:

var game = new Phaser.Game(400,240,Phaser.AUTO, '', {preload: preload, create: create, update: update},false,false);

Then set the game stage to scale for exactly twice its size:

 

game.stage.scale.minWidth = 800;game.stage.scale.minHeight = 480;game.stage.scale.refresh();
 
But it still looks antialiased and a little blurry.

Am I missing something?
Link to comment
Share on other sites

Hi,

If by "looking intact" you mean still being able to sort of "counting the pixels", we've got this feature implemented in Phaser :

Phaser.Canvas.setSmoothingEnabled(game.context, false);

However, please note that this can only work if you set Phaser.CANVAS as your renderer.

 

See this example : http://gametest.mobi/phaser/examples/display/render%20crisp.php

 

 

Link to comment
Share on other sites

Hi,

If by "looking intact" you mean still being able to sort of "counting the pixels", we've got this feature implemented in Phaser :

Phaser.Canvas.setSmoothingEnabled(game.context, false);

However, please note that this can only work if you set Phaser.CANVAS as your renderer.

 

See this example : http://gametest.mobi/phaser/examples/display/render%20crisp.php

 

Thanks for your answer, Alvin.

I had already tried that, but it doesn't seem to be working with a whole stage scaling (in the example its only scaling a single sprite, not the whole stage).

 

I'm making some scaling performance tests using Rich's Nutmeg sprites, this is what I mean (first one is Phaser, second one is Impact JS):

 

6zHChlS.png

 

CjiBkIg.png

Link to comment
Share on other sites

  • 9 months later...
 Share

  • Recently Browsing   0 members

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