mduSenthil Posted July 25, 2018 Share Posted July 25, 2018 I have developed a HTML5 2D Shooter game. When I try to load this game as instant game in Telegram, I would like to force the game to load in landscape mode. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
mattstyles Posted August 18, 2018 Share Posted August 18, 2018 I don't know what Telegram is but you can't lock browser orientation (for very good reasons). Not yet anyway. If you're developing for a webview inside a native application then you can set orientation. Quote Link to comment Share on other sites More sharing options...
none-9999 Posted August 19, 2018 Share Posted August 19, 2018 here the advice to user to rotate device function setOrientation(){ if(window.innerWidth > window.innerHeight){ //device is landscape canvas.style.display="block"; imagePleaseRotateDisplay.style.display="none"; //resume the game }else if(window.innerHeight > window.innerWidth){ //device is portrait canvas.style.display="none"; imagePleaseRotateDisplay.style.display="block"; //pause the game } } window.addEventListener("resize", function () { setTimeout(setOrientation,200); //somewhere the coordinates update as asynchronous //that use the "setTimeout" }, false); 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.