From 9fa2884bfe3e8615f37e5827101b9c437eec0e6d Mon Sep 17 00:00:00 2001 From: spatialfree Date: Mon, 4 Nov 2024 05:11:34 -0500 Subject: [PATCH] on trigger btn toggle menu --- src/Arts.cs | 14 ++++++++++++++ src/Mono.cs | 7 ++++++- src/Rig.cs | 7 ++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/Arts.cs b/src/Arts.cs index 2a6f251..565f2b5 100644 --- a/src/Arts.cs +++ b/src/Arts.cs @@ -59,6 +59,20 @@ static class Arts if (Mono.menu) { meshes["Tape"].Draw(mat_mono, Matrix.Identity); + meshes["uiPlay"].Draw( + mat_unlit, + Matrix.TR( + V.XYZ(0, 0, Mono.SD_Z + 0.5f + 0.1f), + Quat.FromAngles(90, 0, 0) + ) + ); + meshes["uiCursor"].Draw( + mat_unlit, + Matrix.TR( + V.XYZ(0, 0, Mono.SD_Z + 0.5f + 0.2f), + Quat.FromAngles(90, 0, 0) + ) + ); } // snake diff --git a/src/Mono.cs b/src/Mono.cs index d5940d0..497c8bd 100644 --- a/src/Mono.cs +++ b/src/Mono.cs @@ -42,10 +42,15 @@ static class Mono public static void Frame() { + if (Rig.btn_trigger.delta == +1) + { + menu = !menu; + } + // flatscreen dev controls if (Device.Name == "Simulator") { - if (Input.Key(Key.MouseLeft).IsActive()) + if (Input.Key(Key.MouseCenter).IsActive()) { float sx = Maths.s_scalar(Input.Mouse.pos.x / 640); float ssx = Maths.smooth_start(sx); diff --git a/src/Rig.cs b/src/Rig.cs index cac778d..dddff57 100644 --- a/src/Rig.cs +++ b/src/Rig.cs @@ -6,6 +6,8 @@ static class Rig { public static Pose head = Pose.Identity; + public static DeltaBool btn_trigger = new(false); + public static Vec3 fullstick = Vec3.Up; public static Pose r_con_stick = Pose.Identity; @@ -23,19 +25,22 @@ static class Rig // flatscreen dev controls if (Device.Name == "Simulator") { + btn_trigger.Step(Input.Key(Key.MouseLeft).IsActive()); + if (Input.Key(Key.A).IsJustActive()) new_dir = new(-1, 0, 0); if (Input.Key(Key.S).IsJustActive()) new_dir = new(+1, 0, 0); if (Input.Key(Key.W).IsJustActive()) new_dir = new(0, 0, -1); if (Input.Key(Key.R).IsJustActive()) new_dir = new(0, 0, +1); if (Input.Key(Key.Shift).IsJustActive()) new_dir = new(0, -1, 0); if (Input.Key(Key.Space).IsJustActive()) new_dir = new(0, +1, 0); - fullstick = new_dir.ToVec3; } else { Hand r_hand = Input.Hand(Handed.Right); Controller r_con = Input.Controller(Handed.Right); + btn_trigger.Step(r_con.trigger > 0.5f); + bool con_tracked = r_con.trackedPos > TrackState.Lost; Input.HandVisible(Handed.Max, !con_tracked); if (con_tracked)