Exemplo n.º 1
0
        static void Main(string[] args)
        {
            /*
             * if (!ColliderCon.connect())
             * {
             *  Console.WriteLine("Cannot connect to ColliderconVR service.\nMake Sure VRChat is running and that ColliderCon is loaded");
             *  Console.ReadLine();
             *  Environment.Exit(-1);
             * }*/

            BTManager.rescanDevices();

            VeldridStartup.CreateWindowAndGraphicsDevice(
                new WindowCreateInfo(50, 50, 1024, 768, WindowState.Normal, "Lovetap"),
                new GraphicsDeviceOptions(true, null, true),
                out _window,
                out _gd);
            _window.Resized += () =>
            {
                _gd.MainSwapchain.Resize((uint)_window.Width, (uint)_window.Height);
                _controller.WindowResized(_window.Width, _window.Height);
            };

            _cl         = _gd.ResourceFactory.CreateCommandList();
            _controller = new ImGuiController(_gd, _gd.MainSwapchain.Framebuffer.OutputDescription, _window.Width, _window.Height);
            CollideSystem.updateColliders();
            StartUI();
            // CollideSystem.colliders.Add(new WatchedCollider(CollideSystem.getColliderByName("celhandleft"), CollideSystem.getColliderByName("celhandright")));
            while (_window.Exists)
            {
                InputSnapshot snapshot = _window.PumpEvents();
                if (!_window.Exists)
                {
                    break;
                }
                _controller.Update(1f / 60f, snapshot); // Feed the input events to our ImGui controller, which passes them through to ImGui.

                SubmitUI();

                _cl.Begin();
                _cl.SetFramebuffer(_gd.MainSwapchain.Framebuffer);
                _cl.ClearColorTarget(0, new RgbaFloat(_clearColor.X, _clearColor.Y, _clearColor.Z, 1f));
                _controller.Render(_gd, _cl);
                _cl.End();
                _gd.SubmitCommands(_cl);
                _gd.SwapBuffers(_gd.MainSwapchain);
            }
        }
Exemplo n.º 2
0
        public static unsafe void SubmitUI()
        {
            Interface.submit();
            CollideSystem.updateColliders();

            var nps = false;

            foreach (var colcheck in CollideSystem.colliders)
            {
                if (colcheck.tripped)
                {
                    nps = true;
                }
            }

            if (nps == false)
            {
                BTManager.setPlugIntensity(0);
            }
            else
            {
                BTManager.setPlugIntensity(100);
            }

            /*
             *
             * ImGui.Begin("asd");
             * var DrawList = ImGui.GetWindowDrawList();
             * foreach (var w in CollideSystem.colliders)
             * {
             *  var cc = w.rfirst;
             *  var cc1 = w.rsecond;
             *  var col = 0xFF0000FF;
             *  if (w.tripped==true)
             *  {
             *      col = 0xFF00FF00;
             *  }
             *  DrawList.AddCircleFilled(new Vector2(cc.position.X * 20 + 600, cc.position.Z * 20 + 382), 5, col);
             *  DrawList.AddCircleFilled(new Vector2(cc1.position.X * 20 + 600, cc1.position.Z * 20 + 382), 5, col);
             * }
             */

            ImGui.End();
        }
Exemplo n.º 3
0
        public static void submit()
        {
            ImGui.SetNextWindowPos(new Vector2(0, 0));
            ImGui.SetNextWindowSize(new Vector2(340, 200));
            ImGui.Begin("Bluetooth Control");
            {
                if (BTManager.selectedDevice == null)
                {
                    var DrawList = ImGui.GetWindowDrawList();
                    ImGui.ListBox("Paired Devices", ref btSelIndex, BTManager.pairdDevicesNames, BTManager.pairdDevicesNames.Length);
                    if (ImGui.Button("Rescan Devices"))
                    {
                        BTManager.rescanDevices();
                    }
                    if (!BTManager.connecting)
                    {
                        if (ImGui.Button("Use Device"))
                        {
                            BTManager.connectDevice(BTManager.pairedDevices[btSelIndex]);
                        }
                    }
                    else
                    {
                        ImGui.Text("Connecting....");
                    }

                    if (BTManager.scanning)
                    {
                        ImGui.LabelText("Scanning...", "");
                    }
                }
                else
                {
                    ImGui.Text($"Using Device: {BTManager.selectedDevice.Name}");
                }
            }
            ImGui.End();

            ImGui.SetNextWindowPos(new Vector2(340, 0));
            ImGui.SetNextWindowSize(new Vector2(200, 200));
            ImGui.Begin("VRC Collider Detection");
            if (!ColliderCon.ready)
            {
                ImGui.Text("Not connected.");
                if (ImGui.Button("Connect to VRC"))
                {
                    ColliderCon.connect();
                }
                ImGui.Text(ColliderCon.error);
            }
            else
            {
                ImGui.Text("Connected to collider system.");
            }
            ImGui.End();
            ImGui.SetNextWindowPos(new Vector2(0, 200));
            ImGui.SetNextWindowSize(new Vector2(540, 400));
            if (ColliderCon.ready)
            {
                ImGui.Begin("Add Collider Check");
                if (ImGui.Button("Refresh Colliders"))
                {
                    refreshColliderList();
                }
                ImGui.Combo("First Collider", ref c1sel, colliderNames, colliderNames.Length);
                ImGui.Combo("Second Collider", ref c2sel, colliderNames, colliderNames.Length);
                if (ImGui.Button("Add Collider Check"))
                {
                    var c1 = CollideSystem.getColliderByName(colliderBaseList[c1sel].name);
                    var c2 = CollideSystem.getColliderByName(colliderBaseList[c2sel].name);
                    if (c1 == null || c2 == null)
                    {
                        return;
                    }

                    CollideSystem.colliders.Add(new WatchedCollider(c1, c2));
                    refreshWatchedColliders();
                }

                ImGui.ListBox("Watched Colliders", ref cwlSelIndex, colliderWatchlistNames, colliderWatchlistNames.Length);
                if (ImGui.Button("Remove collider check"))
                {
                    CollideSystem.colliders.RemoveAt(cwlSelIndex);
                    refreshWatchedColliders();
                }
                ImGui.Text($"Current Toy Status: {BTManager.plugIntensity}");
                ImGui.End();
            }
        }