jeffibacache Posted November 10, 2015 Share Posted November 10, 2015 Hi, I'm working on a game based in Pixi and I want to avoid the black borders when scaling the game for multiple mobile devices.The question is, is safe to just use for example assets considering the maximum width and height of a specific model but the game safe area occurs in a space of 320x480 and the gui elements are positioned depending on the actual innerWidth / innerHeight? Cheers! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 10, 2015 Share Posted November 10, 2015 I think instead of posing renderer.view in the dom, you can set position of your background container, so coords from (0,0) - (320x480) will be seen in the screen. Then you1) either position gui elements as sprites, manually2) or you can create GUI elements in the dom and use CSS to set their position which wont work for cocoonjs in some configurations... Quote Link to comment Share on other sites More sharing options...
jeffibacache Posted November 10, 2015 Author Share Posted November 10, 2015 For example I have a device with an innerWidth and innerHeight of 400x640, so the renderer view match this size but my assets are positioned in a safe area (ex: 320x480) and the background is bigger and centered all inside the canvas, is safe that to fight the black borders and have compatibility with multiple devices? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 10, 2015 Share Posted November 10, 2015 I dont understand the question , and I dont see a problem mattstyles 1 Quote Link to comment Share on other sites More sharing options...
Prozi Posted November 10, 2015 Share Posted November 10, 2015 on resize event of window you need to resize canvas (renderer). you can check how I did it in chi land:screen.renderer = PIXI.autoDetectRenderer(options);// and call on window.resizescreen.getSizes = function() { this.sizes = { canvas: { width: $('canvas').width(), height: $('canvas').height() } };};// important part screen.resize = function() { // get canvas current size with jquery this.getSizes(); // resize your renderer to 100% 100% this.renderer.resize(this.sizes.canvas.width, this.sizes.canvas.height);};$(window).on('resize', screen.resize.bind(screen)); This is simplified example writing part from memory but it should help i hope jeffibacache 1 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.