MoonWorksTemplate/ProjectName/ProjectNameGame.cs

64 lines
1.8 KiB
C#

using MoonWorks.Graphics;
using MoonWorks.Window;
using MoonWorks;
using ProjectName.Graphics;
namespace ProjectName
{
class ProjectNameGame : Game
{
private GraphicsObjects GraphicsObjects { get; }
private int RenderWidth { get; }
private int RenderHeight { get; }
public ProjectNameGame(
WindowCreateInfo windowCreateInfo,
PresentMode presentMode,
bool debugMode
) : base(windowCreateInfo, presentMode, 60, debugMode)
{
// Insert your game initialization logic here.
GraphicsObjects = new GraphicsObjects(
GraphicsDevice,
windowCreateInfo.WindowWidth,
windowCreateInfo.WindowHeight
);
RenderWidth = (int)windowCreateInfo.WindowWidth;
RenderHeight = (int)windowCreateInfo.WindowHeight;
}
protected override void Update(double dt)
{
// Insert your game update logic here.
}
protected override void Draw(double dt, double alpha)
{
// Replace this with your own drawing code.
var commandBuffer = GraphicsDevice.AcquireCommandBuffer();
commandBuffer.BeginRenderPass(
GraphicsObjects.RenderPasses.ExampleRenderPass,
GraphicsObjects.Framebuffers.ExampleFramebuffer,
new Rect
{
X = 0,
Y = 0,
W = RenderWidth,
H = RenderHeight
},
Color.CornflowerBlue.ToVector4()
);
commandBuffer.QueuePresent(
GraphicsObjects.RenderTargets.ExampleRenderTarget.TextureSlice,
Filter.Nearest
);
GraphicsDevice.Submit(commandBuffer);
}
}
}