aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2022-11-14 15:13:09 +0100
committerAndre Weissflog <floooh@gmail.com>2022-11-14 15:13:09 +0100
commit9c38988a4b9e11182e2ddf08c4d64553d8c99ace (patch)
treedcd019de3e9c702fc325316c9ae13a4d3cf29f2b
parent2884a73cb6821cb70576b53d82187e9a55650683 (diff)
sokol_debugtext.h: add missing draw functions, some doc tweaks
-rw-r--r--util/sokol_debugtext.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h
index cd31175b..574b0af2 100644
--- a/util/sokol_debugtext.h
+++ b/util/sokol_debugtext.h
@@ -224,10 +224,14 @@
sdtx_draw()
- ...to actually render the text. Calling sdtx_draw() will also rewind
- the text context:
+ ...to actually render the text.
- - the internal vertex buffer pointer is reset to the beginning
+ --- at the end of a frame (defined by the call to sg_commit()), sokol-debugtext
+ will rewind all contexts:
+
+ - the internal vertex index is set to 0
+ - the internal command index is set to 0
+ - the current layer id is set to 0
- the current font is set to 0
- the cursor position is reset
@@ -4476,4 +4480,27 @@ SOKOL_API_IMPL void sdtx_draw(void) {
}
}
+SOKOL_API_IMPL void sdtx_context_draw(sdtx_context ctx_id) {
+ SOKOL_ASSERT(_SDTX_INIT_COOKIE == _sdtx.init_cookie);
+ _sdtx_context_t* ctx = _sdtx_lookup_context(ctx_id.id);
+ if (ctx) {
+ _sdtx_draw_layer(ctx, 0);
+ }
+}
+
+SOKOL_API_IMPL void sdtx_draw_layer(int layer_id) {
+ SOKOL_ASSERT(_SDTX_INIT_COOKIE == _sdtx.init_cookie);
+ _sdtx_context_t* ctx = _sdtx.cur_ctx;
+ if (ctx) {
+ _sdtx_draw_layer(ctx, layer_id);
+ }
+}
+
+SOKOL_API_IMPL void sdtx_context_draw_layer(sdtx_context ctx_id, int layer_id) {
+ SOKOL_ASSERT(_SDTX_INIT_COOKIE == _sdtx.init_cookie);
+ _sdtx_context_t* ctx = _sdtx_lookup_context(ctx_id.id);
+ if (ctx) {
+ _sdtx_draw_layer(ctx, layer_id);
+ }
+}
#endif /* SOKOL_DEBUGTEXT_IMPL */