Skip to content

Instantly share code, notes, and snippets.

@zesterer
Created July 31, 2018 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zesterer/b5c99b1f26fd14eef905f3fae238df8e to your computer and use it in GitHub Desktop.
Save zesterer/b5c99b1f26fd14eef905f3fae238df8e to your computer and use it in GitHub Desktop.
C code, procedurally generated using a 4th-order Markov chain generator
///
/// This code is procedurally generated using the 4th-order Markov chain generator
///
/// Original training material: https://github.com/vurtun/nuklear/blob/master/nuklear.h
///
const struct nk_image s;
* a = (nk_byte) tmp[3];
}
NK_API void
nk_color_hsva_b(nk_byte * h, nk_byte * s, nk_byte * v, nk_byte * a, struct nk_color border_color; struct nk_color nk_rgba_hex(const char * rgb);
NK_API struct nk_colorf col_left, col_top; struct nk_rect r,
const struct nk_style * style;
const struct nk_style_button close_button; struct nk_window * popup; struct nk_vec2 row_size;
}
else {
i++;
}
down = down || nk_input_is_mouse_click_in_rect( in , (enum nk_buttons) i, b);
for (i = 0; i <= safe_w; ++i) {
break;
const struct nk_rect * scursor, nk_size value, nk_size max);
NK_LIB nk_size nk_do_progress(nk_flags * state, struct nk_input * in ,
const struct nk_text text;
nk_flags ws; temp[i2 * 4 + 3] = nk_vec2_sub(points[i2], dm_in);
case NK_COMMAND_TEXT:
{
if (!NK_INTERSECT(c.x, c.y, c.w, c.h, bounds.x, bounds.y, bounds.w, bounds.h);
}
if (pool - > type == NK_BUFFER_FIXED) {
cmd = (struct nk_draw_command * )
}
}
* glyphs = g; pan.parent = win; ret = 0; int c = ctx - > current - > layout - > clip; c.x = (float)((int) c.x); c.y = (float)((int) c.y); c.w = (float)((int) c.w); c.h = (float)((int) c.h);
nk_layout_peek( & bounds, ctx);
return result;
}#
endif
NK_API nk_hash
nk_murmur_hash(const void * key, int shift_mod,
const struct nk_font_glyph *
nk_font_find_glyph(struct nk_font * font, nk_rune unicode) {
nk_glyph glyph;
NK_ASSERT(str);
NK_ASSERT(unicode);
NK_ASSERT(len);
if ( * state & NK_WIDGET_STATE_HOVER && !nk_input_is_mouse_prev_hovering_rect(i, r))
s[i++] = '-';
item_width = layout - > row.item_width;
} else {
}
buf[len++] = '0'; struct nk_tt__bitmap gbm;
nk_tt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, 0.0 f, 0.0 f, ix0, iy0, ix1, iy1);
}
NK_INTERN void *
nk_tt__hheap_alloc(struct nk_tt__hheap * hh, void * p) {
*(void ** ) p = v * (1.0 f - f));
switch (key) {
return (!sep_len) ? len : sep_len;
}
}
NK_LIB void
nk_row_layout(struct nk_context * ctx, struct nk_color border_color = nk_panel_get_border_color(style, layout - > type);
case NK_SYMBOL_MAX:
break;
for (i = 0; i <= safe_h; ++i) {
background.w = win - > bounds.w; -
X.....X text_len - row_begin, row_height, & remaining,
image.w = image.h;
i += 1 + tex_width;
width = -width;
return;
text.padding = nk_vec2(0, 0);
return text + src_len;
}
NK_API
const char *
nk_str_at_char_const(const struct nk_str * str,
const nk_rune * nk_font_cyrillic_glyph_ranges(void); NK_API
const nk_rune * runes) {
int pressed, in_body, in_header;
layout - > row.index = index;
}#
19031 "test.c"
NK_LIB void nk_widget_text(struct nk_command_buffer * o, struct nk_rect sym = style - > combo.sym_normal;
return;
buf = & win - > popup.buf; buf - > last = win - > buffer.last; buf - > end = win - > buffer.end;
}
NK_LIB void nk_finish_buffer(struct nk_context * ctx, nk_flags flags, enum nk_panel_type type) {
void * vtx = nk_draw_list_alloc_vertices(list, vtx_count);
else nk_fill_circle(out, * cursors, cursor - > data.color);
nk_textedit_delete(state, state - > select_start,
if (s <= 0.0 f) {
sym = style - > combo.sym_normal;
glyph - > x1 = q.x1;
glyph - > y1 = q.y1;
ret |= NK_EDIT_COMMITED;
content.x = button.x + style - > combo.button.padding.x;
nk_stroke_rect( & win - > buffer, header, style - > combo.rounding, background - > data.color);
line_width = 0;
while ( * (iter++) != 0);
scanline[x1] += area + step / 2;
t = font - > width(font - > userdata, font - > height, title, text_len);
text_width = style - > font - > width(style - > font - > userdata,
enum nk_draw_vertex_layout_format format) {
int value_changed = hsv_changed = 1;
} else if (x0 < len) {
float objspace_flatness_squared = objspace_flatness * objspace_flatness;
int glyph_len = byte_len = 0;
if (!hash) {
nk_uint * offset_y;
float xoff2, yoff2;
};
struct nk_tt_pack_range {
nk_fill_rect(out, * bounds, style - > rounding, background - > data.color);
}
nk_vec2(rect.x + rect.w, rect.y + g.offset.y; bounds.w = bounds.h + style - > touch_padding.y * 2; edit - > cursor_size = 4;
if (!ctx) return;
}
return n;
if (iter && ((iter - > buffer.begin == iter - > buffer.end) ||
nk_flags ws = 0; struct nk_vec2 size) {
nk_buffer_init_fixed( & str - > buffer, memory, size);
ctx - > use_pool = nk_true;
nk_tt_PackSetOversampling( & baker - > spc, cfg - > oversample_h, cfg - > oversample_v);
sel_text_color = style - > selected_text_hover;
clip - > x, clip - > y, clip - > w, clip - > h))
NK_MEMCPY(attr, & col.r, sizeof(col));
}
while (c1);
return nk_false;
}
NK_API int nk_input_is_mouse_released(const struct nk_input * in ; struct nk_rect b, int a); NK_API struct nk_color sel_background_color; variant - > value.d = NK_CLAMP(variant - > min_value.d, variant - > value.d, variant - > max_value.d);
if (!ctx || !ctx - > current || !ctx - > current - > layout)
glyph - > h = glyph - > y1 - glyph - > y0;
const char * name, double min,
float scan_y_bottom = (float) y + 1.0 f; win - > group_border = 1.0 f; nk_command_buffer_push(b, NK_COMMAND_POLYGON_FILLED, size); memory = unaligned;
} {
sym = {
0,
0,
0,
0
};
rects[i].was_packed = !(rects[i].x == NK_RP__MAXVAL && rects[i].y == NK_RP__MAXVAL);
}#
10843 "test.c"#
define NK_TT_MAX_OVERSAMPLE 8# define NK_TT__OVER_MASK(NK_TT_MAX_OVERSAMPLE - 1)
struct nk_tt_bakedchar {
if (win && ctx - > end != win) {
if (a_min <= a_max) {
struct nk_cursor * cursor_last;
int left_mouse_click_in_scaler = nk_input_has_mouse_click_down_in_rect( in ,
const char * end = nk_str_get_const( & edit - > string) + len;
if (!ctx || !ctx - > current || !ctx - > current - > layout || !color)
struct nk_window * win,
enum nk_arg_type arg_type = NK_ARG_TYPE_LONG;
}
else {
nk_draw_list_add_clip( & ctx - > draw_list, nk_rect(s - > x, s - > y, s - > w, s - > h));
filters[filter], text_edit, & style - > edit, ( * state == NK_PROPERTY_EDIT)) {
for (i = 0; s.h = h; s.region[0] = (unsigned short) NK_MAX(0, rect.h); cmd - > color = c;
}
NK_API void
nk_stroke_polygon(struct nk_command_buffer * b, float * points, int point_count,
struct nk_rect sub_region);
NK_API struct nk_image * img, struct nk_color c) {
return v;
}
NK_LIB double
nk_pow(double x, int n);
NK_LIB int nk_text_clamp(const struct nk_user_font * font);
NK_LIB int nk_do_toggle(nk_flags * state, struct nk_command_buffer * buffer) {
nk_size cap;
};
struct nk_context {
nk_short dx = e - > fdx;
}
if (!ctx || !ctx - > current || !ctx - > current - > layout)
if (ctx - > end)
tmp - > rects = baker - > rects + rect_n;
num_vertices = 0;
mtx[0] = nk_ttSHORT(comp) / 16384.0 f;
comp += 2;
memory = nk_buffer_memory(list - > buffer);
size = sizeof( * cmd) + sizeof(short) * 2 * padding.y);
if (b - > type == NK_BUFFER_FIXED) return;
}
ctx - > use_pool = nk_false;
else {
struct nk_vec2 a, struct nk_vec2 size) {
* selected = nk_combo_string(ctx, items_separated_by_zeros, * selected, count, item_height, size);
}#
25087 "test.c"
NK_API int
nk_tooltip_begin(struct nk_context * ctx,
const char * text, int len,
struct nk_color col) {
int was_packed;
};
struct nk_rp_node {
win - > flags |= NK_WINDOW_CLOSED;
}
NK_API void
nk_window_set_bounds(struct nk_context * ctx,
const int off1 = off0 + 1 + nk_ttUSHORT(endPtsOfContours + j * 2);
return nk_hsva(c[0], c[1], c[2], c[3]);
}
NK_API struct nk_color
nk_rgba_bv(const nk_byte * c) {
return 1;
}
return (nk_input_has_mouse_click_down_in_rect(i, id, b, nk_false) &&
return;
if (!nk_tt_GetGlyphBox(font, glyph, & x0, & y0, & x1, & y1)) {
}
if (!NK_INTERSECT(rect.x, rect.y, rect.w, rect.h);
}
NK_API int nk_input_mouse_clicked(const struct nk_input * in ;
const struct nk_style_progress * style,
const struct nk_user_font * font); NK_LIB void nk_draw_button_image(struct nk_command_buffer * out, struct nk_rect rect,
struct nk_page_element * elem; elem = (struct nk_rp_context * ) state - > cursor = state - > select_start = 0; result = -1; best_letter = 0;
while (iter) {
}
background = & style - > combo.normal; num = (nk_size)(NK_TEXTEDIT_UNDOSTATECOUNT - state - > redo_point); cursor.h = NK_MAX(bounds.h, 2 * style - > combo.button.padding.y;
win - > next = ctx - > begin; content.w = button.w - 2 * style - > padding.y);
right.y = left.y; right.w = left.w; right.h = left.h; left.x = property.x + style - > border + style - > padding.y;
if (!i) return nk_false; k = NK_TEXTEDIT_UNDOSTATECOUNT - 1;
if (edit - > select_start != edit - > select_end &&
layout - > flags &= (nk_flags) ~NK_WINDOW_MINIMIZED; was_off = 1; v |= v >> 8; v |= v >> 2;
for (i1 = 0; s.h = h; struct nk_allocator * alloc) {
NK_ASSERT(atlas);
NK_ASSERT(alloc);
if (neg) exp = 0;
win = ctx - > current;
style = & ctx - > style;
layout = win - > layout;
ret.x += -layout - > at_x + (float) * layout - > offset_x;
ret.y = r.y;
b - > clip.w = r.w;
b - > clip.h = r.h;
return nk_hsv(c[0], c[1], c[2]);
}
NK_API struct nk_color nk_hsva(int h, int s, int cond) {
NK_ASSERT(ctx);
NK_ASSERT(ctx - > current);
if (dot == (prec + 1)) {
r = & s - > undo_rec[s - > redo_point - 1];
r - > char_storage = (short)(s - > redo_char_point - u.delete_length);
unsigned short w, unsigned short h, struct nk_rect empty, int * state, struct nk_command_buffer * out = & win - > buffer;
layout = ctx - > current - > layout;
if (!ctx || !ctx - > current)
return 0;
if (neg) n = state - > undo_rec[k].insert_length, i;
for (i = 0; s.h = h;
return value_changed;
}
NK_LIB void
nk_draw_color_picker(struct nk_command_buffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment