Jump to content

[PIXI] Correct way to initialize an Application?


d13
 Share

Recommended Posts

Hi Everyone,

Browsing through the Pixi docs, it looks like the correct way to initialize a Pixi app with an initial width and height is:

let app = Pixi.Application({width: 500, height: 500});

It looks like Application only takes a single options argument.

http://pixijs.download/release/docs/PIXI.Application.html#stage

 

However, the examples use this format:

var app = new PIXI.Application(800, 600);

http://pixijs.github.io/examples/#/basics/basic.js

The above is how v3 used to do it - is this now deprecated, and is the format in the Doc the most up to date?

 

Link to comment
Share on other sites

  • 1 month later...

What about the use of PIXI.WebGLRenderer, PIXI.autoDetectRenderer and PIXI.CanvasRenderer?

In the getting started tutorial ( https://github.com/kittykatattack/learningPixi ) they use PIXI.autoDetectRenderer but in the demos ( https://pixijs.github.io/examples/#/basics/basic.js ) they all use PIXI.Application.

Whats the difference between an Application and a WebGLRenderer or CanvasRenderer?

Link to comment
Share on other sites

The actual renderers are the canvas and webgl, which you are free to create directly, but autoDetectRenderer is usually preferred as it favours creating the webgl renderer (much faster) but automatically falls back to canvas if webgl isn't supported. You'd only have to write this fallback yourself anyway.

The Application method is just a helper class that uses autoDetectRenderer in the background, and provides commonly required basic functionality, like access to a ticker, and getters for the renderer and view. If you don't want to use it, fine :) We've found it very useful at pixi for creating the examples, as it handles the common boilerplate code, leaving just the example code we want to show off

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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