Closed Hirashi3630 closed 2 years ago
Hello there.
Sorry, at the moment I'm trying to make a version to MacOS, so I don't have access to a windows OS and I can't test.
The syntax looks fine. What's happening? Nothing?
Could you test the code below please?
private void OnLayout(UImGui.UImGui obj)
{
if (!ImGui.Begin("Draw list", ref isOpen)) return;
var drawList = ImGui.GetWindowDrawList();
drawList.AddRectFilled(Vector2.zero, Vector2.one * 10, 6528);
drawList.AddRectFilled(Vector2.one, Vector2.one * 20, 4278190335);
drawList.AddRectFilled(ImGui.GetCursorPos(), ImGui.GetCursorPos() * 10, 16711680);
drawList.AddRectFilled(ImGui.GetCursorPos() * - 10, ImGui.GetCursorPos(), 4278190335);
ImGui.End();
}
Sure thing! Thanks for looking into this!
I tried your code but nothing seems appear.
for some reason ImGui.ShowDemoWindow()
custom drawing example works just fine though
I don't know if it's necessary to use ImGui.InvisibleButton()
.
I just replicate the whole code showwing the gradient on custom rendering window.
if (!ImGui.Begin("Draw list", ref isOpen)) return;
ImGui.PushItemWidth(-ImGui.GetFontSize() * 15);
var drawList = ImGui.GetWindowDrawList();
ImGui.Text("Gradients");
var gradientSize = new Vector2(ImGui.CalcItemWidth(), ImGui.GetFrameHeight());
//gradient 1
{
var p0 = ImGui.GetCursorScreenPos();
var p1 = new Vector2(p0.x + gradientSize.x, p0.y + gradientSize.y);
var colorA = ImGui.GetColorU32(new Vector4(0, 0, 0, 255));
var colorB = ImGui.GetColorU32(new Vector4(255, 255, 255, 255));
drawList.AddRectFilledMultiColor(p0, p1, colorA, colorB, colorB, colorA);
ImGui.InvisibleButton("##gradient1", gradientSize);
}
// gradient 2
{
var p0 = ImGui.GetCursorScreenPos();
var p1 = new Vector2(p0.x + gradientSize.x, p0.y + gradientSize.y);
var colorA = ImGui.GetColorU32(new Vector4(0, 255, 0, 255));
var colorB = ImGui.GetColorU32(new Vector4(255, 0, 0, 255));
drawList.AddRectFilledMultiColor(p0, p1, colorA, colorB, colorB, colorA);
ImGui.InvisibleButton("##gradient2", gradientSize);
}
const float sz = 36f;
const float spacing = 10f;
const float value = sz + spacing;
ImGui.Dummy(new Vector2(value * 10.2f, value * 3.0f));
ImGui.PopItemWidth();
ImGui.End();
I never tried to do custom rendering stuffs. It appears to be a bug. Later this month I probably have a functional cimgui working on mac. So, after that I will give a shoot to go deeper.
Thanks for reporting it.
It seems to need ImGui.InvisibleButton()
to render properly
Anyway I will try to play with it more and keep you updated if I make it work!
Cheers!
Nice. Awesome to know that works. In the end wasn’t a bug .
;)
I tried recreating what
imgui_demo.cpp
showsbut no luck... I'm not sure if I'm doing something wrong or if it's a bug.
Unity 2020.3.25.f1 ImGUI 1.84 WIP uimgui 4.1.0