37 lines
839 B
C#
37 lines
839 B
C#
|
using MoonWorks;
|
|||
|
using MoonWorks.Graphics;
|
|||
|
using MoonWorks.Input;
|
|||
|
|
|||
|
namespace MoonWorksGraphicsTests;
|
|||
|
|
|||
|
class ClearScreenExample : Example
|
|||
|
{
|
|||
|
public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs)
|
|||
|
{
|
|||
|
Window = window;
|
|||
|
GraphicsDevice = graphicsDevice;
|
|||
|
|
|||
|
Window.SetTitle("ClearScreen");
|
|||
|
}
|
|||
|
|
|||
|
public override void Update(System.TimeSpan delta) { }
|
|||
|
|
|||
|
public override void Draw(double alpha)
|
|||
|
{
|
|||
|
CommandBuffer cmdbuf = GraphicsDevice.AcquireCommandBuffer();
|
|||
|
Texture swapchainTexture = cmdbuf.AcquireSwapchainTexture(Window);
|
|||
|
if (swapchainTexture != null)
|
|||
|
{
|
|||
|
var renderPass = cmdbuf.BeginRenderPass(
|
|||
|
new ColorAttachmentInfo(swapchainTexture, false, Color.CornflowerBlue)
|
|||
|
);
|
|||
|
cmdbuf.EndRenderPass(renderPass);
|
|||
|
}
|
|||
|
GraphicsDevice.Submit(cmdbuf);
|
|||
|
}
|
|||
|
|
|||
|
public override void Destroy()
|
|||
|
{
|
|||
|
}
|
|||
|
}
|