using MoonWorks.Graphics; using MoonWorks; using MoonTools.ECS; namespace MoonWorksECSTest { class MoonWorksECSTestGame : Game { World world; public MoonWorksECSTestGame( WindowCreateInfo windowCreateInfo, PresentMode presentMode, bool debugMode ) : base(windowCreateInfo, presentMode, 60, debugMode) { var worldBuilder = new WorldBuilder(); worldBuilder.AddSystem(new InputSystem(Inputs)); worldBuilder.AddSystem(new PositionSystem()); var entity = worldBuilder.CreateEntity(); worldBuilder.Set(entity, new PositionComponent { Position = new MoonWorks.Math.Vector2(200, 200) }); world = worldBuilder.Build(); } protected override void Update(System.TimeSpan dt) { world.Update(dt); } protected override void Draw(System.TimeSpan dt, double alpha) { var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); var swapchainTexture = commandBuffer.AcquireSwapchainTexture(Window); commandBuffer.BeginRenderPass( new ColorAttachmentInfo(swapchainTexture, Color.CornflowerBlue) ); commandBuffer.EndRenderPass(); GraphicsDevice.Submit(commandBuffer); } protected override void OnDestroy() { } } }