update sokol to latest

This commit is contained in:
2025-08-09 09:49:40 -04:00
parent 4ac28655b8
commit 8ed60cca33
58 changed files with 39 additions and 11 deletions
+2 -2
View File
@@ -236,8 +236,8 @@ init :: proc "c" ()
ve.startup( & demo_ctx.ve_ctx, .STB_TrueType, allocator = context.allocator, ve.startup( & demo_ctx.ve_ctx, .STB_TrueType, allocator = context.allocator,
glyph_draw_params = glyph_draw_opts, glyph_draw_params = glyph_draw_opts,
shaper_params = shaper_opts, shaper_params = shaper_opts,
px_scalar = 1.4, px_scalar = 1.21,
alpha_sharpen = 0.1, alpha_sharpen = 0.09,
) )
ve_sokol.setup_gfx_objects( & demo_ctx.render_ctx, & demo_ctx.ve_ctx, vert_cap = 256 * 1024, index_cap = 512 * 1024 ) ve_sokol.setup_gfx_objects( & demo_ctx.render_ctx, & demo_ctx.ve_ctx, vert_cap = 256 * 1024, index_cap = 512 * 1024 )
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+16 -5
View File
@@ -2664,6 +2664,7 @@ typedef struct {
HICON small_icon; HICON small_icon;
HCURSOR cursors[_SAPP_MOUSECURSOR_NUM]; HCURSOR cursors[_SAPP_MOUSECURSOR_NUM];
UINT orig_codepage; UINT orig_codepage;
WCHAR surrogate;
RECT stored_window_rect; // used to restore window pos/size when toggling fullscreen => windowed RECT stored_window_rect; // used to restore window pos/size when toggling fullscreen => windowed
bool is_win10_or_greater; bool is_win10_or_greater;
bool in_create_window; bool in_create_window;
@@ -7558,11 +7559,20 @@ _SOKOL_PRIVATE void _sapp_win32_key_event(sapp_event_type type, int vk, bool rep
_SOKOL_PRIVATE void _sapp_win32_char_event(uint32_t c, bool repeat) { _SOKOL_PRIVATE void _sapp_win32_char_event(uint32_t c, bool repeat) {
if (_sapp_events_enabled() && (c >= 32)) { if (_sapp_events_enabled() && (c >= 32)) {
_sapp_init_event(SAPP_EVENTTYPE_CHAR); if (c >= 0xD800 && c <= 0xDBFF) {
_sapp.event.modifiers = _sapp_win32_mods(); _sapp.win32.surrogate = (WCHAR)c - 0xD800;
_sapp.event.char_code = c; } else {
_sapp.event.key_repeat = repeat; if (c > 0xDC00 && c <= 0xDFFF) {
_sapp_call_event(&_sapp.event); c = (uint32_t)(_sapp.win32.surrogate) << 10 | (c - 0xDC00);
c += 0x10000;
_sapp.win32.surrogate = 0;
}
_sapp_init_event(SAPP_EVENTTYPE_CHAR);
_sapp.event.modifiers = _sapp_win32_mods();
_sapp.event.char_code = c;
_sapp.event.key_repeat = repeat;
_sapp_call_event(&_sapp.event);
}
} }
} }
@@ -7922,6 +7932,7 @@ _SOKOL_PRIVATE void _sapp_win32_create_window(void) {
const int win_width = rect.right - rect.left; const int win_width = rect.right - rect.left;
const int win_height = rect.bottom - rect.top; const int win_height = rect.bottom - rect.top;
_sapp.win32.in_create_window = true; _sapp.win32.in_create_window = true;
_sapp.win32.surrogate = 0;
_sapp.win32.hwnd = CreateWindowExW( _sapp.win32.hwnd = CreateWindowExW(
win_ex_style, // dwExStyle win_ex_style, // dwExStyle
L"SOKOLAPP", // lpClassName L"SOKOLAPP", // lpClassName
+13
View File
@@ -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_printf(const char* fmt, ...) SOKOL_DEBUGTEXT_PRINTF_ATTR;
SOKOL_DEBUGTEXT_API_DECL int sdtx_vprintf(const char* fmt, va_list args); 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 #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
/* C++ const-ref wrappers */ /* C++ const-ref wrappers */
@@ -4955,6 +4958,16 @@ SOKOL_DEBUGTEXT_API_DECL int sdtx_printf(const char* fmt, ...) {
return res; 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_API_IMPL void sdtx_draw(void) {
SOKOL_ASSERT(_SDTX_INIT_COOKIE == _sdtx.init_cookie); SOKOL_ASSERT(_SDTX_INIT_COOKIE == _sdtx.init_cookie);
_sdtx_context_t* ctx = _sdtx.cur_ctx; _sdtx_context_t* ctx = _sdtx.cur_ctx;
+2 -2
View File
@@ -254,8 +254,8 @@
Both sg_apply_viewport() and sg_apply_scissor_rect() must be called 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) 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 Note that sg_begin_pass() will reset both the viewport and scissor
viewport and scissor rectangles to cover the entire framebuffer. rectangles to cover the entire framebuffer.
--- to update (overwrite) the content of buffer and image resources, call: --- to update (overwrite) the content of buffer and image resources, call:
+2
View File
@@ -636,6 +636,8 @@ foreign sokol_debugtext_clib {
putc :: proc(c: u8) --- putc :: proc(c: u8) ---
puts :: proc(str: cstring) --- puts :: proc(str: cstring) ---
putr :: proc(str: cstring, #any_int len: c.int) --- putr :: proc(str: cstring, #any_int len: c.int) ---
// language bindings helper: get the internal printf format buffer
get_cleared_fmt_buffer :: proc() -> Range ---
} }
Log_Item :: enum i32 { Log_Item :: enum i32 {
+2 -2
View File
@@ -255,8 +255,8 @@ package sokol_gfx
Both sg_apply_viewport() and sg_apply_scissor_rect() must be called 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) 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 Note that sg_begin_pass() will reset both the viewport and scissor
viewport and scissor rectangles to cover the entire framebuffer. rectangles to cover the entire framebuffer.
--- to update (overwrite) the content of buffer and image resources, call: --- to update (overwrite) the content of buffer and image resources, call:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
View File
@@ -1253,6 +1253,8 @@ resolve_px_scalar_size :: #force_inline proc "contextless" ( parser_info : Parse
return return
} }
// Helps with hinting, makes sure glyph quads are aligned to an integer pixel
// Best if used in combination with snap_glyph_position, maybe snap_glyph_height,and snap_glyph_width.
snap_normalized_position_to_view :: #force_inline proc "contextless" ( position, view : Vec2 ) -> (position_snapped : Vec2) snap_normalized_position_to_view :: #force_inline proc "contextless" ( position, view : Vec2 ) -> (position_snapped : Vec2)
{ {
should_snap := cast(f32) i32(view.x > 0 && view.y > 0) should_snap := cast(f32) i32(view.x > 0 && view.y > 0)