diff --git a/nuklear.h b/nuklear.h index 5ac2e2c..2cbfcb1 100644 --- a/nuklear.h +++ b/nuklear.h @@ -1732,8 +1732,8 @@ NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*); /// Parameter | Description /// -------------|----------------------------------------------------------- /// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __offset_x__ | A pointer to the x offset output -/// __offset_y__ | A pointer to the y offset output +/// __offset_x__ | A pointer to the x offset output (or NULL to ignore) +/// __offset_y__ | A pointer to the y offset output (or NULL to ignore) */ NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); /*/// #### nk_window_has_focus @@ -2744,8 +2744,8 @@ NK_API void nk_group_scrolled_end(struct nk_context*); /// -------------|----------------------------------------------------------- /// __ctx__ | Must point to an previously initialized `nk_context` struct /// __id__ | The id of the group to get the scroll position of -/// __x_offset__ | A pointer to the x offset output -/// __y_offset__ | A pointer to the y offset output +/// __x_offset__ | A pointer to the x offset output (or NULL to ignore) +/// __y_offset__ | A pointer to the y offset output (or NULL to ignore) */ NK_API void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset); /*/// #### nk_group_set_scroll @@ -16533,8 +16533,10 @@ nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_ if (!ctx || !ctx->current) return ; win = ctx->current; - *offset_x = win->scrollbar.x; - *offset_y = win->scrollbar.y; + if (offset_x) + *offset_x = win->scrollbar.x; + if (offset_y) + *offset_y = win->scrollbar.y; } NK_API int nk_window_has_focus(const struct nk_context *ctx) @@ -17023,8 +17025,10 @@ nk_popup_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y return; popup = ctx->current; - *offset_x = popup->scrollbar.x; - *offset_y = popup->scrollbar.y; + if (offset_x) + *offset_x = popup->scrollbar.x; + if (offset_y) + *offset_y = popup->scrollbar.y; } NK_API void nk_popup_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y) @@ -18866,8 +18870,10 @@ nk_group_get_scroll(struct nk_context *ctx, const char *id, nk_uint *x_offset, n if (!x_offset_ptr || !y_offset_ptr) return; *x_offset_ptr = *y_offset_ptr = 0; } else y_offset_ptr = nk_find_value(win, id_hash+1); - *x_offset = *x_offset_ptr; - *y_offset = *y_offset_ptr; + if (x_offset) + *x_offset = *x_offset_ptr; + if (y_offset) + *y_offset = *y_offset_ptr; } NK_API void nk_group_set_scroll(struct nk_context *ctx, const char *id, nk_uint x_offset, nk_uint y_offset) diff --git a/src/nuklear.h b/src/nuklear.h index e995899..57c22c8 100644 --- a/src/nuklear.h +++ b/src/nuklear.h @@ -1513,8 +1513,8 @@ NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*); /// Parameter | Description /// -------------|----------------------------------------------------------- /// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __offset_x__ | A pointer to the x offset output -/// __offset_y__ | A pointer to the y offset output +/// __offset_x__ | A pointer to the x offset output (or NULL to ignore) +/// __offset_y__ | A pointer to the y offset output (or NULL to ignore) */ NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); /*/// #### nk_window_has_focus @@ -2525,8 +2525,8 @@ NK_API void nk_group_scrolled_end(struct nk_context*); /// -------------|----------------------------------------------------------- /// __ctx__ | Must point to an previously initialized `nk_context` struct /// __id__ | The id of the group to get the scroll position of -/// __x_offset__ | A pointer to the x offset output -/// __y_offset__ | A pointer to the y offset output +/// __x_offset__ | A pointer to the x offset output (or NULL to ignore) +/// __y_offset__ | A pointer to the y offset output (or NULL to ignore) */ NK_API void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset); /*/// #### nk_group_set_scroll diff --git a/src/nuklear_group.c b/src/nuklear_group.c index f6cac01..0f738f5 100644 --- a/src/nuklear_group.c +++ b/src/nuklear_group.c @@ -196,8 +196,10 @@ nk_group_get_scroll(struct nk_context *ctx, const char *id, nk_uint *x_offset, n if (!x_offset_ptr || !y_offset_ptr) return; *x_offset_ptr = *y_offset_ptr = 0; } else y_offset_ptr = nk_find_value(win, id_hash+1); - *x_offset = *x_offset_ptr; - *y_offset = *y_offset_ptr; + if (x_offset) + *x_offset = *x_offset_ptr; + if (y_offset) + *y_offset = *y_offset_ptr; } NK_API void nk_group_set_scroll(struct nk_context *ctx, const char *id, nk_uint x_offset, nk_uint y_offset) diff --git a/src/nuklear_popup.c b/src/nuklear_popup.c index 68bc965..f0c3475 100644 --- a/src/nuklear_popup.c +++ b/src/nuklear_popup.c @@ -237,8 +237,10 @@ nk_popup_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y return; popup = ctx->current; - *offset_x = popup->scrollbar.x; - *offset_y = popup->scrollbar.y; + if (offset_x) + *offset_x = popup->scrollbar.x; + if (offset_y) + *offset_y = popup->scrollbar.y; } NK_API void nk_popup_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y) diff --git a/src/nuklear_window.c b/src/nuklear_window.c index 85b0857..bd8739d 100644 --- a/src/nuklear_window.c +++ b/src/nuklear_window.c @@ -412,8 +412,10 @@ nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_ if (!ctx || !ctx->current) return ; win = ctx->current; - *offset_x = win->scrollbar.x; - *offset_y = win->scrollbar.y; + if (offset_x) + *offset_x = win->scrollbar.x; + if (offset_y) + *offset_y = win->scrollbar.y; } NK_API int nk_window_has_focus(const struct nk_context *ctx)