Mobile Support (In Progress)
Mar 29 2020While Sara finishes the living room graphics, I’ve been working on a stetch goal for this project - mobile support. From my investigating, it looks like that involves three bigs things:
- Scaling down the scene to fit on the mobile interface
- Making the controls work on a touchscreen
- Fixing the UI to center on the variable dimensions
But before even that, I need to detect if I’m running on a mobile browser or a desktop browser. Godot doesn’t expose that easily, unfortunately; the platform is exposed as “HTML5”, which doesn’t help. I did get that sorted, though, although maybe somewhat teniously.
The next point, scaling the display, is proving to be harder than I anticipated; the relevant functions are not super well documented, and resizing the canvas produces unexpectd results.
Making the controls work on a touchscreen seems pretty easy; the touch location is tracked as the cursor location, and all I’d need is to intercept “mouse press release” events and re-center the mouse in the screen to prevent continued scrolling.
Finally, the UI is going to need some work; dialog boxes should be easy to center, but the rest of the HUD is still in the same scene as the root node, and I don’t know if I’m going to break them out, or just move them.
I’m not sure what to do about changing screen orientation..maybe nothing. This might be a landscape-only experience.
Anyway, this week’s build has the start of it; there’s an attempt at scaling the display (doesn’t work great, but it’s a start), and the controls are at least partially fixed (you can pan in both directions). More to come next weekend.