From 064b75603de791f33a5c034022acb8f2474681e7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 29 Jun 2025 16:47:30 +0200 Subject: sokol_imgui.h: fix some typos in updated doc sections --- util/sokol_imgui.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'util') diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 1dada3b3..d324d48d 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 ==================================== @@ -279,7 +282,7 @@ sg_image img = simgui_image_from_imtextureid(imtex_id); sg_sampler smp = simgui_sampler_from_imtextureid(imtex_id); - 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 -- cgit v1.2.3 From 7457cae7337d58f09f95294904321a5d5aa14230 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 15 Jul 2025 18:53:00 +0200 Subject: sokol_debugtext.h: expose the internal string-format buffer to language bindings (used by sokol-zig) --- util/sokol_debugtext.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'util') diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h index 826cf675..61759257 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 */ @@ -4955,6 +4958,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; -- cgit v1.2.3 From 23975003bca6f2d3865530fb0d32ac124db60bcc Mon Sep 17 00:00:00 2001 From: "Stian H. Johannesen" Date: Fri, 25 Jul 2025 16:27:27 +0200 Subject: remove references to sg_begin_default_pass --- sokol_gfx.h | 4 ++-- util/sokol_spine.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/sokol_gfx.h b/sokol_gfx.h index d3873b67..231ec586 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -254,8 +254,8 @@ Both sg_apply_viewport() and sg_apply_scissor_rect() must be called inside a rendering pass (e.g. not in a compute pass, or outside a pass) - Note that sg_begin_default_pass() and sg_begin_pass() will reset both the - viewport and scissor rectangles to cover the entire framebuffer. + Note that sg_begin_pass() will reset both the viewport and scissor + rectangles to cover the entire framebuffer. --- to update (overwrite) the content of buffer and image resources, call: diff --git a/util/sokol_spine.h b/util/sokol_spine.h index 1529774a..da488178 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -383,7 +383,7 @@ const sspine_layer_transform tform = { ... }; - sg_begin_default_pass(...); + sg_begin_pass(...); sspine_draw_layer(0, tform); sg_end_pass(); sg_commit(); -- cgit v1.2.3