public void RenderToWindow(AppContextType contextType) { PerformTest(game => { var context = GameContextFactory.NewGameContext(contextType, isUserManagingRun: true); var windowRenderer = new GameWindowRenderer(game.Services, context) { PreferredBackBufferWidth = 640, PreferredBackBufferHeight = 480, }; windowRenderer.Initialize(); ((IContentable)windowRenderer).LoadContent(); var messageLoop = windowRenderer.Window.CreateUserManagedMessageLoop(); messageLoop.NextFrame(); windowRenderer.BeginDraw(); game.GraphicsContext.CommandList.Clear(windowRenderer.Presenter.BackBuffer, Color.Blue); windowRenderer.EndDraw(); game.SaveImage(windowRenderer.Presenter.BackBuffer, "Clear"); windowRenderer.Dispose(); }); }
private static void DoGameStuff() { // build context var ctx = GameContextFactory.CreateContext(FilePath); // run it ctx.RunGameLoop(); }