I have ported a game across from WP7 to 8 and noticed the game didn’t auto scale so the game was just over a quarter of the screen. which lead me to the following code to auto scale the screen
int? scaleFactor = null;
var content = new System.Windows.Interop.Content();
content = App.Current.Host.Content;
var scaleFactorProperty = content.GetType().GetProperty("ScaleFactor");
if (scaleFactorProperty != null)
scaleFactor = scaleFactorProperty.GetValue(content, null) as int?;
if (scaleFactor == null)
scaleFactor = 100;
double scale = ((double)scaleFactor) / 100.0;
if (scaleFactor == 150)
{
MainPage.Instance.xnaSurface.Margin = new System.Windows.Thickness(10 / scale, 0, 0, 0);
}
ScaleTransform scaleTransform = new ScaleTransform();
scaleTransform.ScaleX = scaleTransform.ScaleY = scale;
MainPage.Instance.xnaSurface.RenderTransform = scaleTransform;
now I am trying to get it to run on android and I cant find a solution that scales the screen (maybe I am not looking in the right places) Could anyone point me in the right direction or give me some pointers on how I could do this? Thank you in advance
Here is an image of how it looks on an android device Click here