JeZxLee Posted August 12, 2017 Share Posted August 12, 2017 Hi, Today we swapped out old "Audio5js" with new "Howler.js" and now have full audio on both Android Chrome & Android Firefox. We currently stretch a 640x480 game onto the Android screen which does not look too good. My question now is can PixiJSv4 determine whether the Android screen is in portrait or landscape mode? We would like to maintain aspect ration now for both portrait & landscape and have an on-screen joystick on bottom(portrait) or on right(landscape). Any help would be appreciated, this is in preparation for our next game project, thanks! JeZxLee Quote Link to comment Share on other sites More sharing options...
Taz Posted August 12, 2017 Share Posted August 12, 2017 It's not Pixi-specific, but if window.innerWidth > window.innerHeight then do landscape layout, otherwise do portrait layout, should work IMO Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted August 12, 2017 Author Share Posted August 12, 2017 Good idea! Will give it a try in the morning... Many thanks! JeZxLee Quote Link to comment Share on other sites More sharing options...
Exca Posted August 14, 2017 Share Posted August 14, 2017 You could also do a css media query with window.matchMedia. For example: var query = window.matchMedia("(orientation:landscape)") var isPortrait = !query.matches; Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted August 14, 2017 Author Share Posted August 14, 2017 Our current system works well. As described above we check width/height of screen to know portrait/landscape... Thanks! JeZxLee 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.