StoreLoad Test

spritebatch
cosmonaut 2024-01-15 17:15:59 -08:00
parent a32c337c69
commit 77d8357186
3 changed files with 73 additions and 0 deletions

View File

@ -59,6 +59,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DepthMSAA", "DepthMSAA\Dept
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowResizing", "WindowResizing\WindowResizing.csproj", "{AF5F2804-663D-4C46-BD02-AB178002180B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StoreLoad", "StoreLoad\StoreLoad.csproj", "{CD31F1B5-C76A-428A-A812-8DFD6CAB20A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -177,6 +179,10 @@ Global
{AF5F2804-663D-4C46-BD02-AB178002180B}.Debug|x64.Build.0 = Debug|x64
{AF5F2804-663D-4C46-BD02-AB178002180B}.Release|x64.ActiveCfg = Release|Any CPU
{AF5F2804-663D-4C46-BD02-AB178002180B}.Release|x64.Build.0 = Release|Any CPU
{CD31F1B5-C76A-428A-A812-8DFD6CAB20A9}.Debug|x64.ActiveCfg = Debug|x64
{CD31F1B5-C76A-428A-A812-8DFD6CAB20A9}.Debug|x64.Build.0 = Debug|x64
{CD31F1B5-C76A-428A-A812-8DFD6CAB20A9}.Release|x64.ActiveCfg = Release|x64
{CD31F1B5-C76A-428A-A812-8DFD6CAB20A9}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\MoonWorks\MoonWorks.csproj" />
<ProjectReference Include="..\MoonWorks.Test.Common\MoonWorks.Test.Common.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
</PropertyGroup>
<Import Project="$(SolutionDir)NativeAOT_Console.targets" Condition="Exists('$(SolutionDir)NativeAOT_Console.targets')" />
</Project>

View File

@ -0,0 +1,50 @@
using System;
using MoonWorks.Graphics;
namespace MoonWorks.Test
{
class StoreLoadGame : Game
{
private GraphicsPipeline fillPipeline;
public StoreLoadGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true)
{
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("RawTriangle.vert"));
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"));
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
MainWindow.SwapchainFormat,
vertShaderModule,
fragShaderModule
);
fillPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
}
protected override void Update(TimeSpan delta)
{
}
protected override void Draw(double alpha)
{
CommandBuffer cmdbuf = GraphicsDevice.AcquireCommandBuffer();
Texture? swapchain = cmdbuf.AcquireSwapchainTexture(MainWindow);
if (swapchain != null)
{
cmdbuf.BeginRenderPass(new ColorAttachmentInfo(swapchain, Color.Blue));
cmdbuf.BindGraphicsPipeline(fillPipeline);
cmdbuf.DrawPrimitives(0, 1, 0, 0);
cmdbuf.EndRenderPass();
cmdbuf.BeginRenderPass(new ColorAttachmentInfo(swapchain, LoadOp.Load, StoreOp.Store));
cmdbuf.EndRenderPass();
}
GraphicsDevice.Submit(cmdbuf);
}
public static void Main(string[] args)
{
StoreLoadGame game = new StoreLoadGame();
game.Run();
}
}
}