Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sokol_imgui.h: Automatically re-build sokol-gfx resources when Dear ImGui font data has changed. #1010

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions util/sokol_imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -2369,13 +2369,6 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) {
def_image_desc.label = "sokol-imgui-default-image";
_simgui.def_img = sg_make_image(&def_image_desc);

// default font texture
if (!_simgui.desc.no_default_font) {
simgui_font_tex_desc_t simgui_font_smp_desc;
_simgui_clear(&simgui_font_smp_desc, sizeof(simgui_font_smp_desc));
simgui_create_fonts_texture(&simgui_font_smp_desc);
}

elloramir marked this conversation as resolved.
Show resolved Hide resolved
sg_pop_debug_group();
}

Expand Down Expand Up @@ -2515,6 +2508,11 @@ SOKOL_API_IMPL void simgui_new_frame(const simgui_frame_desc_t* desc) {
#else
ImGuiIO* io = igGetIO();
#endif
if (!io->Fonts->TexReady) {
simgui_font_tex_desc_t simgui_font_smp_desc;
_simgui_clear(&simgui_font_smp_desc, sizeof(simgui_font_smp_desc));
simgui_create_fonts_texture(&simgui_font_smp_desc);
}
elloramir marked this conversation as resolved.
Show resolved Hide resolved
io->DisplaySize.x = ((float)desc->width) / _simgui.cur_dpi_scale;
io->DisplaySize.y = ((float)desc->height) / _simgui.cur_dpi_scale;
io->DeltaTime = (float)desc->delta_time;
Expand Down
Loading