Skip to content
This repository was archived by the owner on Dec 2, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -3044,13 +3044,15 @@ struct nk_command_circle {
short x, y;
unsigned short line_thickness;
unsigned short w, h;
unsigned int segments;
struct nk_color color;
};

struct nk_command_circle_filled {
struct nk_command header;
short x, y;
unsigned short w, h;
unsigned int segments;
struct nk_color color;
};

Expand Down Expand Up @@ -3141,6 +3143,7 @@ struct nk_command_buffer {
NK_API void nk_stroke_line(struct nk_command_buffer *b, float x0, float y0, float x1, float y1, float line_thickness, struct nk_color);
NK_API void nk_stroke_curve(struct nk_command_buffer*, float, float, float, float, float, float, float, float, float line_thickness, struct nk_color);
NK_API void nk_stroke_rect(struct nk_command_buffer*, struct nk_rect, float rounding, float line_thickness, struct nk_color);
NK_API void nk_stroke_circle_seg(struct nk_command_buffer*, struct nk_rect, float line_thickness, struct nk_color, unsigned int);
NK_API void nk_stroke_circle(struct nk_command_buffer*, struct nk_rect, float line_thickness, struct nk_color);
NK_API void nk_stroke_arc(struct nk_command_buffer*, float cx, float cy, float radius, float a_min, float a_max, float line_thickness, struct nk_color);
NK_API void nk_stroke_triangle(struct nk_command_buffer*, float, float, float, float, float, float, float line_thichness, struct nk_color);
Expand All @@ -3150,6 +3153,7 @@ NK_API void nk_stroke_polygon(struct nk_command_buffer*, float*, int point_count
/* filled shades */
NK_API void nk_fill_rect(struct nk_command_buffer*, struct nk_rect, float rounding, struct nk_color);
NK_API void nk_fill_rect_multi_color(struct nk_command_buffer*, struct nk_rect, struct nk_color left, struct nk_color top, struct nk_color right, struct nk_color bottom);
NK_API void nk_fill_circle_seg(struct nk_command_buffer*, struct nk_rect, struct nk_color, unsigned int);
NK_API void nk_fill_circle(struct nk_command_buffer*, struct nk_rect, struct nk_color);
NK_API void nk_fill_arc(struct nk_command_buffer*, float cx, float cy, float radius, float a_min, float a_max, struct nk_color);
NK_API void nk_fill_triangle(struct nk_command_buffer*, float x0, float y0, float x1, float y1, float x2, float y2, struct nk_color);
Expand Down Expand Up @@ -7458,8 +7462,8 @@ nk_fill_rect_multi_color(struct nk_command_buffer *b, struct nk_rect rect,
}

NK_API void
nk_stroke_circle(struct nk_command_buffer *b, struct nk_rect r,
float line_thickness, struct nk_color c)
nk_stroke_circle_seg(struct nk_command_buffer *b, struct nk_rect r,
float line_thickness, struct nk_color c, unsigned int segments)
{
struct nk_command_circle *cmd;
if (!b || r.w == 0 || r.h == 0 || line_thickness <= 0) return;
Expand All @@ -7477,11 +7481,20 @@ nk_stroke_circle(struct nk_command_buffer *b, struct nk_rect r,
cmd->y = (short)r.y;
cmd->w = (unsigned short)NK_MAX(r.w, 0);
cmd->h = (unsigned short)NK_MAX(r.h, 0);
cmd->segments = segments;
cmd->color = c;
}

NK_API void
nk_fill_circle(struct nk_command_buffer *b, struct nk_rect r, struct nk_color c)
nk_stroke_circle(struct nk_command_buffer *b, struct nk_rect r,
float line_thickness, struct nk_color c)
{
nk_stroke_circle_seg(b, r, line_thickness, c, 0);
}

NK_API void
nk_fill_circle_seg(struct nk_command_buffer *b, struct nk_rect r,
struct nk_color c, unsigned int segments)
{
struct nk_command_circle_filled *cmd;
NK_ASSERT(b);
Expand All @@ -7499,9 +7512,16 @@ nk_fill_circle(struct nk_command_buffer *b, struct nk_rect r, struct nk_color c)
cmd->y = (short)r.y;
cmd->w = (unsigned short)NK_MAX(r.w, 0);
cmd->h = (unsigned short)NK_MAX(r.h, 0);
cmd->segments = segments;
cmd->color = c;
}

NK_API void
nk_fill_circle(struct nk_command_buffer *b, struct nk_rect r, struct nk_color c)
{
nk_fill_circle_seg(b, r, c, 0);
}

NK_API void
nk_stroke_arc(struct nk_command_buffer *b, float cx, float cy, float radius,
float a_min, float a_max, float line_thickness, struct nk_color c)
Expand Down Expand Up @@ -9025,13 +9045,14 @@ nk_convert(struct nk_context *ctx, struct nk_buffer *cmds,
const struct nk_command_circle *c = (const struct nk_command_circle*)cmd;
nk_draw_list_stroke_circle(&ctx->draw_list, nk_vec2((float)c->x + (float)c->w/2,
(float)c->y + (float)c->h/2), (float)c->w/2, c->color,
config->circle_segment_count, c->line_thickness);
c->segments != 0 ? c->segments : config->circle_segment_count,
c->line_thickness);
} break;
case NK_COMMAND_CIRCLE_FILLED: {
const struct nk_command_circle_filled *c = (const struct nk_command_circle_filled *)cmd;
nk_draw_list_fill_circle(&ctx->draw_list, nk_vec2((float)c->x + (float)c->w/2,
(float)c->y + (float)c->h/2), (float)c->w/2, c->color,
config->circle_segment_count);
c->segments != 0 ? c->segments : config->circle_segment_count);
} break;
case NK_COMMAND_ARC: {
const struct nk_command_arc *c = (const struct nk_command_arc*)cmd;
Expand Down Expand Up @@ -11763,9 +11784,7 @@ nk_font_init(struct nk_font *font, float pixel_height,
* MIT license (see License.txt in http://www.upperbounds.net/download/ProggyClean.ttf.zip)
* Download and more information at http://upperbounds.net
*-----------------------------------------------------------------------------*/
#ifdef NK_INCLUDE_DEFAULT_FONT

#ifdef __clang__
#ifdef __clang__
#pragma clang diagnostic push

#pragma clang diagnostic ignored "-Woverlength-strings"
Expand All @@ -11774,6 +11793,8 @@ nk_font_init(struct nk_font *font, float pixel_height,
#pragma GCC diagnostic ignored "-Woverlength-strings"
#endif

#ifdef NK_INCLUDE_DEFAULT_FONT

NK_GLOBAL const char nk_proggy_clean_ttf_compressed_data_base85[11980+1] =
"7])#######hV0qs'/###[),##/l:$#Q6>##5[n42>c-TH`->>#/e>11NNV=Bv(*:.F?uu#(gRU.o0XGH`$vhLG1hxt9?W`#,5LsCp#-i>.r$<$6pD>Lb';9Crc6tgXmKVeU2cD4Eo3R/"
"2*>]b(MC;$jPfY.;h^`IWM9<Lh2TlS+f-s$o6Q<BWH`YiU.xfLq$N;$0iR/GX:U(jcW2p/W*q?-qmnUCI;jHSAiFWM.R*kU@C=GH?a9wp8f$e.-4^Qg1)Q-GL(lf(r/7GrRgwV%MS=C#"
Expand Down