You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to port over to C# ocornut's 'ImDrawList' test bench (see here: ocornut/imgui#3606).
I'm retrieving the window draw list with ImGui.GetWindowDrawList() and then using primitives on the resulting draw list. However, I can't seem to get results displayed.
Here is the code I'm using based on ImGui.NET.SampleProgram: I replaced SubmitUI but the rest of the code is the same:
privatestaticunsafevoidSubmitUI(){// See (https://gist.github.com/ocornut/51367cc7dfd2c41d607bb0acfa6caf66)_=ImGui.Begin("FX",ImGuiWindowFlags.AlwaysAutoResize);ImGui.Text("BEFORE");varsize=newVector2(320f,180f);_=ImGui.InvisibleButton("canvas",size);varp0=ImGui.GetItemRectMin();varp1=ImGui.GetItemRectMax();vardrawList=ImGui.GetWindowDrawList();drawList.PushClipRect(p0,p1);vario=ImGui.GetIO();varmouseData=newVector4{X=(io.MousePos.X-p0.X)/size.X,Y=(io.MousePos.Y-p0.Y)/size.Y,Z=io.MouseDownDuration[0],W=io.MouseDownDuration[1]};//drawList.AddRectFilled(p0, p1, MakeColor32(255, 0, 0, 255));Fx(drawList,p0,p1,size,mouseData,(float)ImGui.GetTime());drawList.PopClipRect();ImGui.Text("AFTER");ImGui.End();}privatestaticvoidFx(ImDrawListPtrd,Vector2a,Vector2b,Vector2sz,Vector4mouse,floatt){for(varn=0;n<(1.0f+Math.Sin(t*5.7f))*40.0f;n++)d.AddCircle(newVector2(a.X+sz.X*0.5f,a.Y+sz.Y*0.5f),sz.Y*(0.01f+n*0.03f),MakeColor32(255,(byte)(140-n*4),(byte)(n*3),255));}privatestaticuintMakeColor32(intr,intg,intb,inta)=>(uint)((byte)a<<24&(byte)b<<16&(byte)g<<8&(byte)r);
All that I obtain is an empty placeholder:
Any idea why this does not work?
Thanks!
The text was updated successfully, but these errors were encountered:
@zaafar Thank you... By examining your implementation and comparing it with mine, I saw that all my & should be replaced by | then I saw your second suggestion: that is exactly what I ended up with!
I feel ashamed for having got mixed up between AND and OR... no wonder my code didn't work, I was drawing everything with a transparent color :(
Thanks again!
I'm trying to port over to C# ocornut's 'ImDrawList' test bench (see here: ocornut/imgui#3606).
I'm retrieving the window draw list with
ImGui.GetWindowDrawList()
and then using primitives on the resulting draw list. However, I can't seem to get results displayed.Here is the code I'm using based on
ImGui.NET.SampleProgram
: I replacedSubmitUI
but the rest of the code is the same:All that I obtain is an empty placeholder:
Any idea why this does not work?
Thanks!
The text was updated successfully, but these errors were encountered: