twostars / TZF

Tales of Zestiria "Fix" - Framerate, Render and Sound Fixes
GNU General Public License v2.0
0 stars 0 forks source link

"Tales Engine Texture Mod Toolkit" UI breaks input when rendering a D3D9 texture #2

Open twostars opened 2 months ago

twostars commented 2 months ago

For some reason, the ImGui::Image() call causes the strange effect of input to break. It's clearly receiving input, but the UIs do not respond to it (except to an ALT+TAB).

Notably, everything still renders and otherwise behaves fine, such that on a subsequent frame where that call isn't active, input is responsive again.

Seems to specifically be caused its internal "ItemSize()" call:

void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col)
{
    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return;

    ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
    if (border_col.w > 0.0f)
        bb.Max += ImVec2(2,2);
    ItemSize(bb);
    if (!ItemAdd(bb, NULL))
        return;

    if (border_col.w > 0.0f)
    {
        window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(border_col), 0.0f);
        window->DrawList->AddImage(user_texture_id, bb.Min+ImVec2(1,1), bb.Max-ImVec2(1,1), uv0, uv1, GetColorU32(tint_col));
    }
    else
    {
        window->DrawList->AddImage(user_texture_id, bb.Min, bb.Max, uv0, uv1, GetColorU32(tint_col));
    }
}