/// <summary> /// Initialization /// </summary> public virtual void Setup() { form = new RenderForm(Window.Title); form.SetBounds(Window.Left, Window.Top, Window.Width, Window.Height); sw = new Stopwatch(); timing = new GameTime(); SwapChainDescription desc = new SwapChainDescription() { BufferCount = 1, ModeDescription = new ModeDescription(Window.Width, Window.Height, new Rational(FrameRate, 1), Format.R8G8B8A8_UNorm), IsWindowed = true, OutputHandle = form.Handle, SampleDescription = new SampleDescription(1, 0), SwapEffect = SwapEffect.Discard, Usage = Usage.RenderTargetOutput }; Device1.CreateWithSwapChain(SharpDX.Direct3D.DriverType.Hardware, DeviceCreationFlags.BgraSupport, desc, out device, out swapChain); D2DFactory = new SharpDX.Direct2D1.Factory(); factory = swapChain.GetParent <SharpDX.DXGI.Factory>(); factory.MakeWindowAssociation(form.Handle, WindowAssociationFlags.IgnoreAll); backBuffer = Texture2D.FromSwapChain <Texture2D>(swapChain, 0); renderView = new RenderTargetView(device, backBuffer); Surface surface = backBuffer.QueryInterface <Surface>(); D2DRenderTarget = new RenderTarget(D2DFactory, surface, new RenderTargetProperties(new PixelFormat(Format.Unknown, AlphaMode.Premultiplied))); }