Hexa.NET.ImGui icon indicating copy to clipboard operation
Hexa.NET.ImGui copied to clipboard

How to use ImDrawCallback_ResetRenderState?

Open RoccoZero opened this issue 3 months ago • 3 comments

draw_list->AddCallback(ImDrawCallback_ResetRenderState, nullptr); It seems this method won't work because we only have the ImDrawCallback delegate in our parameters. We need another method that will have this native parameter "delegate*<ImDrawList*, ImDrawCmd*, void> callback"

Image

RoccoZero avatar Oct 18 '25 06:10 RoccoZero

Hi, could you give more information about what exactly you mean, because i don't understand what you mean. And you can very well use those methods, you just have to use the NativeCallback helper from HexaGen.Runtime (which is available if you installed any Hexa.NET package)

JunaMeinhold avatar Oct 18 '25 06:10 JunaMeinhold

I want to say that it is impossible to use ImGui.ImDrawCallbackResetRenderState because of the managed delegate

var draw_list = ImGui.GetWindowDrawList();
draw_list.AddDrawCmd();
draw_list.AddCallback(ImGui_ImplBlur_Begin, null);
draw_list.AddCallback(ImGui_ImplBlur_Pass, paramss);
draw_list.AddCallback(ImGui_ImplBlur_End, null);
draw_list.AddCallback(ImGui.ImDrawCallbackResetRenderState, null, 0);

https://github.com/itsRythem/DX11-ImGui-Kawase-Blur/blob/main/imgui_impl_blur.cpp#L403

RoccoZero avatar Oct 18 '25 10:10 RoccoZero

we need these methods

class ImGui
{
    public unsafe static void AddCallback(ImDrawListPtr self, delegate*<ImDrawList*, ImDrawCmd*, void> callback, void* userdata, nuint userdataSize);
}
struct ImDrawListPtr
{
    public unsafe void AddCallback(delegate*<ImDrawList*, ImDrawCmd*, void> callback, void* userdata, nuint userdataSize);
}
struct ImDrawList
{
    public unsafe void AddCallback(delegate*<ImDrawList*, ImDrawCmd*, void> callback, void* userdata, nuint userdataSize);
}

RoccoZero avatar Oct 18 '25 11:10 RoccoZero