The positions of my touch screen controls are only determined at the start of the scene. A post on my dev blog pointed out a flaw with this: if someone plays one way, then rotates during the game, the touch areas are now wrong.
I’m considering a work around by using “buttons” (invisible, or transparent at least, of course) positioned by the sprite interface, and thus anchored to the edges. I was planning on changing the jump controls eventually, so it’s not much more effort to fix this too. This should solve my control issue, and is totally doable with a bit of extra work.
But the situation leaves me with an unanswered question.
Is there a reliable way for browser games like playcanvas to “check” for the rotation of the screen on a device?
(It would have to be rotation, not just a change of resolution, because I think a few devices out there are square. Though those devices might be rare enough where it’s not worth supporting, or I might be imagining them.)
The game rendering changes size when the device is flipped. Though I suspect that is more due to the canvas being set up to “stretch” instead of actually checking the position because on PC it also will fill the window as the browser changes size.
Anyway, mostly just curious if this even exists. I’ve never seen a browser website care what orientation the device is in, so maybe the browsers simply don’t have a way to check?