Jump to content

Uncaught TypeError: Cannot read property 'roundPixels' of undefined


neonwarge04
 Share

Recommended Posts

Here is my code:

 

      var screenSize = {width : 600 , height : 550};      var renderer = PIXI.CanvasRenderer(screenSize.width , screenSize.height);      // var assets = new PIXI.loaders.Loader();      // assets.add("_assets/textures/sprites.json");      // assets.once("complete" , function(){ new MainGameScene(renderer , screenSize); });      // assets.load();      document.body.appendChild(renderer.view);

What happens when I run this is that I am getting this error from the logs:
`Uncaught TypeError: Cannot read property 'roundPixels' of undefined` which happens at pixi.js: 12420

 

I don't understand if browser security also applies to CanvasRenderer? Please let me know if there is something I missed.

Thanks a lot!

Link to comment
Share on other sites

Hi,

I think I may solved it now!

I tried supplying the options parameter with `{}`, I debug the pixi.js lib and seeing the option parameter was null. I though the options parameter is optional so I always leave it out since it provides the default values anyways.

I don't know but I think it should check the option if it is null? I am not verbose in javascript so pardon my rough code

 

@pixi.js:12420

this.roundPixels = (options == null)? true : options.roundPixels === true;

Here is what it looks right now:

var renderer = new PIXI.CanvasRenderer(screenSize.width , screenSize.height, {});

Thanks!

Link to comment
Share on other sites

Regarding the example, I just tried a super basic pixi.js, the ones you find from your own tutorials. I just replaced the autoDetectRenderer() with CanvasRenderer. The version I am using is from dev branch I think. Maybe it is causing this problem? This what the logs gave me:

Pixi.js 3.0.8-dev

Nevertheless, I have the error gone away now. 

Thank you!

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...