sokol/debugtext
sokol_debugtext
Types
8Allocator
Allocator :: struct {
alloc_fn: proc(a0: c.size_t, a1: rawptr) -> (rawptr),
a0: c.size_t,
size_t: rawptr,
a1: rawptr,
free_fn: proc(a0: rawptr, a1: rawptr),
a0: rawptr,
a1: rawptr,
user_data: rawptr,
}Sourcesdtx_allocator_t
Used in sdtx_desc_t to provide custom memory-alloc and -free functions to sokol_debugtext.h. If memory management should be overridden, both the alloc_fn and free_fn function must be provided (e.g. it's not valid to override one function but not the other).
Context
Context :: struct {
id: u32,
}Sourcea rendering context handle
Context_Desc
Context_Desc :: struct {
max_commands: c.int,
char_buf_size: c.int,
canvas_width: f32,
canvas_height: f32,
tab_width: c.int,
color_format: sg.Pixel_Format,
depth_format: sg.Pixel_Format,
sample_count: c.int,
}Sourcesdtx_context_desc_t
Describes the initialization parameters of a rendering context. Creating additional rendering contexts is useful if you want to render in different sokol-gfx rendering passes, or when rendering several layers of text.
Desc
Desc :: struct {
context_pool_size: c.int,
printf_buf_size: c.int,
fonts: [8]Font_Desc,
ctx: Context_Desc,
allocator: Allocator,
logger: Logger,
}Sourcesdtx_desc_t
Describes the sokol-debugtext API initialization parameters. Passed to the sdtx_setup() function.
NOTE: to populate the fonts item array with builtin fonts, use any of the following functions:
sdtx_font_kc853() sdtx_font_kc854() sdtx_font_z1013() sdtx_font_cpc() sdtx_font_c64() sdtx_font_oric()
Font_Desc
Font_Desc :: struct {
data: Range,
first_char: u8,
last_char: u8,
}SourceLog_Item
Log_Item :: enum i32 {
OK = 0,
MALLOC_FAILED = 1,
ADD_COMMIT_LISTENER_FAILED = 2,
COMMAND_BUFFER_FULL = 3,
CONTEXT_POOL_EXHAUSTED = 4,
CANNOT_DESTROY_DEFAULT_CONTEXT = 5,
}SourceLogger
Logger :: struct {
func: proc(
a0: cstring,
a1: u32,
a2: u32,
a3: cstring,
a4: u32,
a5: cstring,
a6: rawptr,
),
a0: cstring,
a1: u32,
a2: u32,
a3: cstring,
a4: u32,
a5: cstring,
a6: rawptr,
user_data: rawptr,
}Sourcesdtx_logger_t
Used in sdtx_desc_t to provide a custom logging and error reporting callback to sokol-debugtext.
Range
Range :: struct {
ptr: rawptr,
size: c.size_t,
}Sourcesdtx_range is a pointer-size-pair struct used to pass memory blobs into sokol-debugtext. When initialized from a value type (array or struct), use the SDTX_RANGE() macro to build an sdtx_range struct.
Constants
4DEBUG
DEBUG :: _ = #config(SOKOL_DEBUGTEXT_DEBUG, SOKOL_DEBUG)SourceSOKOL_DEBUG
SOKOL_DEBUG :: _ = #config(SOKOL_DEBUG, ODIN_DEBUG)SourceUSE_DLL
USE_DLL :: _ = #config(SOKOL_DLL, false)SourceUSE_GL
USE_GL :: _ = #config(SOKOL_USE_GL, false)Source