aboutsummaryrefslogtreecommitdiff
path: root/util/sokol_debugtext.h
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/sokol_debugtext.h
parentfd5fc4455928b9822bad59e55346e9e1887a9b47 (diff)
parent4012bd599827c9721502a90eaa661249b156d09e (diff)
Merge branch 'master' into issue1252/resource_views
Diffstat (limited to 'util/sokol_debugtext.h')
-rw-r--r--util/sokol_debugtext.h13
1 files changed, 13 insertions, 0 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;