How to deal with different screen sizes across multiple platforms.

I’m currently working on a project that targets Windows Phone 8+, and I was wondering if there are any resources outlining a good strategy for preparing a Android / iOS port (by way of Xamarin).

My main concern is the screen layout & art assets, as the aspect ratio and sizes will be noticeably different across multiple devices. Is this something that will have to be independently managed with each version of the project?

This is probably something worth checking out. In my own engine I’m using a modified implementation of the method mentioned, together with relative screen positioning. I have a Screen object (implemented as a service provider in my engine) with a couple of static properties like “TopLeft”, “TopRight” etc. Then I just position some objects (mainly HUD) relative to the screen.

For an example:

var gameObject = world.Create();
var screen = core.GetServiceProvider<Screen>();    
screen.OnResolutionChange += screen_resolve;

void screen_resolve(object sender, ScreenResolutionEventArgs e){
    var transform = gameObject.GetComponent<Transform>();
    transform.Position = Screen.TopRight- new Vector2(-10, 10);
}
1 Like

Interesting - I’ve been placing everything in the view based on the calculated centre of the screen, but having a couple of static properties on top of that could be useful.

From what I’m reading here, it renders everything based on the transformation matrix. So that would theoretically solve the problem of individual texture scales. I’d have to test it on a couple of devices to make sure (and to ensure that doesn’t result in those letterboxes), but that should do the trick - cheers.