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

Method RulerWindow

Examples/StereoKitTest/DebugToolWindow.cs:387–403  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

385 static Pose rulerPose = new Pose(0, 0, .5f, Quat.Identity);
386 static string[] rulerLabels = { "0", "5", "10", "15", "20", "25" };
387 static void RulerWindow()
388 {
389 UI.HandleBegin("Ruler", ref rulerPose, new Bounds(new Vec3(31,4,1)*U.cm), true);
390 Color32 color = Color.HSV(.6f, 0.5f, 1);
391 Text.Add("Centimeters", Matrix.TS(new Vec3(14.5f, -1.5f, -.6f)*U.cm, .3f), TextAlign.BottomLeft);
392 for (int d = 0; d <= 60; d+=1)
393 {
394 float x = d/2.0f;
395 float size = d%2==0?.5f:0.15f;
396 if (d%10 == 0 && d/2 != 30) {
397 size = 1;
398 Text.Add(rulerLabels[d/10], Matrix.TS(new Vec3(15-x-0.1f, 2-size, -.6f) * U.cm, .2f), TextAlign.BottomLeft);
399 }
400 Lines.Add(new Vec3(15-x, 1.8f, -.6f)*U.cm, new Vec3(15-x,1.8f-size, -.6f)*U.cm, color, U.mm*0.5f);
401 }
402 UI.HandleEnd();
403 }
404}

Callers

nothing calls this directly

Calls 5

HandleBeginMethod · 0.80
HSVMethod · 0.80
TSMethod · 0.80
HandleEndMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected