Implementing correct resolution on Android

I’ve currently looked through several posts to implement correct resolution and I’m really struggling, for some reason or another I don’t seem to be able to get them to work.

I’m looking for the most absolute simple, straightforward way to scale resolution on Android with the touchpad.

Is there a complete (up to date) foolproof comprehensive post/guide that tells you exactly what to do, step by step?

Thanks

I have been trying to follow this tutorial http://www.infinitespace-studios.co.uk/general/handling-multiple-screen-resolutions-in-monogame-for-android-part-1/ and it works until this step:

"The constructor needs to be modified to include the virtual Width/Height paramerters and to resolve the GraphicsDeviceManager from the game.

public ScreenManager(Game game, int virtualWidth, int virtualHeight):base(game)
{
  // set the Virtual environment up
  this.virtualHeight= virtualHeight;
  this.virtualWidth= virtualWidth;
  this.graphicsDeviceManager=(GraphicsDeviceManager)game.Services.GetService(typeof(IGraphicsDeviceManager));
  // we must set EnabledGestures before we can query for them, but
 
  // we don't assume the game wants to read them.
  TouchPanel.EnabledGestures= GestureType.None;
}

"

After adding this I receive the following errors: “Method must have return type” and “Unexpected token ‘:’”

The additional steps also give many errors including “Ambiguity between ‘Game1.Sale’ and ‘Game1.Scale’”

Are there a specific places I need to add the code? I am currently just adding it into my public class Game1 : Game class.

The code should be in a class ScreenManager that inherits from DrawableGameComponent.

It’s based of a ScreenManager commonly used in XNA samples, as described in the blog post. I think this is the original file: https://github.com/CartBlanche/MonoGame-Samples/blob/master/NetRumble/ScreenManager/ScreenManager.cs

Thanks very much, sorry I actually realised I already had the modified ScreenManager class that was listed at the bottom of the article and was getting confused: http://www.infinitespace-studios.co.uk/code/ScreenManager.cs

The original problem I am still having is that after I insert this class I receive the following errors:

CS0103 The name ‘ScreenState’ does not exist in the current context
CS0246 The type or namespace name ‘GameScreen’ could not be found (are you missing a using directive or an assembly reference?)
CS0246 The type or namespace name ‘InputState’ could not be found (are you missing a using directive or an assembly reference?)

Additionally, am I supposed to put this line in the main game’s public Game1() ?

screenManager=new ScreenManager (this, 800, 480);

You can grab the other missing files here: https://github.com/CartBlanche/MonoGame-Samples/tree/master/NetRumble/ScreenManager

The first argument expected by the constructor is of type Game, which your Game1 class inherits, so you should call it from within your Game1 class. Make sure you create the ScreenManager after creating the GraphicsDeviceManager though.

I now have included all of the other missing classes that are in this link: https://github.com/CartBlanche/MonoGame-Samples/tree/master/NetRumble/ScreenManager and I am still receiving plenty of error messages including:

CS1061 ‘GameScreen’ does not contain a definition for ‘ControllingPlayer’ and no extension method ‘ControllingPlayer’ accepting a first argument of type ‘GameScreen’ could be found

CS1061 ‘GameScreen’ does not contain a definition for ‘Deserialize’ and no extension method ‘Deserialize’ accepting a first argument of type ‘GameScreen’ could be found

And it goes on…

Seems like the other files where slightly different in the XNA sample that the blog post starts from. You can just get rid of the controlling player argument and of the serialization function, it’s not functionality you’ll need probably, and if it is you can add it back in. For the other errors, think about what the missing code should handle and if you need it and just remove the code if you don’t.