Hello!
I am using the latest version of MonoGame and targetting DirectX.
When I call GameWindow.Create, no extra window is created.
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
namespace TestGame
{
public class Game1 : Game
{
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsMouseVisible = true;
}
private SwapChainRenderTarget _swapChain;
private GameWindow _otherWindow;
protected override void Initialize()
{
base.Initialize();
_otherWindow = GameWindow.Create(this, 500, 542);
_swapChain = new SwapChainRenderTarget(this.GraphicsDevice,
_otherWindow.Handle,
_otherWindow.ClientBounds.Width,
_otherWindow.ClientBounds.Height,
false,
SurfaceFormat.Color,
DepthFormat.Depth24Stencil8,
1,
RenderTargetUsage.PlatformContents,
PresentInterval.Default);
}
protected override void LoadContent()
{
_spriteBatch = new SpriteBatch(GraphicsDevice);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.SetRenderTarget(_swapChain);
GraphicsDevice.Clear(Color.Black);
_swapChain.Present();
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.Black);
base.Draw(gameTime);
}
}
}