Skip to content

Commit

Permalink
Merge branch 'nuklear-event-notify' of https://github.com/adamrt/sokol
Browse files Browse the repository at this point in the history
…into adamrt-nuklear-event-notify
  • Loading branch information
floooh committed Jan 3, 2024
2 parents 9ee0a7d + 8e24c1f commit 1df37b1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions util/sokol_nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@
--- if you're using sokol_app.h, from inside the sokol_app.h event callback,
call:
void snk_handle_event(const sapp_event* ev);
bool snk_handle_event(const sapp_event* ev);
This will feed the event into Nuklear's event handling code, and return
true if the event was handled by Nuklear, or false if the event should
be handled by the application.
--- finally, on application shutdown, call
Expand Down Expand Up @@ -436,7 +440,7 @@ SOKOL_NUKLEAR_API_DECL snk_image_desc_t snk_query_image_desc(snk_image_t img);
SOKOL_NUKLEAR_API_DECL nk_handle snk_nkhandle(snk_image_t img);
SOKOL_NUKLEAR_API_DECL snk_image_t snk_image_from_nkhandle(nk_handle handle);
#if !defined(SOKOL_NUKLEAR_NO_SOKOL_APP)
SOKOL_NUKLEAR_API_DECL void snk_handle_event(const sapp_event* ev);
SOKOL_NUKLEAR_API_DECL bool snk_handle_event(const sapp_event* ev);
SOKOL_NUKLEAR_API_DECL nk_flags snk_edit_string(struct nk_context *ctx, nk_flags flags, char *memory, int *len, int max, nk_plugin_filter filter);
#endif
SOKOL_NUKLEAR_API_DECL void snk_shutdown(void);
Expand Down Expand Up @@ -2526,7 +2530,7 @@ _SOKOL_PRIVATE enum nk_keys _snk_event_to_nuklearkey(const sapp_event* ev) {
}
}

SOKOL_API_IMPL void snk_handle_event(const sapp_event* ev) {
SOKOL_API_IMPL bool snk_handle_event(const sapp_event* ev) {
SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie);
const float dpi_scale = _snuklear.desc.dpi_scale;
switch (ev->type) {
Expand Down Expand Up @@ -2644,6 +2648,7 @@ SOKOL_API_IMPL void snk_handle_event(const sapp_event* ev) {
default:
break;
}
return nk_item_is_any_active(&_snuklear.ctx);
}

SOKOL_API_IMPL nk_flags snk_edit_string(struct nk_context *ctx, nk_flags flags, char *memory, int *len, int max, nk_plugin_filter filter) {
Expand Down

0 comments on commit 1df37b1

Please sign in to comment.