neonwarge04 Posted September 6, 2015 Share Posted September 6, 2015 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! Quote Link to comment Share on other sites More sharing options...
xerver Posted September 6, 2015 Share Posted September 6, 2015 You forgot to use the `new` operator. Quote Link to comment Share on other sites More sharing options...
neonwarge04 Posted September 6, 2015 Author Share Posted September 6, 2015 Hi Xerver, Thanks for your reply. I am afraid I tried what you said but I am still getting the same error. Thank you! Quote Link to comment Share on other sites More sharing options...
neonwarge04 Posted September 7, 2015 Author Share Posted September 7, 2015 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:12420this.roundPixels = (options == null)? true : options.roundPixels === true;Here is what it looks right now:var renderer = new PIXI.CanvasRenderer(screenSize.width , screenSize.height, {});Thanks! Quote Link to comment Share on other sites More sharing options...
xerver Posted September 7, 2015 Share Posted September 7, 2015 What version of pixi are you using? I don't see anywhere that roundPixels is set from options in the source... Please submit a running example. Quote Link to comment Share on other sites More sharing options...
neonwarge04 Posted September 8, 2015 Author Share Posted September 8, 2015 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-devNevertheless, I have the error gone away now. Thank you! Quote Link to comment Share on other sites More sharing options...
xerver Posted September 8, 2015 Share Posted September 8, 2015 You must've had something else going on, I tried to reproduce this in about 3 examples and never got it to happen. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.