using System.Linq; using System.Windows.Forms; using Blacklight.Core; namespace Konis.Testbed { public static class Program { public const string NoVerticalSyncSwitch = "--novsync"; // Lets a run confirm that the window comes up and the loop turns, and then close by itself. public const string ExitAfterFirstFrameSwitch = "--exitafterfirstframe"; private static VerticalSyncMode GetVerticalSyncMode(string[] args) { if (args.Contains(NoVerticalSyncSwitch)) { return VerticalSyncMode.Off; } return VerticalSyncMode.Driver; } private static void Main(string[] args) { GraphicsAdapterManager.Singleton.ForceStartup(); if (!GraphicsAdapterManager.Singleton.ChooseModule(GraphicsAdapterManager.PreferredModuleFrom(args))) { MessageBox.Show("Could not locate any Blacklight graphics adapters (eg: DirectX). Will now exit.", "Critical Error"); return; } GraphicsAdapterManager.Singleton.CurrentModule.VerticalSync = GetVerticalSyncMode(args); Application.Run(new Testbed { ExitAfterFirstFrame = args.Contains(ExitAfterFirstFrameSwitch) }); } } }