static void Main(string[] args) { // This will allow the App constructor to call a few SK methods // before Initialize is called. SK.PreLoadLibrary(); // If the app has a constructor that takes a string array, then // we'll use that, and pass the command line arguments into it on // creation Type appType = typeof(App); App app = appType.GetConstructor(new Type[] { typeof(string[]) }) != null ? (App)Activator.CreateInstance(appType, new object[] { args }) : (App)Activator.CreateInstance(appType); if (app == null) { throw new Exception("StereoKit loader couldn't construct an instance of the App!"); } // Initialize StereoKit, and the app if (!SK.Initialize(app.Settings)) { Environment.Exit(1); } app.Init(); // Now loop until finished, and then shut down while (SK.Step(app.Step)) { } SK.Shutdown(); }
////////////////////// public App(string[] args) { Tests.IsTesting = Array.IndexOf(args, "-test") != -1; Tests.MakeScreenshots = Array.IndexOf(args, "-noscreens") == -1; if (Array.IndexOf(args, "-screenfolder") != -1) { Tests.ScreenshotRoot = args[Array.IndexOf(args, "-screenfolder") + 1]; } if (Array.IndexOf(args, "-start") != -1) { startTest = args[Array.IndexOf(args, "-start") + 1]; } if (Tests.IsTesting) { settings.displayPreference = DisplayMode.Flatscreen; settings.disableUnfocusedSleep = true; } // Preload the StereoKit library for access to Time.Scale before // initialization occurs. SK.PreLoadLibrary(); Time.Scale = Tests.IsTesting ? 0 : 1; /// :CodeSample: Log.Subscribe Log /// Then you add the OnLog method into the log events like this in /// your initialization code! Log.Subscribe(OnLog); /// :End: }
////////////////////// public App(string[] args) { Tests.IsTesting = args.Length > 0 && args[0].ToLower() == "-test"; if (!Tests.IsTesting && args.Length > 0) { startTest = args[0]; } if (Tests.IsTesting) { settings.displayPreference = DisplayMode.Flatscreen; } // Preload the StereoKit library for access to Time.Scale before // initialization occurs. SK.PreLoadLibrary(); Time.Scale = Tests.IsTesting ? 0 : 1; /// :CodeSample: Log.Subscribe Log /// Then you add the OnLog method into the log events like this in /// your initialization code! Log.Subscribe(OnLog); /// :End: }