update example to latest moonworks
							parent
							
								
									d8708818cb
								
							
						
					
					
						commit
						929800bc3c
					
				|  | @ -1 +1 @@ | ||||||
| Subproject commit 9028a8b1a02d1f73be3d8006f72a8a68acccacdf | Subproject commit 8f9aaf6d612b97d77ff5013e758846894777089a | ||||||
|  | @ -1,32 +0,0 @@ | ||||||
| using MoonWorks.Graphics; |  | ||||||
| 
 |  | ||||||
| namespace MoonWorksMultiWindow.Graphics |  | ||||||
| { |  | ||||||
|     public class RenderTargets |  | ||||||
|     { |  | ||||||
|         public RenderTarget ExampleRenderTarget { get; } |  | ||||||
| 		public RenderTarget ExtraWindowRenderTarget { get; } |  | ||||||
| 
 |  | ||||||
|         public RenderTargets( |  | ||||||
|             GraphicsDevice graphicsDevice, |  | ||||||
|             uint renderDimensionsX, |  | ||||||
|             uint renderDimensionsY |  | ||||||
|         ) { |  | ||||||
|             ExampleRenderTarget = RenderTarget.CreateBackedRenderTarget( |  | ||||||
|                 graphicsDevice, |  | ||||||
|                 renderDimensionsX, |  | ||||||
|                 renderDimensionsY, |  | ||||||
|                 TextureFormat.R8G8B8A8, |  | ||||||
|                 false |  | ||||||
|             ); |  | ||||||
| 
 |  | ||||||
| 			ExtraWindowRenderTarget = RenderTarget.CreateBackedRenderTarget( |  | ||||||
| 				graphicsDevice, |  | ||||||
| 				renderDimensionsX, |  | ||||||
| 				renderDimensionsY, |  | ||||||
| 				TextureFormat.R8G8B8A8, |  | ||||||
| 				false |  | ||||||
| 			); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  | @ -1,22 +0,0 @@ | ||||||
| using MoonWorks.Graphics; |  | ||||||
| 
 |  | ||||||
| namespace MoonWorksMultiWindow.Graphics |  | ||||||
| { |  | ||||||
| 	public class GraphicsObjects |  | ||||||
| 	{ |  | ||||||
| 		public RenderTargets RenderTargets { get; } |  | ||||||
| 
 |  | ||||||
| 		public GraphicsObjects( |  | ||||||
| 			GraphicsDevice graphicsDevice, |  | ||||||
| 			uint renderDimensionsX, |  | ||||||
| 			uint renderDimensionsY |  | ||||||
| 		) |  | ||||||
| 		{ |  | ||||||
| 			RenderTargets = new RenderTargets( |  | ||||||
| 				graphicsDevice, |  | ||||||
| 				renderDimensionsX, |  | ||||||
| 				renderDimensionsY |  | ||||||
| 			); |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  | @ -1,14 +1,11 @@ | ||||||
| using MoonWorks.Graphics; | using MoonWorks.Graphics; | ||||||
| using MoonWorks; | using MoonWorks; | ||||||
| using MoonWorksMultiWindow.Graphics; |  | ||||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorksMultiWindow | namespace MoonWorksMultiWindow | ||||||
| { | { | ||||||
| 	class MoonWorksMultiWindowGame : Game | 	class MoonWorksMultiWindowGame : Game | ||||||
| 	{ | 	{ | ||||||
| 		private GraphicsObjects GraphicsObjects { get; } |  | ||||||
| 
 |  | ||||||
| 		private Window ExtraWindow { get; } | 		private Window ExtraWindow { get; } | ||||||
| 
 | 
 | ||||||
| 		public MoonWorksMultiWindowGame( | 		public MoonWorksMultiWindowGame( | ||||||
|  | @ -17,13 +14,6 @@ namespace MoonWorksMultiWindow | ||||||
| 			bool debugMode | 			bool debugMode | ||||||
| 		) : base(windowCreateInfo, presentMode, 60, debugMode) | 		) : base(windowCreateInfo, presentMode, 60, debugMode) | ||||||
| 		{ | 		{ | ||||||
| 			// Insert your game initialization logic here. |  | ||||||
| 			GraphicsObjects = new GraphicsObjects( |  | ||||||
| 				GraphicsDevice, |  | ||||||
| 				windowCreateInfo.WindowWidth, |  | ||||||
| 				windowCreateInfo.WindowHeight |  | ||||||
| 			); |  | ||||||
| 
 |  | ||||||
| 			var extraWindowCreateInfo = new WindowCreateInfo | 			var extraWindowCreateInfo = new WindowCreateInfo | ||||||
| 			{ | 			{ | ||||||
| 				WindowTitle = "Extra Window", | 				WindowTitle = "Extra Window", | ||||||
|  | @ -37,7 +27,25 @@ namespace MoonWorksMultiWindow | ||||||
| 
 | 
 | ||||||
| 		protected override void Update(System.TimeSpan dt) | 		protected override void Update(System.TimeSpan dt) | ||||||
| 		{ | 		{ | ||||||
| 			// Insert your game update logic here. | 			if (Inputs.Keyboard.IsPressed(MoonWorks.Input.Keycode.Up)) | ||||||
|  | 			{ | ||||||
|  | 				Window.SetWindowSize(Window.Width + 50, Window.Height + 50); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (Inputs.Keyboard.IsPressed(MoonWorks.Input.Keycode.Down)) | ||||||
|  | 			{ | ||||||
|  | 				Window.SetWindowSize(Window.Width - 50, Window.Height - 50); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (Inputs.Keyboard.IsPressed(MoonWorks.Input.Keycode.Right)) | ||||||
|  | 			{ | ||||||
|  | 				ExtraWindow.SetWindowSize(ExtraWindow.Width + 50, ExtraWindow.Height + 50); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (Inputs.Keyboard.IsPressed(MoonWorks.Input.Keycode.Left)) | ||||||
|  | 			{ | ||||||
|  | 				ExtraWindow.SetWindowSize(ExtraWindow.Width - 50, ExtraWindow.Height - 50); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		protected override void Draw(System.TimeSpan dt, double alpha) | 		protected override void Draw(System.TimeSpan dt, double alpha) | ||||||
|  | @ -52,24 +60,18 @@ namespace MoonWorksMultiWindow | ||||||
| 		private void MainDraw() | 		private void MainDraw() | ||||||
| 		{ | 		{ | ||||||
| 			var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); | 			var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); | ||||||
|  | 			var swapchainTexture = commandBuffer.AcquireSwapchainTexture(Window); | ||||||
| 
 | 
 | ||||||
| 			commandBuffer.BeginRenderPass( | 			if (swapchainTexture != null) | ||||||
| 				new ColorAttachmentInfo |  | ||||||
| 			{ | 			{ | ||||||
| 					RenderTarget = GraphicsObjects.RenderTargets.ExampleRenderTarget, | 				commandBuffer.BeginRenderPass( | ||||||
| 					ClearColor = Color.CornflowerBlue, | 					new ColorAttachmentInfo( | ||||||
| 					LoadOp = LoadOp.Clear, | 						swapchainTexture, Color.CornflowerBlue | ||||||
| 					StoreOp = StoreOp.DontCare | 					) | ||||||
| 				} |  | ||||||
| 				); | 				); | ||||||
| 
 | 
 | ||||||
| 				commandBuffer.EndRenderPass(); | 				commandBuffer.EndRenderPass(); | ||||||
| 
 | 			} | ||||||
| 			commandBuffer.QueuePresent( |  | ||||||
| 				GraphicsObjects.RenderTargets.ExampleRenderTarget.TextureSlice, |  | ||||||
| 				Filter.Nearest, |  | ||||||
| 				Window |  | ||||||
| 			); |  | ||||||
| 
 | 
 | ||||||
| 			GraphicsDevice.Submit(commandBuffer); | 			GraphicsDevice.Submit(commandBuffer); | ||||||
| 		} | 		} | ||||||
|  | @ -77,24 +79,18 @@ namespace MoonWorksMultiWindow | ||||||
| 		private void ExtraWindowDraw() | 		private void ExtraWindowDraw() | ||||||
| 		{ | 		{ | ||||||
| 			var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); | 			var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); | ||||||
|  | 			var swapchainTexture = commandBuffer.AcquireSwapchainTexture(ExtraWindow); | ||||||
| 
 | 
 | ||||||
| 			commandBuffer.BeginRenderPass( | 			if (swapchainTexture != null) | ||||||
| 				new ColorAttachmentInfo |  | ||||||
| 			{ | 			{ | ||||||
| 					RenderTarget = GraphicsObjects.RenderTargets.ExtraWindowRenderTarget, | 				commandBuffer.BeginRenderPass( | ||||||
| 					ClearColor = Color.OrangeRed, | 					new ColorAttachmentInfo( | ||||||
| 					LoadOp = LoadOp.Clear, | 						swapchainTexture, Color.OrangeRed | ||||||
| 					StoreOp = StoreOp.DontCare | 					) | ||||||
| 				} |  | ||||||
| 				); | 				); | ||||||
| 
 | 
 | ||||||
| 				commandBuffer.EndRenderPass(); | 				commandBuffer.EndRenderPass(); | ||||||
| 
 | 			} | ||||||
| 			commandBuffer.QueuePresent( |  | ||||||
| 				GraphicsObjects.RenderTargets.ExtraWindowRenderTarget.TextureSlice, |  | ||||||
| 				Filter.Nearest, |  | ||||||
| 				ExtraWindow |  | ||||||
| 			); |  | ||||||
| 
 | 
 | ||||||
| 			GraphicsDevice.Submit(commandBuffer); | 			GraphicsDevice.Submit(commandBuffer); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue