From 329f3c68f4b5ed36b128dbffbc24a1be44553ad0 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Fri, 23 Feb 2024 11:08:15 -0800 Subject: [PATCH] update ClearScreen_MultiWindow --- .../ClearScreen_MultiWindowGame.cs | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ClearScreen_MultiWindow/ClearScreen_MultiWindowGame.cs b/ClearScreen_MultiWindow/ClearScreen_MultiWindowGame.cs index fa955fd..618f7d3 100644 --- a/ClearScreen_MultiWindow/ClearScreen_MultiWindowGame.cs +++ b/ClearScreen_MultiWindow/ClearScreen_MultiWindowGame.cs @@ -23,23 +23,29 @@ namespace MoonWorks.Test CommandBuffer cmdbuf; Texture? backbuffer; - cmdbuf = GraphicsDevice.AcquireCommandBuffer(); - backbuffer = cmdbuf.AcquireSwapchainTexture(MainWindow); - if (backbuffer != null) + if (MainWindow.Claimed) { - cmdbuf.BeginRenderPass(new ColorAttachmentInfo(backbuffer, Color.CornflowerBlue)); - cmdbuf.EndRenderPass(); + cmdbuf = GraphicsDevice.AcquireCommandBuffer(); + backbuffer = cmdbuf.AcquireSwapchainTexture(MainWindow); + if (backbuffer != null) + { + cmdbuf.BeginRenderPass(new ColorAttachmentInfo(backbuffer, Color.CornflowerBlue)); + cmdbuf.EndRenderPass(); + } + GraphicsDevice.Submit(cmdbuf); } - GraphicsDevice.Submit(cmdbuf); - cmdbuf = GraphicsDevice.AcquireCommandBuffer(); - backbuffer = cmdbuf.AcquireSwapchainTexture(secondaryWindow); - if (backbuffer != null) + if (secondaryWindow.Claimed) { - cmdbuf.BeginRenderPass(new ColorAttachmentInfo(backbuffer, Color.Aquamarine)); - cmdbuf.EndRenderPass(); + cmdbuf = GraphicsDevice.AcquireCommandBuffer(); + backbuffer = cmdbuf.AcquireSwapchainTexture(secondaryWindow); + if (backbuffer != null) + { + cmdbuf.BeginRenderPass(new ColorAttachmentInfo(backbuffer, Color.Aquamarine)); + cmdbuf.EndRenderPass(); + } + GraphicsDevice.Submit(cmdbuf); } - GraphicsDevice.Submit(cmdbuf); } public static void Main(string[] args)