nkholski / phaser3-es6-webpack

Generic platformer and Phaser 3 bootstrap project
http://metroid.niklasberg.se/phaser3platformer/
703 stars 141 forks source link

Get crisp pixel edges instead of blurry anti-aliasing #13

Closed stahlmanDesign closed 6 years ago

stahlmanDesign commented 6 years ago

A hint I learned from another game engine: if you add a bit of CSS you can get crisp pixels:

        html,
        body {
          margin: 0;
          padding: 0;
          image-rendering: optimizeSpeed;              /* Older versions of FF */
          image-rendering: -moz-crisp-edges;           /* FF 6.0+ */
          image-rendering: -webkit-optimize-contrast;  /* Webkit (non standard naming) */
          image-rendering: -o-crisp-edges;             /* OS X & Windows Opera (12.02+) */
          image-rendering: crisp-edges;                /* Possible future browsers. */
          -ms-interpolation-mode: nearest-neighbor;    /* IE (non standard naming) */
          image-rendering: pixelated;                  /* Chrome 41 */
        }

blurry-crisp

nkholski commented 6 years ago

Thanks. I'll add it to the css asap. If you make a PR I'll merge it. I hope soon that we'll be able to switch to the upcoming official Phaser 3 Scale Manager.

nkholski commented 6 years ago

Thank you for the PR!

stahlmanDesign commented 6 years ago

I noticed in Safari, the crisp pixels only work with Phaser.CANVAS, not Phaser.WEBGL. Other browsers support it in both.

nkholski commented 6 years ago

I think we should just leave your solution in it and wait for the native Phaser scale manager. The flashing star and Mario is dependant on WEBGL as it uses tint.

gammafp commented 6 years ago

In config, add pixelArt: true