Esempio n. 1
0
    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();
    }
Esempio n. 2
0
    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;
        }
    }