コード例 #1
0
        public bool DrawFrame(Action <int, int> draw, [CallerMemberName] string frameName = null)
        {
            DeviceContext.RSSetViewport(new RawViewport(0.0f, 0.0f, Window.Width, Window.Height));
            var clearColor = new RawColor4(0.0f, 0.2f, 0.4f, 1.0f);

            DeviceContext.ClearRenderTargetView(RenderTargetView, clearColor);

            // Call callback.
            draw(Window.Width, Window.Height);

            var result = SwapChain.Present(1, PresentFlags.None);

            if (result.Failure &&
                result.Code == DirectX.DXGI.ResultCode.DeviceRemoved.Code)
            {
                return(false);
            }

            return(true);
        }