MCPcopy Create free account
hub / github.com/StereoKit/StereoKit / Step

Method Step

Examples/StereoKitTest/Docs/DocLastElement.cs:8–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6 Pose windowPose = new Pose(0,0,-0.5f, Quat.LookDir(0,0,1));
7
8 public void Step()
9 {
10 /// :CodeSample: UI.LastElementHandActive UI.LastElementHandFocused UI.LastElementActive UI.LastElementFocused
11 /// ### Checking UI element status
12 /// It can sometimes be nice to know how the user is interacting with a
13 /// particular UI element! The UI.LastElementX functions can be used to
14 /// query a bit of this information, but only for _the most recent_ UI
15 /// element that **uses an id**!
16 ///
17 /// ![A window containing the status of a UI element]({{site.screen_url}}/UI/LastElementAPI.jpg)
18 ///
19 /// So in this example, we're querying the information for the "Slider"
20 /// UI element. Note that UI.Text does NOT use an id, which is why this
21 /// works.
22 UI.WindowBegin("Last Element API", ref windowPose);
23
24 UI.HSlider("Slider", ref sliderVal, 0, 1, 0.1f, 0, UIConfirm.Pinch);
25 UI.Text("Element Info:", TextAlign.TopCenter);
26 if (UI.LastElementHandActive (Handed.Left ).IsActive()) UI.Label("Left Active");
27 if (UI.LastElementHandActive (Handed.Right).IsActive()) UI.Label("Right Active");
28 if (UI.LastElementHandFocused(Handed.Left ).IsActive()) UI.Label("Left Focused");
29 if (UI.LastElementHandFocused(Handed.Right).IsActive()) UI.Label("Right Focused");
30 if (UI.LastElementFocused .IsActive()) UI.Label("Focused");
31 if (UI.LastElementActive .IsActive()) UI.Label("Active");
32
33 UI.WindowEnd();
34 /// :End:
35
36 Tests.Screenshot("UI/LastElementAPI.jpg", 1, 500, 500, 90, V.XYZ(0, -0.08f, -0.35f), V.XYZ(0, -0.08f, -0.5f));
37 }
38
39 public void Initialize()
40 {

Callers

nothing calls this directly

Calls 10

WindowBeginMethod · 0.80
HSliderMethod · 0.80
TextMethod · 0.80
IsActiveMethod · 0.80
LastElementHandActiveMethod · 0.80
LabelMethod · 0.80
WindowEndMethod · 0.80
ScreenshotMethod · 0.45
XYZMethod · 0.45

Tested by

no test coverage detected