Пример #1
0
        protected override void OnAttached()
        {
            previousTime = TimeSpan.Zero;
            IntPtr context = ImGui.CreateContext();

            ImGui.SetCurrentContext(context);
            ImGui.GetIO().Fonts.AddFontDefault();
            bufferModel = Collect(new ImGui2DBufferModel());
            (RenderCore as ImGuiRenderCore).Buffer = bufferModel;
            var io = ImGui.GetIO();

            unsafe
            {
                io.Fonts.GetTexDataAsRGBA32(out IntPtr textureData, out var width, out var height);
                var textureView = Collect(new ShaderResourceViewProxy(EffectsManager.Device));
                textureView.CreateView(textureData, width, height,
                                       Format.R8G8B8A8_UNorm);
                io.Fonts.SetTexID(fontAtlasID);
                io.Fonts.ClearTexData();
                (RenderCore as ImGuiRenderCore).TextureView = textureView;
            }
            ImGui.NewFrame();
            newFrame = true;
            base.OnAttached();
        }
Пример #2
0
        protected override void OnAttached()
        {
            bufferModel = Collect(new ImGui2DBufferModel());
            (RenderCore as ImGuiRenderCore).Buffer = bufferModel;
            var io = ImGui.GetIO();

            var textureData = io.FontAtlas.GetTexDataAsRGBA32();
            var textureView = Collect(new ShaderResourceViewProxy(EffectsManager.Device));

            unsafe
            {
                textureView.CreateView((IntPtr)textureData.Pixels, textureData.Width, textureData.Height,
                                       Format.R8G8B8A8_UNorm);
            }
            io.FontAtlas.SetTexID(1);
            io.FontAtlas.ClearTexData();
            (RenderCore as ImGuiRenderCore).TextureView = textureView;
            ImGui.NewFrame();
            base.OnAttached();
        }
Пример #3
0
 protected override void OnDetach()
 {
     bufferModel = null;
     (RenderCore as ImGuiRenderCore).TextureView = null;
     base.OnDetach();
 }