diff options
| author | Andre Weissflog <floooh@gmail.com> | 2024-10-25 15:50:39 +0200 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2024-10-25 15:50:39 +0200 |
| commit | abc9ecec84078243ac5fa7f6a7202124cb6d532f (patch) | |
| tree | 723ddecfa30734114b4114dd0a40a9dcd31b60c2 | |
| parent | e7d5229bffa902d911f7534e233154ad7a048ecd (diff) | |
| parent | 648961074400828d637f2415598ac09991d305c4 (diff) | |
Merge branch 'master' into issue1037_bindings_cleanup
| -rw-r--r-- | CHANGELOG.md | 30 | ||||
| -rw-r--r-- | bindgen/gen_jai.py | 3 | ||||
| -rw-r--r-- | sokol_app.h | 21 | ||||
| -rw-r--r-- | sokol_fetch.h | 8 | ||||
| -rw-r--r-- | util/sokol_imgui.h | 12 | ||||
| -rw-r--r-- | util/sokol_nuklear.h | 2 |
6 files changed, 57 insertions, 19 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cd53957..29af32ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ ## Updates +### 24-Oct-2024 + +- sokol_nuklear.h: Merged https://github.com/floooh/sokol/pull/1138 which + allows to use Nuklear's software mouse cursors. Many thanks to @dlannan! + +### 22-Oct-2024 + +- sokol_imgui.h: Fixed for latest Dear ImGui version 1.91.4 (Dear ImGui has + changed the ImTextureID handle from `void*` to `uint64_t` which requires some + minor fixes, also in the public API (so technically it's a breaking change + but it's unlikely that most code will be affected). + + Many thanks to @DctrNoob for the PR (https://github.com/floooh/sokol/pull/1134). + + Also related change if you're using fips: the following ImGui wrapper repos + have been updated to 1.91.4: + + - https://github.com/fips-libs/fips-imgui + - https://github.com/fips-libs/fips-cimgui + - https://github.com/fips-libs/fips-imgui-dock + + PS: This Dear ImGui change will also allow to remove a lot of complexity + from sokol_imgui again which was necessary after the image/sampler split + in sokol_gfx.h. Since ImTextureID is now guaranteed to be 64-bits (even when + the pointer size is 32-bits like on WASM), it's possible to stash the sokol-gfx + image- and sampler-handles (which are 32-bits each) directly into the 64-bit + ImTextureID instead of maintaining an internal object in sokol_imgui.h just + to associate a sokol-gfx image handle with a sampler handle. That's for a later + time though :) + ### 14-Oct-2024 - sokol_gfx.h: The pixel format RG11B10F is now marked as renderable in the GL diff --git a/bindgen/gen_jai.py b/bindgen/gen_jai.py index fe643280..376d89af 100644 --- a/bindgen/gen_jai.py +++ b/bindgen/gen_jai.py @@ -383,6 +383,9 @@ def gen_c_imports(inp, c_prefix, prefix): l(f' {linux_gl_libs}') l(f' #if DEBUG {{ {clib_import} :: #library,no_dll "{clib_prefix}_linux_x64_gl_debug"; }}') l(f' else {{ {clib_import} :: #library,no_dll "{clib_prefix}_linux_x64_gl_release"; }}') + l( '} else #if OS == .WASM {') + l(f' #if DEBUG {{ {clib_import} :: #library,no_dll "{clib_prefix}_wasm_gl_debug"; }}') + l(f' else {{ {clib_import} :: #library,no_dll "{clib_prefix}_wasm_gl_release"; }}') l( '} else {') l( ' log_error("This OS is currently not supported");') l( '}') diff --git a/sokol_app.h b/sokol_app.h index 97f72ab3..1346c3bb 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -94,7 +94,7 @@ ======================= | Windows | macOS | Linux | iOS | Android | HTML5 --------------------+---------+-------+-------+-------+---------+-------- - gl 3.x | YES | YES | YES | --- | --- | --- + gl 4.x | YES | YES | YES | --- | --- | --- gles3/webgl2 | --- | --- | YES(2)| YES | YES | YES metal | --- | YES | --- | YES | --- | --- d3d11 | YES | --- | --- | --- | --- | --- @@ -275,10 +275,9 @@ to various Metal API objects required for rendering, otherwise they return a null pointer. These void pointers are actually Objective-C ids converted with a (ARC) __bridge cast so that - the ids can be tunnel through C code. Also note that the returned - pointers to the renderpass-descriptor and drawable may change from one - frame to the next, only the Metal device object is guaranteed to - stay the same. + the ids can be tunneled through C code. Also note that the returned + pointers may change from one frame to the next, only the Metal device + object is guaranteed to stay the same. const void* sapp_macos_get_window(void) On macOS, get the NSWindow object pointer, otherwise a null pointer. @@ -338,7 +337,8 @@ --- Optionally implement the event-callback to handle input events. sokol-app provides the following type of input events: - a 'virtual key' was pressed down or released - - a single text character was entered (provided as UTF-32 code point) + - a single text character was entered (provided as UTF-32 encoded + UNICODE code point) - a mouse button was pressed down or released (left, right, middle) - mouse-wheel or 2D scrolling events - the mouse was moved @@ -844,6 +844,8 @@ - on Linux: highly dependent on the used window manager, but usually the window's title bar icon and/or the task bar icon - on HTML5: the favicon shown in the page's browser tab + - on macOS: the application icon shown in the dock, but only + for currently running applications NOTE that it is not possible to set the actual application icon which is displayed by the operating system on the desktop or 'home screen'. Those @@ -974,7 +976,7 @@ the browser will not generate UNICODE character events) - all other key events *do not* bubble up by default (this prevents side effects like F1 opening help, or F7 starting 'caret browsing') - - character events do no bubble up (although I haven't noticed any side effects + - character events do not bubble up (although I haven't noticed any side effects otherwise) Event bubbling can be enabled for input event categories during initialization @@ -991,9 +993,10 @@ }; } - This basically opens the floodgates lets *all* input events bubble up to the browser. + This basically opens the floodgates and lets *all* input events bubble up to the browser. + To prevent individual events from bubbling, call sapp_consume_event() from within - the sokol_app.h event callback. + the sokol_app.h event callback when that specific event is reported. OPTIONAL: DON'T HIJACK main() (#define SOKOL_NO_ENTRY) ====================================================== diff --git a/sokol_fetch.h b/sokol_fetch.h index 2cc49312..d2f989ae 100644 --- a/sokol_fetch.h +++ b/sokol_fetch.h @@ -498,7 +498,7 @@ After the user callback returns, and all file data has been loaded (response.finished flag is set) the request has reached its end-of-life - and will recycled. + and will be recycled. Otherwise, if there's still data to load (because streaming was requested by providing a non-zero request.chunk_size), the request @@ -610,7 +610,7 @@ without downloading the entire file first (the Content-Length response header only provides the compressed size). Furthermore, for HTTP range-requests, the range is given on the compressed data, not the - uncompressed data. So if the web server decides to server the data + uncompressed data. So if the web server decides to serve the data compressed, the content-length and range-request parameters don't correspond to the uncompressed data that's arriving in the sokol-fetch buffers, and there's no way from JS or WASM to either force uncompressed @@ -671,7 +671,7 @@ When a request is sent to a channel via sfetch_send(), a "free lane" will be picked and assigned to the request. The request will occupy this lane for its entire life time (also while it is paused). If all lanes of a - channel are currently occupied, new requests will need to wait until a + channel are currently occupied, new requests will wait until a lane becomes unoccupied. Since the number of channels and lanes is known upfront, it is guaranteed @@ -800,7 +800,7 @@ On platforms with threading support, each channel runs on its own thread, but this is mainly an implementation detail to work around - the blocking traditional file IO functions, not for performance reasons. + the traditional blocking file IO functions, not for performance reasons. MEMORY ALLOCATION OVERRIDE diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 3921694e..7b71d90e 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -530,8 +530,8 @@ SOKOL_IMGUI_API_DECL void simgui_render(void); SOKOL_IMGUI_API_DECL simgui_image_t simgui_make_image(const simgui_image_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_destroy_image(simgui_image_t img); SOKOL_IMGUI_API_DECL simgui_image_desc_t simgui_query_image_desc(simgui_image_t img); -SOKOL_IMGUI_API_DECL void* simgui_imtextureid(simgui_image_t img); -SOKOL_IMGUI_API_DECL simgui_image_t simgui_image_from_imtextureid(void* im_texture_id); +SOKOL_IMGUI_API_DECL uint64_t simgui_imtextureid(simgui_image_t img); +SOKOL_IMGUI_API_DECL simgui_image_t simgui_image_from_imtextureid(uint64_t im_texture_id); SOKOL_IMGUI_API_DECL void simgui_add_focus_event(bool focus); SOKOL_IMGUI_API_DECL void simgui_add_mouse_pos_event(float x, float y); SOKOL_IMGUI_API_DECL void simgui_add_touch_pos_event(float x, float y); @@ -2960,14 +2960,14 @@ SOKOL_API_IMPL simgui_image_desc_t simgui_query_image_desc(simgui_image_t img_id return desc; } -SOKOL_API_IMPL void* simgui_imtextureid(simgui_image_t img) { +SOKOL_API_IMPL uint64_t simgui_imtextureid(simgui_image_t img) { SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); - return (void*)(uintptr_t)img.id; + return (uint64_t)(uintptr_t)img.id; } -SOKOL_API_IMPL simgui_image_t simgui_image_from_imtextureid(void* im_texture_id) { +SOKOL_API_IMPL simgui_image_t simgui_image_from_imtextureid(uint64_t im_texture_id) { SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); - simgui_image_t img = { (uint32_t)(uintptr_t) im_texture_id }; + simgui_image_t img = { (uint32_t)im_texture_id }; return img; } diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index 786fa989..bab86dd0 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -2597,6 +2597,8 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { nk_font_atlas_cleanup(&_snuklear.atlas); if (_snuklear.atlas.default_font) { nk_style_set_font(&_snuklear.ctx, &_snuklear.atlas.default_font->handle); + // This adds the default cursors into the nuklear overlay for use. + nk_style_load_all_cursors(&_snuklear.ctx, &_snuklear.atlas.cursors[0]); } } |