Aer Posted April 8, 2014 Share Posted April 8, 2014 I've seen that here are some solutions for pausing the game after a screen orientation change event, but I wanted to know if anyone has solutions for locking / preventing the change. Also, preferably using only Pixi.js (I've seen Phaser has an option for handling, but not locking). If it's not possible guess I'm just looking for best practices on handling this. Thanks for helping this newb. Quote Link to comment Share on other sites More sharing options...
Sebi Posted April 16, 2014 Share Posted April 16, 2014 I do it like this: First I decide if I want my game to be on portrait or landscape. Let's say I want to force landscape.The first child of my stage is a DisplayObjectContainer.All children are added to that DOC instead of the stage.Now I observe the device orientation. If the device is not in landscape, I will simply resize the renderer view (switching height and width of the stage) and rotate that DOC by 90deg, also adjusting the DOC position. Now it's still landscape on portrait.The next step is to do the same with interactivity. You have to recalculate the mouse position because the top is now x and the left is now y. 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.