aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2024-03-21 18:58:06 +0100
committerAndre Weissflog <floooh@gmail.com>2024-03-21 18:58:06 +0100
commit7d13a6715c48eba3cabc3fdd164708f73f4d27df (patch)
tree1035267cf308cb441b75e969feb177209bf53721
parent00c9072d40f7d19ae76b31867918a697f1c15ce4 (diff)
parent837b4765d6ba4360f04eb67abc5ea4c435ed3da4 (diff)
Merge branch 'elloramir-master'
-rw-r--r--CHANGELOG.md10
-rw-r--r--util/sokol_imgui.h6
2 files changed, 16 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6b0414e4..ef4a2b25 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,15 @@
## Updates
+### 21-Mar-2024:
+
+- sokol_imgui.h: merged PR https://github.com/floooh/sokol/pull/1010, this will automatically
+ re-create the sokol-gfx font texture resources in the `simgui_new_frame()` call
+ when the Dear ImGui texture atlas has changed. This is an alternative to calling the
+ functions `simgui_create_fonts_texture()` and `simgui_destroy_fonts_texture()` manually.
+ One important reason why you'd want to call those functions manually is to create the fonts texture
+ with custom texture sampler attributes (the new implicit re-creation inside `simgui_new_frame()`
+ calls `sg_make_sampler()` with default attributes).
+
### 02-Mar-2024:
- sokol_app.h emscripten: two new flags in `sapp_desc` to configure the Emscripten main loop:
diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h
index a1cb10d2..9f54686a 100644
--- a/util/sokol_imgui.h
+++ b/util/sokol_imgui.h
@@ -2521,6 +2521,12 @@ SOKOL_API_IMPL void simgui_new_frame(const simgui_frame_desc_t* desc) {
#else
ImGuiIO* io = igGetIO();
#endif
+ if (!io->Fonts->TexReady) {
+ simgui_destroy_fonts_texture();
+ 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);
+ }
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;