Skip to content

Commit

Permalink
Replace every boolean int by nk_bool
Browse files Browse the repository at this point in the history
  • Loading branch information
aganm committed Sep 4, 2020
1 parent 60ed2a5 commit 1e21ef2
Show file tree
Hide file tree
Showing 30 changed files with 860 additions and 858 deletions.
857 changes: 429 additions & 428 deletions nuklear.h

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/// - [yy]: Minor version with non-breaking API and library changes
/// - [zz]: Bug fix version with no direct changes to API
///
/// - 2020/09/04 (4.04.1) - Replace every boolean int by nk_bool
/// - 2020/09/04 (4.04.0) - Add nk_bool with NK_INCLUDE_STANDARD_BOOL
/// - 2020/06/13 (4.03.1) - Fix nk_pool allocation sizes.
/// - 2020/06/04 (4.03.0) - Made nk_combo header symbols optional.
Expand Down
346 changes: 173 additions & 173 deletions src/nuklear.h

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions src/nuklear_button.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ nk_draw_symbol(struct nk_command_buffer *out, enum nk_symbol_type type,
case NK_SYMBOL_MAX: break;
}
}
NK_LIB int
NK_LIB nk_bool
nk_button_behavior(nk_flags *state, struct nk_rect r,
const struct nk_input *i, enum nk_button_behavior behavior)
{
Expand Down Expand Up @@ -106,7 +106,7 @@ nk_draw_button(struct nk_command_buffer *out,
}
return background;
}
NK_LIB int
NK_LIB nk_bool
nk_do_button(nk_flags *state, struct nk_command_buffer *out, struct nk_rect r,
const struct nk_style_button *style, const struct nk_input *in,
enum nk_button_behavior behavior, struct nk_rect *content)
Expand Down Expand Up @@ -154,7 +154,7 @@ nk_draw_button_text(struct nk_command_buffer *out,
text.padding = nk_vec2(0,0);
nk_widget_text(out, *content, txt, len, &text, text_alignment, font);
}
NK_LIB int
NK_LIB nk_bool
nk_do_button_text(nk_flags *state,
struct nk_command_buffer *out, struct nk_rect bounds,
const char *string, int len, nk_flags align, enum nk_button_behavior behavior,
Expand Down Expand Up @@ -200,7 +200,7 @@ nk_draw_button_symbol(struct nk_command_buffer *out,
else sym = style->text_normal;
nk_draw_symbol(out, type, *content, bg, sym, 1, font);
}
NK_LIB int
NK_LIB nk_bool
nk_do_button_symbol(nk_flags *state,
struct nk_command_buffer *out, struct nk_rect bounds,
enum nk_symbol_type symbol, enum nk_button_behavior behavior,
Expand Down Expand Up @@ -231,7 +231,7 @@ nk_draw_button_image(struct nk_command_buffer *out,
nk_draw_button(out, bounds, state, style);
nk_draw_image(out, *content, img, nk_white);
}
NK_LIB int
NK_LIB nk_bool
nk_do_button_image(nk_flags *state,
struct nk_command_buffer *out, struct nk_rect bounds,
struct nk_image img, enum nk_button_behavior b,
Expand Down Expand Up @@ -290,7 +290,7 @@ nk_draw_button_text_symbol(struct nk_command_buffer *out,
nk_draw_symbol(out, type, *symbol, style->text_background, sym, 0, font);
nk_widget_text(out, *label, str, len, &text, NK_TEXT_CENTERED, font);
}
NK_LIB int
NK_LIB nk_bool
nk_do_button_text_symbol(nk_flags *state,
struct nk_command_buffer *out, struct nk_rect bounds,
enum nk_symbol_type symbol, const char *str, int len, nk_flags align,
Expand Down Expand Up @@ -347,7 +347,7 @@ nk_draw_button_text_image(struct nk_command_buffer *out,
nk_widget_text(out, *label, str, len, &text, NK_TEXT_CENTERED, font);
nk_draw_image(out, *image, img, nk_white);
}
NK_LIB int
NK_LIB nk_bool
nk_do_button_text_image(nk_flags *state,
struct nk_command_buffer *out, struct nk_rect bounds,
struct nk_image img, const char* str, int len, nk_flags align,
Expand Down Expand Up @@ -390,7 +390,7 @@ nk_button_set_behavior(struct nk_context *ctx, enum nk_button_behavior behavior)
if (!ctx) return;
ctx->button_behavior = behavior;
}
NK_API int
NK_API nk_bool
nk_button_push_behavior(struct nk_context *ctx, enum nk_button_behavior behavior)
{
struct nk_config_stack_button_behavior *button_stack;
Expand All @@ -410,7 +410,7 @@ nk_button_push_behavior(struct nk_context *ctx, enum nk_button_behavior behavior
ctx->button_behavior = behavior;
return 1;
}
NK_API int
NK_API nk_bool
nk_button_pop_behavior(struct nk_context *ctx)
{
struct nk_config_stack_button_behavior *button_stack;
Expand All @@ -428,7 +428,7 @@ nk_button_pop_behavior(struct nk_context *ctx)
*element->address = element->old_value;
return 1;
}
NK_API int
NK_API nk_bool
nk_button_text_styled(struct nk_context *ctx,
const struct nk_style_button *style, const char *title, int len)
{
Expand All @@ -455,23 +455,23 @@ nk_button_text_styled(struct nk_context *ctx,
title, len, style->text_alignment, ctx->button_behavior,
style, in, ctx->style.font);
}
NK_API int
NK_API nk_bool
nk_button_text(struct nk_context *ctx, const char *title, int len)
{
NK_ASSERT(ctx);
if (!ctx) return 0;
return nk_button_text_styled(ctx, &ctx->style.button, title, len);
}
NK_API int nk_button_label_styled(struct nk_context *ctx,
NK_API nk_bool nk_button_label_styled(struct nk_context *ctx,
const struct nk_style_button *style, const char *title)
{
return nk_button_text_styled(ctx, style, title, nk_strlen(title));
}
NK_API int nk_button_label(struct nk_context *ctx, const char *title)
NK_API nk_bool nk_button_label(struct nk_context *ctx, const char *title)
{
return nk_button_text(ctx, title, nk_strlen(title));
}
NK_API int
NK_API nk_bool
nk_button_color(struct nk_context *ctx, struct nk_color color)
{
struct nk_window *win;
Expand Down Expand Up @@ -506,7 +506,7 @@ nk_button_color(struct nk_context *ctx, struct nk_color color)
nk_draw_button(&win->buffer, &bounds, ctx->last_widget_state, &button);
return ret;
}
NK_API int
NK_API nk_bool
nk_button_symbol_styled(struct nk_context *ctx,
const struct nk_style_button *style, enum nk_symbol_type symbol)
{
Expand All @@ -531,14 +531,14 @@ nk_button_symbol_styled(struct nk_context *ctx,
return nk_do_button_symbol(&ctx->last_widget_state, &win->buffer, bounds,
symbol, ctx->button_behavior, style, in, ctx->style.font);
}
NK_API int
NK_API nk_bool
nk_button_symbol(struct nk_context *ctx, enum nk_symbol_type symbol)
{
NK_ASSERT(ctx);
if (!ctx) return 0;
return nk_button_symbol_styled(ctx, &ctx->style.button, symbol);
}
NK_API int
NK_API nk_bool
nk_button_image_styled(struct nk_context *ctx, const struct nk_style_button *style,
struct nk_image img)
{
Expand All @@ -564,14 +564,14 @@ nk_button_image_styled(struct nk_context *ctx, const struct nk_style_button *sty
return nk_do_button_image(&ctx->last_widget_state, &win->buffer, bounds,
img, ctx->button_behavior, style, in);
}
NK_API int
NK_API nk_bool
nk_button_image(struct nk_context *ctx, struct nk_image img)
{
NK_ASSERT(ctx);
if (!ctx) return 0;
return nk_button_image_styled(ctx, &ctx->style.button, img);
}
NK_API int
NK_API nk_bool
nk_button_symbol_text_styled(struct nk_context *ctx,
const struct nk_style_button *style, enum nk_symbol_type symbol,
const char *text, int len, nk_flags align)
Expand Down Expand Up @@ -599,26 +599,26 @@ nk_button_symbol_text_styled(struct nk_context *ctx,
symbol, text, len, align, ctx->button_behavior,
style, ctx->style.font, in);
}
NK_API int
NK_API nk_bool
nk_button_symbol_text(struct nk_context *ctx, enum nk_symbol_type symbol,
const char* text, int len, nk_flags align)
{
NK_ASSERT(ctx);
if (!ctx) return 0;
return nk_button_symbol_text_styled(ctx, &ctx->style.button, symbol, text, len, align);
}
NK_API int nk_button_symbol_label(struct nk_context *ctx, enum nk_symbol_type symbol,
NK_API nk_bool nk_button_symbol_label(struct nk_context *ctx, enum nk_symbol_type symbol,
const char *label, nk_flags align)
{
return nk_button_symbol_text(ctx, symbol, label, nk_strlen(label), align);
}
NK_API int nk_button_symbol_label_styled(struct nk_context *ctx,
NK_API nk_bool nk_button_symbol_label_styled(struct nk_context *ctx,
const struct nk_style_button *style, enum nk_symbol_type symbol,
const char *title, nk_flags align)
{
return nk_button_symbol_text_styled(ctx, style, symbol, title, nk_strlen(title), align);
}
NK_API int
NK_API nk_bool
nk_button_image_text_styled(struct nk_context *ctx,
const struct nk_style_button *style, struct nk_image img, const char *text,
int len, nk_flags align)
Expand Down Expand Up @@ -646,18 +646,18 @@ nk_button_image_text_styled(struct nk_context *ctx,
bounds, img, text, len, align, ctx->button_behavior,
style, ctx->style.font, in);
}
NK_API int
NK_API nk_bool
nk_button_image_text(struct nk_context *ctx, struct nk_image img,
const char *text, int len, nk_flags align)
{
return nk_button_image_text_styled(ctx, &ctx->style.button,img, text, len, align);
}
NK_API int nk_button_image_label(struct nk_context *ctx, struct nk_image img,
NK_API nk_bool nk_button_image_label(struct nk_context *ctx, struct nk_image img,
const char *label, nk_flags align)
{
return nk_button_image_text(ctx, img, label, nk_strlen(label), align);
}
NK_API int nk_button_image_label_styled(struct nk_context *ctx,
NK_API nk_bool nk_button_image_label_styled(struct nk_context *ctx,
const struct nk_style_button *style, struct nk_image img,
const char *label, nk_flags text_alignment)
{
Expand Down
4 changes: 2 additions & 2 deletions src/nuklear_chart.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* CHART
*
* ===============================================================*/
NK_API int
NK_API nk_bool
nk_chart_begin_colored(struct nk_context *ctx, enum nk_chart_type type,
struct nk_color color, struct nk_color highlight,
int count, float min_value, float max_value)
Expand Down Expand Up @@ -65,7 +65,7 @@ nk_chart_begin_colored(struct nk_context *ctx, enum nk_chart_type type,
}
return 1;
}
NK_API int
NK_API nk_bool
nk_chart_begin(struct nk_context *ctx, const enum nk_chart_type type,
int count, float min_value, float max_value)
{
Expand Down
10 changes: 5 additions & 5 deletions src/nuklear_color_picker.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
* COLOR PICKER
*
* ===============================================================*/
NK_LIB int
NK_LIB nk_bool
nk_color_picker_behavior(nk_flags *state,
const struct nk_rect *bounds, const struct nk_rect *matrix,
const struct nk_rect *hue_bar, const struct nk_rect *alpha_bar,
struct nk_colorf *color, const struct nk_input *in)
{
float hsva[4];
int value_changed = 0;
int hsv_changed = 0;
nk_bool value_changed = 0;
nk_bool hsv_changed = 0;

NK_ASSERT(state);
NK_ASSERT(matrix);
Expand Down Expand Up @@ -117,7 +117,7 @@ nk_draw_color_picker(struct nk_command_buffer *o, const struct nk_rect *matrix,
nk_stroke_line(o, p.x, p.y + crosshair_size + 1, p.x, p.y+3, 1.0f, white);
nk_stroke_line(o, p.x, p.y - crosshair_size, p.x, p.y-2, 1.0f, white);}
}
NK_LIB int
NK_LIB nk_bool
nk_do_color_picker(nk_flags *state,
struct nk_command_buffer *out, struct nk_colorf *col,
enum nk_color_format fmt, struct nk_rect bounds,
Expand Down Expand Up @@ -163,7 +163,7 @@ nk_do_color_picker(nk_flags *state,
nk_draw_color_picker(out, &matrix, &hue_bar, (fmt == NK_RGBA) ? &alpha_bar:0, *col);
return ret;
}
NK_API int
NK_API nk_bool
nk_color_pick(struct nk_context * ctx, struct nk_colorf *color,
enum nk_color_format fmt)
{
Expand Down
Loading

0 comments on commit 1e21ef2

Please sign in to comment.