static void CommonUpdate() { Renderer.Add(floorMesh, floorTr, Color.White); // Skip selection window if we're in test mode if (Demos.TestMode) { return; } // Make a window for demo selection UI.WindowBegin("Demos", ref demoSelectPose, new Vec2(50 * Units.cm2m, 0)); for (int i = 0; i < Demos.Count; i++) { // Chop off the "Demo" part of any demo name that has it string name = Demos.GetName(i); if (name.StartsWith("Demo")) { name = name.Substring("Demo".Length); } if (UI.ButtonRound(name, 4 * Units.cm2m)) { Demos.SetActive(i); } UI.SameLine(); } UI.WindowEnd(); }
static void Main(string[] args) { Demos.TestMode = args.Length > 0 && args[0].ToLower() == "-test"; StereoKitApp.settings.assetsFolder = Program.Root; if (!StereoKitApp.Initialize("StereoKit C#", Demos.TestMode ? Runtime.Flatscreen : Runtime.MixedReality, true)) { Environment.Exit(1); } CommonInit(); Demos.FindDemos(); Demos.SetActive(args.Length > 0 ? args[0] : "Geo"); Demos.Initialize(); while (StereoKitApp.Step(() => { Demos.Update(); CommonUpdate(); })) { ; } Demos.Shutdown(); CommonShutdown(); StereoKitApp.Shutdown(); }
static void CommonUpdate() { // If we can't see the world, we'll draw a floor! if (StereoKitApp.System.displayType == Display.Opaque) { Renderer.Add(floorMesh, floorTr, Color.White); } // Skip selection window if we're in test mode if (Demos.TestMode) { return; } // Make a window for demo selection UI.WindowBegin("Demos", ref demoSelectPose, new Vec2(50 * Units.cm2m, 0)); for (int i = 0; i < Demos.Count; i++) { string name = Demos.GetName(i); // No Doc demos if (name.StartsWith("Doc")) { continue; } // Chop off the "Demo" part of any demo name that has it if (name.StartsWith("Demo")) { name = name.Substring("Demo".Length); } if (UI.Button(name)) { Demos.SetActive(i); } UI.SameLine(); } UI.WindowEnd(); RulerWindow(); /// :CodeSample: Log.Subscribe Log /// And in your Update loop, you can draw the window. LogWindow(); /// And that's it! /// :End: // Take a screenshot on the first frame both hands are gripped bool valid = Input.Hand(Handed.Left).IsTracked&& Input.Hand(Handed.Right).IsTracked; BtnState right = Input.Hand(Handed.Right).grip; BtnState left = Input.Hand(Handed.Left).grip; if (valid && left.IsActive() && right.IsActive() && (left.IsJustActive() || right.IsJustActive())) { Renderer.Screenshot(Input.Head.position, Input.Head.Forward, 1920 * 2, 1080 * 2, "Screenshot" + screenshotId + ".jpg"); screenshotId += 1; } }
/// :End: ////////////////////// static void Main(string[] args) { Demos.TestMode = args.Length > 0 && args[0].ToLower() == "-test"; Time.Scale = Demos.TestMode ? 0 : 1; Log.Filter = LogLevel.Diagnostic; StereoKitApp.settings.assetsFolder = Program.Root; if (!StereoKitApp.Initialize("StereoKit C#", Demos.TestMode ? Runtime.Flatscreen : Runtime.MixedReality, true)) { Environment.Exit(1); } if (Demos.TestMode) { Input.HandVisible(Handed.Max, false); } CommonInit(); Demos.FindDemos(); Demos.SetActive(args.Length > 0 ? args[0] : "Lines"); Demos.Initialize(); while (StereoKitApp.Step(() => { Demos.Update(); CommonUpdate(); })) { ; } Demos.Shutdown(); CommonShutdown(); StereoKitApp.Shutdown(); }