static void CommonUpdate() { if (Input.Key(Key.Esc).IsJustActive()) { StereoKitApp.Quit(); } // 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 (Tests.IsTesting) { return; } // Make a window for demo selection UI.WindowBegin("Demos", ref demoSelectPose, new Vec2(50 * U.cm, 0)); for (int i = 0; i < Tests.DemoCount; i++) { string name = Tests.GetDemoName(i).Substring("Demo".Length); if (UI.Button(name)) { Tests.SetDemoActive(i); } UI.SameLine(); } UI.WindowEnd(); RulerWindow(); DebugToolWindow.Step(); /// :CodeSample: Log.Subscribe Log /// And in your Update loop, you can draw the window. LogWindow(); /// And that's it! /// :End: }
////////////////////// public void Step() { Tests.Update(); if (Input.Key(Key.Esc).IsJustActive()) { SK.Quit(); } // If we can't see the world, we'll draw a floor! if (SK.System.displayType == Display.Opaque) { Renderer.Add(floorMesh, World.HasBounds ? World.BoundsPose.ToMatrix() : floorTr, Color.White); } // Skip selection window if we're in test mode if (Tests.IsTesting) { return; } /// :CodeSample: World.HasBounds World.BoundsSize World.BoundsPose // Here's some quick and dirty lines for the play boundary rectangle! if (World.HasBounds) { Vec2 s = World.BoundsSize / 2; Matrix pose = World.BoundsPose.ToMatrix(); Vec3 tl = pose.Transform(new Vec3(s.x, 0, s.y)); Vec3 br = pose.Transform(new Vec3(-s.x, 0, -s.y)); Vec3 tr = pose.Transform(new Vec3(-s.x, 0, s.y)); Vec3 bl = pose.Transform(new Vec3(s.x, 0, -s.y)); Lines.Add(tl, tr, Color.White, 1.5f * U.cm); Lines.Add(bl, br, Color.White, 1.5f * U.cm); Lines.Add(tl, bl, Color.White, 1.5f * U.cm); Lines.Add(tr, br, Color.White, 1.5f * U.cm); } /// :End: // Make a window for demo selection UI.WindowBegin("Demos", ref demoSelectPose, new Vec2(50 * U.cm, 0)); for (int i = 0; i < demoNames.Count; i++) { if (UI.Button(demoNames[i])) { Tests.SetDemoActive(i); } UI.SameLine(); } UI.NextLine(); UI.HSeparator(); if (UI.Button("Exit")) { SK.Quit(); } UI.WindowEnd(); RulerWindow(); DebugToolWindow.Step(); /// :CodeSample: Log.Subscribe Log /// And in your Update loop, you can draw the window. LogWindow(); /// And that's it! /// :End: }