BryanChi / BryanChi-FX-Devices

6 stars 3 forks source link

Changing value font size crashes #60

Open Suzuki-Re opened 3 months ago

Suzuki-Re commented 3 months ago

Changing value font size in the layout editor crashes.

...s\FX Devices\BryanChi_FX_Devices\BryanChi_FX Devices.lua:1325: ImGui_Attach: cannot modify font texture: a frame has already begun
Suzuki-Re commented 3 months ago

Kinda related to the topic.

for i = 6, 64, 1 do
        im.Attach(ctx, _G['Font_Andale_Mono_' .. i])
    end

I guess you load 58 fonts because you want users to choose text font size in the layout editor, right? It's quite excessive and memory hog as cifillion said in the ReaImGui thread. If you want to manipulate font size, then im.DrawList_AddTextEx(draw_list, font, font_size, pos_x, pos_y, col_rgba, text, optional_wrap_widthIn, optional_cpu_fine_clip_rect_xIn, optional_cpu_fine_clip_rect_yIn, optional_cpu_fine_clip_rect_wIn, optional_cpu_fine_clip_rect_hIn) is better than im.Text in my opinion because it lets you to decide font_size, color, wrap etc. Maybe we can even add font option. I thought of replacing MyText(text, font, color, WrapPosX) function with AddTextEx to see if it works well, but I'm not sure about the position part so leave it as it is for now. What do you think?