示例#1
0
        static void Main(string[] args)
        {
            AdbManager.Instance.Init();

            bool isWindows = System.Runtime.InteropServices.RuntimeInformation
                             .IsOSPlatform(OSPlatform.Windows);

            VeldridStartup.CreateWindowAndGraphicsDevice(
                new WindowCreateInfo(50, 50, 600, 400, WindowState.Normal, "LogMeow"),
                new GraphicsDeviceOptions(true, null, true),
                isWindows ? GraphicsBackend.Direct3D11 : GraphicsBackend.Metal,
                out window,
                out graphicDevice);

            window.Resized += () =>
            {
                graphicDevice.MainSwapchain.Resize((uint)window.Width, (uint)window.Height);
                guiRender.WindowResized(window.Width, window.Height);
            };
            commandList = graphicDevice.ResourceFactory.CreateCommandList();
            guiRender   = new ImGuiRenderer(graphicDevice, graphicDevice.MainSwapchain.Framebuffer.OutputDescription, window.Width, window.Height);

            window.Closed += () =>
            {
                Environment.Exit(0);
            };


            assembly = typeof(Program).Assembly;
            string[] names = assembly.GetManifestResourceNames();
            Console.WriteLine(String.Join(Environment.NewLine, names));
            LoadFont();

            // Main application loop
            while (window.Exists)
            {
                InputSnapshot snapshot = window.PumpEvents();
                if (!window.Exists)
                {
                    break;
                }
                guiRender.Update(1f / 60f, snapshot); // Feed the input events to our ImGui controller, which passes them through to ImGui.

                SubmitUI();
                Singleton <LogMeowWorkspaceView> .Instance.draw();

                commandList.Begin();
                commandList.SetFramebuffer(graphicDevice.MainSwapchain.Framebuffer);
                commandList.ClearColorTarget(0, new RgbaFloat(backgroundColor.X, backgroundColor.Y, backgroundColor.Z, 1f));
                guiRender.Render(graphicDevice, commandList);
                commandList.End();
                graphicDevice.SubmitCommands(commandList);
                graphicDevice.SwapBuffers(graphicDevice.MainSwapchain);
            }

            graphicDevice.WaitForIdle();
            guiRender.Dispose();
            commandList.Dispose();
            graphicDevice.Dispose();
        }
示例#2
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);

            scene.Dispose();
            imguiRenderer.Dispose();
            ImGui.DestroyContext();
        }
        public override void DestroyDeviceObjects(ResourceScope scope)
        {
            if ((scope & ResourceScope.Global) == 0)
            {
                return;
            }

            _imguiRenderer.Dispose();
        }
示例#4
0
 public void Dispose()
 {
     imGuiRenderer.Dispose();
     pipeline?.Dispose();
     DisposeShaders();
     resourceSet?.Dispose();
     resourceLayout?.Dispose();
     DisposeTextures();
     commandList?.Dispose();
     runtimeDataBuffer?.Dispose();
     indexBuffer.Dispose();
     vertexBuffer.Dispose();
     graphicsDevice.Dispose();
 }
示例#5
0
        static void Main(string[] args)
        {
            _uiManager = new UiManager();

            // Create window, GraphicsDevice, and all resources necessary for the demo.
            VeldridStartup.CreateWindowAndGraphicsDevice(
                new WindowCreateInfo(50, 50, 1000, 720, WindowState.Normal, "FileDialog Demo"),
                new GraphicsDeviceOptions(true, null, true),
                out _window,
                out _gd);

            _window.Resized += _window_Resized;

            _cl = _gd.ResourceFactory.CreateCommandList();

            _controller = new ImGuiRenderer(_gd, _gd.MainSwapchain.Framebuffer.OutputDescription, _window.Width, _window.Height);

            ImGui.StyleColorsLight();

            // Main application loop
            while (_window.Exists)
            {
                InputSnapshot snapshot = _window.PumpEvents();
                if (!_window.Exists)
                {
                    break;
                }
                _controller.Update(1f / 60f, snapshot);

                SubmitUI();

                _cl.Begin();
                _cl.SetFramebuffer(_gd.MainSwapchain.Framebuffer);
                _cl.ClearColorTarget(0, new RgbaFloat(0.5f, 0.5f, 0.5f, 1f));
                _controller.Render(_gd, _cl);
                _cl.End();
                _gd.SubmitCommands(_cl);
                _gd.SwapBuffers(_gd.MainSwapchain);
            }

            // Clean up Veldrid resources
            _gd.WaitForIdle();
            _controller.Dispose();
            _cl.Dispose();
            _gd.Dispose();
        }
示例#6
0
 public override void DestroyDeviceObjects()
 {
     _imguiRenderer.Dispose();
 }
示例#7
0
文件: Ui.cs 项目: darkfriend77/wom
 public void Shutdown()
 {
     _renderer.Render -= RenderCallback;
     _imguiRenderer.Dispose();
     _imguiRenderer = null;
 }
示例#8
0
 public void DestroyDeviceObjects()
 {
     _imguiRenderer?.Dispose();
 }
示例#9
0
 public void Dispose()
 {
     _imguiRenderer?.Dispose();
     _imguiRenderer = null;
 }
示例#10
0
 public void Destroy()
 {
     _imGuiRenderer.Dispose();
 }
示例#11
0
 public void Dispose()
 {
     imGuiRenderer.Dispose();
 }
示例#12
0
 public void Dispose()
 {
     _imguiRenderer.Dispose();
     _cl.Dispose();
 }