I want to draw a picture in fullscreen on my Samsung Galaxy Note 10 but there is always an area on the top and on the bottom of the screen where it is not drawing the picture, even if I enlarge the height of the picture from GraphicsDevice.Viewport.Height to 2000 pixels.
GraphicsDevice.Viewport.Width = 2560 pixels GraphicsDevice.Viewport.Height = 1536 pixels
How can I use the full screen for drawing?
public class Game1 : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D Sprite100;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
graphics.IsFullScreen = true;
graphics.PreferredBackBufferWidth = 800;
graphics.PreferredBackBufferHeight = 480;
graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
Sprite100 = Content.Load<Texture2D>("100x100");
}
protected override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin();
spriteBatch.Draw(Sprite100, new Rectangle((int)GraphicsDevice.Viewport.Width / 2, (int)GraphicsDevice.Viewport.Height / 2, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), null, Color.White, 0, new Vector2(Sprite100.Width / 2, Sprite100.Height / 2), SpriteEffects.None, 0f);
spriteBatch.End();
base.Draw(gameTime);
}
}
EDIT: This solved the problem. Then GraphicsDevice.Viewport.Height has the correct value 1600.
graphics.PreferredBackBufferWidth = 2560;
graphics.PreferredBackBufferHeight = 1600;