Mathieu Posted April 6, 2016 Share Posted April 6, 2016 Hello everyone ! I need to know if there is a way in Pixi to add width to the renderer view without scaling the content. I already tried using renderer.autoResize = false with no success. For example : // First I set the height of the view var h = window.innerHeight-100; renderer.view.style.height = h + "px"; // Then, I set the width with the good factor to keep everything in a good shape renderer.view.style.width = (h*2.666) + "px"; // I would like to be able to add width after without affecting the shape of the sprites renderer.view.style.width+=[missingWidthToFillTheScreen]; Do you think it's possible ? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 6, 2016 Share Posted April 6, 2016 //if you wanna auto-update style renderer = new Renderer(800, 600, { autoResize:true}); renderer.resize(newWidth, newHeight); //if you want to do it yourself renderer = new Renderer(800, 600, {}); renderer.resize(newWidth, newHeight); renderer.view.style.width = newWidth+'px'; renderer.view.style.height = newHeight+'px'; //You dont want to resize canvas, you are totally ok if it will be pixelated renderer.view.style.width = newWidth+'px'; renderer.view.style.height = newHeight+'px'; stage.scale.x = newWidth/800; stage.scale.y = newHeight/600; Renderer and view have its own width/height that are actually CANVAS width/height, it differs from CSS ones. 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.