aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2025-08-03 15:48:30 +0200
committerAndre Weissflog <floooh@gmail.com>2025-08-03 15:48:30 +0200
commit01601be8ae3eeeb1468f592327d8aaddf6f60f9e (patch)
treea1cf9f6389733b5c3d13aa333555f572f1d0a8fc /util
parentfd5fc4455928b9822bad59e55346e9e1887a9b47 (diff)
parent4012bd599827c9721502a90eaa661249b156d09e (diff)
Merge branch 'master' into issue1252/resource_views
Diffstat (limited to 'util')
-rw-r--r--util/sokol_debugtext.h13
-rw-r--r--util/sokol_imgui.h13
-rw-r--r--util/sokol_spine.h2
3 files changed, 22 insertions, 6 deletions
diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h
index 8e990770..3cdb308c 100644
--- a/util/sokol_debugtext.h
+++ b/util/sokol_debugtext.h
@@ -753,6 +753,9 @@ SOKOL_DEBUGTEXT_API_DECL void sdtx_putr(const char* str, int len); // 'put ra
SOKOL_DEBUGTEXT_API_DECL int sdtx_printf(const char* fmt, ...) SOKOL_DEBUGTEXT_PRINTF_ATTR;
SOKOL_DEBUGTEXT_API_DECL int sdtx_vprintf(const char* fmt, va_list args);
+/* language bindings helper: get the internal printf format buffer */
+SOKOL_DEBUGTEXT_API_DECL sdtx_range sdtx_get_cleared_fmt_buffer(void);
+
#ifdef __cplusplus
} /* extern "C" */
/* C++ const-ref wrappers */
@@ -4964,6 +4967,16 @@ SOKOL_DEBUGTEXT_API_DECL int sdtx_printf(const char* fmt, ...) {
return res;
}
+SOKOL_DEBUGTEXT_API_DECL sdtx_range sdtx_get_cleared_fmt_buffer(void) {
+ SOKOL_ASSERT(_SDTX_INIT_COOKIE == _sdtx.init_cookie);
+ SOKOL_ASSERT(_sdtx.fmt_buf && (_sdtx.fmt_buf_size >= 2));
+ memset(_sdtx.fmt_buf, 0, _sdtx.fmt_buf_size);
+ sdtx_range res; _sdtx_clear(&res, sizeof(res));
+ res.ptr = _sdtx.fmt_buf;
+ res.size = _sdtx.fmt_buf_size - 1;
+ return res;
+}
+
SOKOL_API_IMPL void sdtx_draw(void) {
SOKOL_ASSERT(_SDTX_INIT_COOKIE == _sdtx.init_cookie);
_sdtx_context_t* ctx = _sdtx.cur_ctx;
diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h
index 9a8f07a1..935e7708 100644
--- a/util/sokol_imgui.h
+++ b/util/sokol_imgui.h
@@ -231,19 +231,22 @@
ON ATTACHING YOUR OWN FONTS
===========================
- Since Dear ImGui 1.92.0, using using non-default fonts has been greatly simplified:
+ Since Dear ImGui 1.92.0 using non-default fonts has been greatly simplified:
First, call `simgui_setup()` with the `.no_default_font` so that
sokol_imgui.h skips adding the default font.
...then simply call `AddFontDefault()` or `AddFontFromMemoryTTF()` on
- the Dear ImGui IO object.
+ the Dear ImGui IO object, everything else is taken care of automatically.
- Do *NOT*:
+ Specifically, do *NOT*:
- call the deprecated `GetTexDataAsRGBA32()` function
- - create a sokol-gfx image object for the font
+ - create a sokol-gfx image object for the font atlas
- set the `Font->TexID` on the ImGui IO object
+ All those things are now handled inside sokol_imgui.h via a new 'texture update'
+ callback which is called by Dear ImGui whenever the state of the font atlas
+ texture changes.
ON USER-PROVIDED IMAGES AND SAMPLERS
====================================
@@ -284,7 +287,7 @@
sg_image img = sg_query_view_image(tex_view);
- NOTE on C bindings since 1.92.0:
+ NOTE on C bindings since Dear ImGui 1.92.0:
Since Dear ImGui v1.92.0 the ImGui::Image function takes an
ImTextureRef object instead of ImTextureID. In C++ this doesn't
diff --git a/util/sokol_spine.h b/util/sokol_spine.h
index e24dc47d..0a9ed690 100644
--- a/util/sokol_spine.h
+++ b/util/sokol_spine.h
@@ -385,7 +385,7 @@
const sspine_layer_transform tform = { ... };
- sg_begin_default_pass(...);
+ sg_begin_pass(...);
sspine_draw_layer(0, tform);
sg_end_pass();
sg_commit();