Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Disabling orientation lock for a dimensionless html game?

A topic by Ryan Wolf created Jun 10, 2018 Views: 683
Viewing posts 1 to 1

https://5000lobsters.itch.io/nemesisters is an html game that's set to run in the browser. when I run it on mobile chrome, the orientation is locked (in landscape mode). Based on https://itch.io/updates/better-support-for-mobile-html-games-more this looks like feature, but itch.io is guessing the dimensions of my game wrong?

It's just <p> tags appended to the <body>, it doesn't have dimensions and reflows fine when the user changes orientation (not due to like l33t skills or something, it's just plain). I've set a max-width to prevent getting like a single unreadable row of text on desktop monitors, but that's it.

I've found that I can "fix" it by calling screen.orientation.unlock() in my html (there might be a race condition in there, but it's worked 3/3 times I've tried it anyway). But if the user is holding their phone in portrait it starts in landscape and then switches back in a kind of jarring way.

I could add in like a fancy fade in animation to cover that up, but I'm hoping there's a way to hint to the mobile game iframe thing that it should not lock in the first place.

Any ideas?