Пример #1
0
        public void ResetContext(GraphicsDevice gd, OutputDescription outputDescription)
        {
            var context = ImGui.GetCurrentContext();

            if (context != IntPtr.Zero)
            {
                ImGui.DestroyContext(context);
            }
            context = ImGui.CreateContext();
            ImGui.SetCurrentContext(context);

            ImGui.GetIO().Fonts.AddFontDefault();

            CreateDeviceResources(gd, outputDescription);
            SetOpenTKKeyMappings();

            SetPerFrameImGuiData(1f / 60f);

            ImGui.GetIO().ConfigFlags |= ImGuiConfigFlags.DockingEnable;
            ImGui.GetIO().ConfigWindowsResizeFromEdges      = true;
            ImGui.GetIO().ConfigWindowsMoveFromTitleBarOnly = true;
        }
Пример #2
0
        /// <summary>
        /// Constructs a new ImGuiRenderer.
        /// </summary>
        /// <param name="gd">The GraphicsDevice used to create and update resources.</param>
        /// <param name="outputDescription">The output format.</param>
        /// <param name="width">The initial width of the rendering target. Can be resized.</param>
        /// <param name="height">The initial height of the rendering target. Can be resized.</param>
        /// <param name="colorSpaceHandling">Identifies how the renderer should treat vertex colors.</param>
        public ImGuiRenderer(GraphicsDevice gd, OutputDescription outputDescription, int width, int height, ColorSpaceHandling colorSpaceHandling)
        {
            _gd                 = gd;
            _assembly           = typeof(ImGuiRenderer).GetTypeInfo().Assembly;
            _colorSpaceHandling = colorSpaceHandling;
            _windowWidth        = width;
            _windowHeight       = height;

            IntPtr context = ImGui.CreateContext();

            ImGui.SetCurrentContext(context);

            ImGui.GetIO().Fonts.AddFontDefault();

            CreateDeviceResources(gd, outputDescription);
            SetOpenTKKeyMappings();

            SetPerFrameImGuiData(1f / 60f);

            ImGui.NewFrame();
            _frameBegun = true;
        }
Пример #3
0
 /// <summary>
 /// Constructs a new ImGuiRenderer.
 /// </summary>
 /// <param name="gd">The GraphicsDevice used to create and update resources.</param>
 /// <param name="outputDescription">The output format.</param>
 /// <param name="width">The initial width of the rendering target. Can be resized.</param>
 /// <param name="height">The initial height of the rendering target. Can be resized.</param>
 public ImGuiRenderer(GraphicsDevice gd, OutputDescription outputDescription, int width, int height)
     : this(gd, outputDescription, width, height, ColorSpaceHandling.Legacy)
 {
 }
Пример #4
0
 public void CreateDeviceResources(GraphicsDevice gd, OutputDescription outputDescription)
 => CreateDeviceResources(gd, outputDescription, _colorSpaceHandling);
Пример #5
0
 /// <summary>
 /// Constructs a new ImGuiRenderer.
 /// </summary>
 /// <param name="gd">The GraphicsDevice used to create and update resources.</param>
 /// <param name="outputDescription">The output format.</param>
 /// <param name="width">The initial width of the rendering target. Can be resized.</param>
 /// <param name="height">The initial height of the rendering target. Can be resized.</param>
 /// <param name="outputLinear">Indicates whether the fragment shader should write linear RGB data.
 public ImGuiRenderer(GraphicsDevice gd, OutputDescription outputDescription, int width, int height)
     : this(gd, outputDescription, width, height, false)
 {
 }
Пример #6
0
 public void CreateDeviceResources(GraphicsDevice gd, OutputDescription outputDescription)
 => CreateDeviceResources(gd, outputDescription, _outputLinear);