Hi everyone,
I’m coding a game that uses viewports on Windows 10. Everything works perfectly, except that I tested it on a PC with Windows 7 and I found that everything that is drawn on a viewport with negative coordinates does not appear on the screen.
I created a new project from scratch to make sure there is no mistake who knows where and I only changed the Draw method like this:
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
Viewport defaultViewport = GraphicsDevice.Viewport;
GraphicsDevice.Viewport = new Viewport(50, 50, 1000, 500);
if (Keyboard.GetState().IsKeyDown(Keys.Space))
{
GraphicsDevice.Viewport = new Viewport(-50, 50, 1000, 500);
}
spriteBatch.Begin();
spriteBatch.Draw(tex, new Vector2(0, 0), Color.White);
spriteBatch.End();
GraphicsDevice.Viewport = defaultViewport;
base.Draw(gameTime);
}
On Windows 10 there are no problems: the viewport is moved horizontally by 50 and vertically by 50 or horizontally by -50 by pressing Space and the image appears normally. While on Windows 7 the image appears if I press nothing but disappears completely when I press space.
Some idea?