protected UICanvas(GraphicsDevice gd, ImGuiView imGuiView, Func <Vector2> computeSize) { ComputeSize = computeSize; ImGuiView = imGuiView; GraphicsDevice = gd; Canvas = MakeCanvasFrom(8, 8); imageBind = ImGuiView.GetOrCreateImGuiBinding(Factory, Canvas.TextureView); }
public virtual void Render(CommandList cl) { var imgSize = ComputeSize(); int IntImageSizeX = (int)Math.Floor(imgSize.X); int IntImageSizeY = (int)Math.Floor(imgSize.Y); if (Canvas.Width != IntImageSizeX || Canvas.Height != IntImageSizeY) { Canvas = MakeCanvasFrom(IntImageSizeX, IntImageSizeY); imageBind = ImGuiView.GetOrCreateImGuiBinding(Factory, Canvas.TextureView); } ImGui.Image(imageBind, new Vector2(IntImageSizeX, IntImageSizeY)); ProcessInputs(); RenderToCanvas(cl); }