kittykatattack / learningPixi

A step-by-step introduction to making games and interactive media with the Pixi.js rendering engine.
4.4k stars 850 forks source link

Mention default values for PIXI.Application options #87

Closed aaronang closed 6 years ago

aaronang commented 6 years ago
let app = new PIXI.Application({ 
   width: 256, 
   height: 256,                       
   antialias: true, 
   transparent: false, 
   resolution: 1
 }
);

If you're happy with Pixi's default settings, you don't need to set any of these options, except of course the width and height (But, if you need to, see Pixi's documentation on PIXI.Application

What do those options do? antialias smoothes the edges of fonts and graphic primitives. (WebGL anti-aliasing isn’t available on all platforms, so you’ll need to test this on your game’s target platform.) transparent makes the canvas background transparent. resolution makes it easier to work with displays of varying resolutions and pixel densities. Setting the resolutions is a little outside the scope of this tutorial, but check out Mat Grove's explanation about how to use resolution for all the details. But usually, just keep resolution at 1 for most projects and you'll be fine.

Based on the PIXI.Application documentation, I think it makes sense to mention that transparent and resolution are set to false and 1, respectively, by default. Moreover, it is not required to set width and height because they default to 800 and 600, respectively.

I am sorry for nitpicking. I just think that the phrasing can be improved. Thanks a lot for this masterpiece 👏 🙌