示例#1
0
文件: Program.cs 项目: XAYRGA/Lovetap
        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);
            }
        }
示例#2
0
文件: Program.cs 项目: XAYRGA/Lovetap
        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();
        }