# Nuklear API Quick Reference Extracted from `Minecraft.Client/ThirdParty/nuklear/nuklear.h`. --- ## Core Structs ```c struct nk_color { nk_byte r, g, b, a; }; struct nk_colorf { float r, g, b, a; }; struct nk_vec2 { float x, y; }; struct nk_vec2i { short x, y; }; struct nk_rect { float x, y, w, h; }; struct nk_recti { short x, y, w, h; }; ``` ### Constructors ```c struct nk_vec2 nk_vec2(float x, float y); struct nk_vec2 nk_vec2i(int x, int y); struct nk_vec2 nk_vec2iv(const int *xy); struct nk_rect nk_rect(float x, float y, float w, float h); struct nk_rect nk_recti(int x, int y, int w, int h); struct nk_rect nk_get_null_rect(void); struct nk_vec2 nk_rect_pos(struct nk_rect); struct nk_vec2 nk_rect_size(struct nk_rect); ``` --- ## Context (Init / Shutdown) ```c nk_bool nk_init_default(struct nk_context*, const struct nk_user_font*); nk_bool nk_init_fixed(struct nk_context*, void *memory, nk_size size, const struct nk_user_font*); nk_bool nk_init(struct nk_context*, const struct nk_allocator*, const struct nk_user_font*); nk_bool nk_init_custom(struct nk_context*, struct nk_buffer *cmds, struct nk_buffer *pool, const struct nk_user_font*); void nk_clear(struct nk_context*); void nk_free(struct nk_context*); ``` --- ## Input ```c void nk_input_begin(struct nk_context*); void nk_input_motion(struct nk_context*, int x, int y); void nk_input_key(struct nk_context*, enum nk_keys, nk_bool down); void nk_input_button(struct nk_context*, enum nk_buttons, int x, int y, nk_bool down); void nk_input_scroll(struct nk_context*, struct nk_vec2 val); void nk_input_char(struct nk_context*, char); void nk_input_glyph(struct nk_context*, const nk_glyph); void nk_input_unicode(struct nk_context*, nk_rune); void nk_input_end(struct nk_context*); ``` ### Input Query ```c nk_bool nk_input_has_mouse_click(const struct nk_input*, enum nk_buttons); nk_bool nk_input_has_mouse_click_in_rect(const struct nk_input*, enum nk_buttons, struct nk_rect); nk_bool nk_input_has_mouse_click_in_button_rect(const struct nk_input*, enum nk_buttons, struct nk_rect); nk_bool nk_input_has_mouse_click_down_in_rect(const struct nk_input*, enum nk_buttons, struct nk_rect, nk_bool down); nk_bool nk_input_is_mouse_click_in_rect(const struct nk_input*, enum nk_buttons, struct nk_rect); nk_bool nk_input_is_mouse_click_down_in_rect(const struct nk_input *i, enum nk_buttons id, struct nk_rect b, nk_bool down); nk_bool nk_input_any_mouse_click_in_rect(const struct nk_input*, struct nk_rect); nk_bool nk_input_is_mouse_prev_hovering_rect(const struct nk_input*, struct nk_rect); nk_bool nk_input_is_mouse_hovering_rect(const struct nk_input*, struct nk_rect); nk_bool nk_input_is_mouse_moved(const struct nk_input*); nk_bool nk_input_mouse_clicked(const struct nk_input*, enum nk_buttons, struct nk_rect); nk_bool nk_input_is_mouse_down(const struct nk_input*, enum nk_buttons); nk_bool nk_input_is_mouse_pressed(const struct nk_input*, enum nk_buttons); nk_bool nk_input_is_mouse_released(const struct nk_input*, enum nk_buttons); nk_bool nk_input_is_key_pressed(const struct nk_input*, enum nk_keys); nk_bool nk_input_is_key_released(const struct nk_input*, enum nk_keys); nk_bool nk_input_is_key_down(const struct nk_input*, enum nk_keys); ``` ### Input Enums ```c enum nk_keys { NK_KEY_NONE, NK_KEY_SHIFT, NK_KEY_CTRL, NK_KEY_DEL, NK_KEY_ENTER, NK_KEY_TAB, NK_KEY_BACKSPACE, NK_KEY_COPY, NK_KEY_CUT, NK_KEY_PASTE, NK_KEY_UP, NK_KEY_DOWN, NK_KEY_LEFT, NK_KEY_RIGHT, NK_KEY_TEXT_INSERT_MODE, NK_KEY_TEXT_REPLACE_MODE, NK_KEY_TEXT_RESET_MODE, NK_KEY_TEXT_LINE_START, NK_KEY_TEXT_LINE_END, NK_KEY_TEXT_START, NK_KEY_TEXT_END, NK_KEY_TEXT_UNDO, NK_KEY_TEXT_REDO, NK_KEY_TEXT_SELECT_ALL, NK_KEY_TEXT_WORD_LEFT, NK_KEY_TEXT_WORD_RIGHT, NK_KEY_SCROLL_START, NK_KEY_SCROLL_END, NK_KEY_SCROLL_DOWN, NK_KEY_SCROLL_UP, NK_KEY_MAX }; enum nk_buttons { NK_BUTTON_LEFT, NK_BUTTON_MIDDLE, NK_BUTTON_RIGHT, NK_BUTTON_DOUBLE, NK_BUTTON_X1, NK_BUTTON_X2, NK_BUTTON_MAX }; ``` --- ## Command Iteration (Software Rendering) ```c const struct nk_command* nk__begin(struct nk_context*); const struct nk_command* nk__next(struct nk_context*, const struct nk_command*); #define nk_foreach(c, ctx) for((c) = nk__begin(ctx); (c) != 0; (c) = nk__next(ctx, c)) ``` --- ## Vertex Buffer Output (Hardware Rendering) ```c nk_flags nk_convert(struct nk_context*, struct nk_buffer *cmds, struct nk_buffer *vertices, struct nk_buffer *elements, const struct nk_convert_config*); const struct nk_draw_command* nk__draw_begin(const struct nk_context*, const struct nk_buffer*); const struct nk_draw_command* nk__draw_end(const struct nk_context*, const struct nk_buffer*); const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*, const struct nk_buffer*, const struct nk_context*); ``` --- ## Window ### Window Flags (`nk_panel_flags`) ```c NK_WINDOW_BORDER, NK_WINDOW_MOVABLE, NK_WINDOW_SCALABLE, NK_WINDOW_CLOSABLE, NK_WINDOW_MINIMIZABLE, NK_WINDOW_NO_SCROLLBAR, NK_WINDOW_TITLE, NK_WINDOW_SCROLL_AUTO_HIDE, NK_WINDOW_BACKGROUND, NK_WINDOW_SCALE_LEFT, NK_WINDOW_NO_INPUT ``` ### Begin / End ```c nk_bool nk_begin(struct nk_context *ctx, const char *title, struct nk_rect bounds, nk_flags flags); nk_bool nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, struct nk_rect bounds, nk_flags flags); void nk_end(struct nk_context *ctx); ``` ### Window Query ```c struct nk_window* nk_window_find(const struct nk_context *ctx, const char *name); struct nk_rect nk_window_get_bounds(const struct nk_context *ctx); struct nk_vec2 nk_window_get_position(const struct nk_context *ctx); struct nk_vec2 nk_window_get_size(const struct nk_context *ctx); float nk_window_get_width(const struct nk_context *ctx); float nk_window_get_height(const struct nk_context *ctx); struct nk_panel* nk_window_get_panel(const struct nk_context *ctx); struct nk_rect nk_window_get_content_region(const struct nk_context *ctx); struct nk_vec2 nk_window_get_content_region_min(const struct nk_context *ctx); struct nk_vec2 nk_window_get_content_region_max(const struct nk_context *ctx); struct nk_vec2 nk_window_get_content_region_size(const struct nk_context *ctx); struct nk_command_buffer* nk_window_get_canvas(const struct nk_context *ctx); void nk_window_get_scroll(const struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y); nk_bool nk_window_has_focus(const struct nk_context *ctx); nk_bool nk_window_is_hovered(const struct nk_context *ctx); nk_bool nk_window_is_collapsed(const struct nk_context *ctx, const char *name); nk_bool nk_window_is_closed(const struct nk_context *ctx, const char *name); nk_bool nk_window_is_hidden(const struct nk_context *ctx, const char *name); nk_bool nk_window_is_active(const struct nk_context *ctx, const char *name); nk_bool nk_window_is_any_hovered(const struct nk_context *ctx); nk_bool nk_item_is_any_active(const struct nk_context *ctx); ``` ### Window Manipulation ```c void nk_window_set_bounds(struct nk_context *ctx, const char *name, struct nk_rect bounds); void nk_window_set_position(struct nk_context *ctx, const char *name, struct nk_vec2 pos); void nk_window_set_size(struct nk_context *ctx, const char *name, struct nk_vec2 size); void nk_window_set_focus(struct nk_context *ctx, const char *name); void nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y); void nk_window_close(struct nk_context *ctx, const char *name); void nk_window_collapse(struct nk_context *ctx, const char *name, enum nk_collapse_states state); void nk_window_collapse_if(struct nk_context *ctx, const char *name, enum nk_collapse_states state, int cond); void nk_window_show(struct nk_context *ctx, const char *name, enum nk_show_states state); void nk_window_show_if(struct nk_context *ctx, const char *name, enum nk_show_states state, int cond); ``` --- ## Layout ```c void nk_layout_set_min_row_height(struct nk_context*, float height); void nk_layout_reset_min_row_height(struct nk_context*); struct nk_rect nk_layout_widget_bounds(const struct nk_context *ctx); float nk_layout_ratio_from_pixel(const struct nk_context *ctx, float pixel_width); // simple rows void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols); void nk_layout_row_static(struct nk_context *ctx, float height, int item_width, int cols); // manual row building void nk_layout_row_begin(struct nk_context *ctx, enum nk_layout_format fmt, float row_height, int cols); void nk_layout_row_push(struct nk_context*, float value); void nk_layout_row_end(struct nk_context*); void nk_layout_row(struct nk_context*, enum nk_layout_format, float height, int cols, const float *ratio); // template rows void nk_layout_row_template_begin(struct nk_context*, float row_height); void nk_layout_row_template_push_dynamic(struct nk_context*); void nk_layout_row_template_push_variable(struct nk_context*, float min_width); void nk_layout_row_template_push_static(struct nk_context*, float width); void nk_layout_row_template_end(struct nk_context*); // absolute positioning void nk_layout_space_begin(struct nk_context*, enum nk_layout_format, float height, int widget_count); void nk_layout_space_push(struct nk_context*, struct nk_rect bounds); void nk_layout_space_end(struct nk_context*); struct nk_rect nk_layout_space_bounds(const struct nk_context *ctx); struct nk_vec2 nk_layout_space_to_screen(const struct nk_context *ctx, struct nk_vec2 vec); struct nk_vec2 nk_layout_space_to_local(const struct nk_context *ctx, struct nk_vec2 vec); struct nk_rect nk_layout_space_rect_to_screen(const struct nk_context *ctx, struct nk_rect bounds); struct nk_rect nk_layout_space_rect_to_local(const struct nk_context *ctx, struct nk_rect bounds); ``` --- ## Groups ```c nk_bool nk_group_begin(struct nk_context*, const char *title, nk_flags); nk_bool nk_group_begin_titled(struct nk_context*, const char *name, const char *title, nk_flags); void nk_group_end(struct nk_context*); nk_bool nk_group_scrolled_offset_begin(struct nk_context*, nk_uint *x_offset, nk_uint *y_offset, const char *title, nk_flags flags); nk_bool nk_group_scrolled_begin(struct nk_context*, struct nk_scroll *off, const char *title, nk_flags); void nk_group_scrolled_end(struct nk_context*); void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset); void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset); ``` --- ## Tree ### Macros (preferred) ```c #define nk_tree_push(ctx, type, title, state) #define nk_tree_push_id(ctx, type, title, state, id) #define nk_tree_image_push(ctx, type, img, title, state) #define nk_tree_image_push_id(ctx, type, img, title, state, id) #define nk_tree_element_push(ctx, type, title, state, sel) #define nk_tree_element_push_id(ctx, type, title, state, sel, id) ``` ### Functions ```c nk_bool nk_tree_push_hashed(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states initial_state, const char *hash, int len, int seed); nk_bool nk_tree_image_push_hashed(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states initial_state, const char *hash, int len, int seed); void nk_tree_pop(struct nk_context*); nk_bool nk_tree_state_push(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states *state); nk_bool nk_tree_state_image_push(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states *state); void nk_tree_state_pop(struct nk_context*); nk_bool nk_tree_element_push_hashed(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states initial_state, nk_bool *selected, const char *hash, int len, int seed); nk_bool nk_tree_element_image_push_hashed(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states initial_state, nk_bool *selected, const char *hash, int len, int seed); void nk_tree_element_pop(struct nk_context*); ``` --- ## Widget Utilities ```c enum nk_widget_layout_states nk_widget(struct nk_rect*, const struct nk_context*); enum nk_widget_layout_states nk_widget_fitting(struct nk_rect*, const struct nk_context*, struct nk_vec2); struct nk_rect nk_widget_bounds(const struct nk_context*); struct nk_vec2 nk_widget_position(const struct nk_context*); struct nk_vec2 nk_widget_size(const struct nk_context*); float nk_widget_width(const struct nk_context*); float nk_widget_height(const struct nk_context*); nk_bool nk_widget_is_hovered(const struct nk_context*); nk_bool nk_widget_is_mouse_clicked(const struct nk_context*, enum nk_buttons); nk_bool nk_widget_has_mouse_click_down(const struct nk_context*, enum nk_buttons, nk_bool down); void nk_spacing(struct nk_context*, int cols); void nk_spacer(struct nk_context *ctx); void nk_widget_disable_begin(struct nk_context *ctx); void nk_widget_disable_end(struct nk_context *ctx); ``` --- ## Text / Labels ### Text Alignment ```c enum nk_text_align { NK_TEXT_ALIGN_LEFT = 0x01, NK_TEXT_ALIGN_CENTERED = 0x02, NK_TEXT_ALIGN_RIGHT = 0x04, NK_TEXT_ALIGN_TOP = 0x08, NK_TEXT_ALIGN_MIDDLE = 0x10, NK_TEXT_ALIGN_BOTTOM = 0x20 }; enum nk_text_alignment { NK_TEXT_LEFT = NK_TEXT_ALIGN_MIDDLE | NK_TEXT_ALIGN_LEFT, NK_TEXT_CENTERED = NK_TEXT_ALIGN_MIDDLE | NK_TEXT_ALIGN_CENTERED, NK_TEXT_RIGHT = NK_TEXT_ALIGN_MIDDLE | NK_TEXT_ALIGN_RIGHT }; ``` ### nk_text ```c void nk_text(struct nk_context*, const char*, int, nk_flags); void nk_text_colored(struct nk_context*, const char*, int, nk_flags, struct nk_color); void nk_text_wrap(struct nk_context*, const char*, int); void nk_text_wrap_colored(struct nk_context*, const char*, int, struct nk_color); ``` ### nk_label ```c void nk_label(struct nk_context*, const char*, nk_flags align); void nk_label_colored(struct nk_context*, const char*, nk_flags align, struct nk_color); void nk_label_wrap(struct nk_context*, const char*); void nk_label_colored_wrap(struct nk_context*, const char*, struct nk_color); ``` ### nk_labelf (printf-style) ```c void nk_labelf(struct nk_context*, nk_flags, const char*, ...); void nk_labelf_colored(struct nk_context*, nk_flags, struct nk_color, const char*, ...); void nk_labelf_wrap(struct nk_context*, const char*, ...); void nk_labelf_colored_wrap(struct nk_context*, struct nk_color, const char*, ...); void nk_labelfv(struct nk_context*, nk_flags, const char*, va_list); void nk_labelfv_colored(struct nk_context*, nk_flags, struct nk_color, const char*, va_list); void nk_labelfv_wrap(struct nk_context*, const char*, va_list); void nk_labelfv_colored_wrap(struct nk_context*, struct nk_color, const char*, va_list); ``` ### nk_value (debug display) ```c void nk_value_bool(struct nk_context*, const char *prefix, int); void nk_value_int(struct nk_context*, const char *prefix, int); void nk_value_uint(struct nk_context*, const char *prefix, unsigned int); void nk_value_float(struct nk_context*, const char *prefix, float); void nk_value_color_byte(struct nk_context*, const char *prefix, struct nk_color); void nk_value_color_float(struct nk_context*, const char *prefix, struct nk_color); void nk_value_color_hex(struct nk_context*, const char *prefix, struct nk_color); ``` --- ## Image Widget ```c void nk_image(struct nk_context*, struct nk_image); void nk_image_color(struct nk_context*, struct nk_image, struct nk_color); ``` ### Image Construction ```c struct nk_image nk_image_handle(nk_handle); struct nk_image nk_image_ptr(void*); struct nk_image nk_image_id(int); nk_bool nk_image_is_subimage(const struct nk_image *img); struct nk_image nk_subimage_ptr(void*, nk_ushort w, nk_ushort h, struct nk_rect sub_region); struct nk_image nk_subimage_id(int, nk_ushort w, nk_ushort h, struct nk_rect sub_region); struct nk_image nk_subimage_handle(nk_handle, nk_ushort w, nk_ushort h, struct nk_rect sub_region); ``` ### Nine-Slice ```c struct nk_nine_slice nk_nine_slice_handle(nk_handle, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b); struct nk_nine_slice nk_nine_slice_ptr(void*, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b); struct nk_nine_slice nk_nine_slice_id(int, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b); int nk_nine_slice_is_sub9slice(const struct nk_nine_slice *img); struct nk_nine_slice nk_sub9slice_ptr(void*, nk_ushort w, nk_ushort h, struct nk_rect sub_region, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b); struct nk_nine_slice nk_sub9slice_id(int, nk_ushort w, nk_ushort h, struct nk_rect sub_region, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b); struct nk_nine_slice nk_sub9slice_handle(nk_handle, nk_ushort w, nk_ushort h, struct nk_rect sub_region, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b); ``` --- ## Buttons ```c nk_bool nk_button_text(struct nk_context*, const char *title, int len); nk_bool nk_button_label(struct nk_context*, const char *title); nk_bool nk_button_color(struct nk_context*, struct nk_color); nk_bool nk_button_symbol(struct nk_context*, enum nk_symbol_type); nk_bool nk_button_image(struct nk_context*, struct nk_image img); nk_bool nk_button_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags text_alignment); nk_bool nk_button_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags alignment); nk_bool nk_button_image_label(struct nk_context*, struct nk_image img, const char*, nk_flags text_alignment); nk_bool nk_button_image_text(struct nk_context*, struct nk_image img, const char*, int, nk_flags alignment); ``` ### Styled Buttons ```c nk_bool nk_button_text_styled(struct nk_context*, const struct nk_style_button*, const char *title, int len); nk_bool nk_button_label_styled(struct nk_context*, const struct nk_style_button*, const char *title); nk_bool nk_button_symbol_styled(struct nk_context*, const struct nk_style_button*, enum nk_symbol_type); nk_bool nk_button_image_styled(struct nk_context*, const struct nk_style_button*, struct nk_image img); nk_bool nk_button_symbol_text_styled(struct nk_context*, const struct nk_style_button*, enum nk_symbol_type, const char*, int, nk_flags alignment); 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); nk_bool nk_button_image_label_styled(struct nk_context*, const struct nk_style_button*, struct nk_image img, const char*, nk_flags text_alignment); nk_bool nk_button_image_text_styled(struct nk_context*, const struct nk_style_button*, struct nk_image img, const char*, int, nk_flags alignment); ``` ### Button Behavior ```c void nk_button_set_behavior(struct nk_context*, enum nk_button_behavior); nk_bool nk_button_push_behavior(struct nk_context*, enum nk_button_behavior); nk_bool nk_button_pop_behavior(struct nk_context*); ``` ### Symbol Types ```c enum nk_symbol_type { NK_SYMBOL_NONE, NK_SYMBOL_X, NK_SYMBOL_UNDERSCORE, NK_SYMBOL_CIRCLE_SOLID, NK_SYMBOL_CIRCLE_OUTLINE, NK_SYMBOL_RECT_SOLID, NK_SYMBOL_RECT_OUTLINE, NK_SYMBOL_TRIANGLE_UP, NK_SYMBOL_TRIANGLE_DOWN, NK_SYMBOL_TRIANGLE_LEFT, NK_SYMBOL_TRIANGLE_RIGHT, NK_SYMBOL_PLUS, NK_SYMBOL_MINUS, NK_SYMBOL_TRIANGLE_UP_OUTLINE, NK_SYMBOL_TRIANGLE_DOWN_OUTLINE, NK_SYMBOL_TRIANGLE_LEFT_OUTLINE, NK_SYMBOL_TRIANGLE_RIGHT_OUTLINE, NK_SYMBOL_MAX }; ``` --- ## Checkbox ```c nk_bool nk_checkbox_label(struct nk_context*, const char*, nk_bool *active); nk_bool nk_checkbox_label_align(struct nk_context *ctx, const char *label, nk_bool *active, nk_flags widget_alignment, nk_flags text_alignment); nk_bool nk_checkbox_text(struct nk_context*, const char*, int, nk_bool *active); nk_bool nk_checkbox_text_align(struct nk_context *ctx, const char *text, int len, nk_bool *active, nk_flags widget_alignment, nk_flags text_alignment); nk_bool nk_checkbox_flags_label(struct nk_context*, const char*, unsigned int *flags, unsigned int value); nk_bool nk_checkbox_flags_text(struct nk_context*, const char*, int, unsigned int *flags, unsigned int value); ``` --- ## Radio / Option ```c nk_bool nk_radio_label(struct nk_context*, const char*, nk_bool *active); nk_bool nk_radio_label_align(struct nk_context *ctx, const char *label, nk_bool *active, nk_flags widget_alignment, nk_flags text_alignment); nk_bool nk_radio_text(struct nk_context*, const char*, int, nk_bool *active); nk_bool nk_radio_text_align(struct nk_context *ctx, const char *text, int len, nk_bool *active, nk_flags widget_alignment, nk_flags text_alignment); nk_bool nk_option_label(struct nk_context*, const char*, nk_bool active); nk_bool nk_option_label_align(struct nk_context *ctx, const char *label, nk_bool active, nk_flags widget_alignment, nk_flags text_alignment); nk_bool nk_option_text(struct nk_context*, const char*, int, nk_bool active); nk_bool nk_option_text_align(struct nk_context *ctx, const char *text, int len, nk_bool is_active, nk_flags widget_alignment, nk_flags text_alignment); ``` --- ## Selectable ```c // mutable (pointer to value) nk_bool nk_selectable_label(struct nk_context*, const char*, nk_flags align, nk_bool *value); nk_bool nk_selectable_text(struct nk_context*, const char*, int, nk_flags align, nk_bool *value); nk_bool nk_selectable_image_label(struct nk_context*, struct nk_image, const char*, nk_flags align, nk_bool *value); nk_bool nk_selectable_image_text(struct nk_context*, struct nk_image, const char*, int, nk_flags align, nk_bool *value); nk_bool nk_selectable_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags align, nk_bool *value); nk_bool nk_selectable_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags align, nk_bool *value); // immutable (value by copy, returns new state) nk_bool nk_select_label(struct nk_context*, const char*, nk_flags align, nk_bool value); nk_bool nk_select_text(struct nk_context*, const char*, int, nk_flags align, nk_bool value); nk_bool nk_select_image_label(struct nk_context*, struct nk_image, const char*, nk_flags align, nk_bool value); nk_bool nk_select_image_text(struct nk_context*, struct nk_image, const char*, int, nk_flags align, nk_bool value); nk_bool nk_select_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags align, nk_bool value); nk_bool nk_select_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags align, nk_bool value); ``` --- ## Slider ```c nk_bool nk_slider_float(struct nk_context*, float min, float *val, float max, float step); nk_bool nk_slider_int(struct nk_context*, int min, int *val, int max, int step); ``` --- ## Progress Bar ```c nk_bool nk_progress(struct nk_context*, nk_size *cur, nk_size max, nk_bool modifyable); nk_size nk_prog(struct nk_context*, nk_size cur, nk_size max, nk_bool modifyable); ``` --- ## Property (Drag + Increment) ```c // mutable (pointer to val) nk_bool nk_property_int(struct nk_context*, const char *name, int min, int *val, int max, int step, float inc_per_pixel); nk_bool nk_property_float(struct nk_context*, const char *name, float min, float *val, float max, float step, float inc_per_pixel); nk_bool nk_property_double(struct nk_context*, const char *name, double min, double *val, double max, double step, float inc_per_pixel); // immutable (returns new value) int nk_propertyi(struct nk_context*, const char *name, int min, int val, int max, int step, float inc_per_pixel); float nk_propertyf(struct nk_context*, const char *name, float min, float val, float max, float step, float inc_per_pixel); double nk_propertyd(struct nk_context*, const char *name, double min, double val, double max, double step, float inc_per_pixel); ``` --- ## Color Picker ```c struct nk_colorf nk_color_picker(struct nk_context*, struct nk_colorf, enum nk_color_format); nk_bool nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_color_format); ``` --- ## Edit (Text Input) ### Edit Flags ```c enum nk_edit_flags { NK_EDIT_DEFAULT = 0, NK_EDIT_READ_ONLY, NK_EDIT_AUTO_SELECT, NK_EDIT_SIG_ENTER, NK_EDIT_ALLOW_TAB, NK_EDIT_NO_CURSOR, NK_EDIT_SELECTABLE, NK_EDIT_CLIPBOARD, NK_EDIT_CTRL_ENTER_NEWLINE, NK_EDIT_NO_HORIZONTAL_SCROLL, NK_EDIT_ALWAYS_INSERT_MODE, NK_EDIT_MULTILINE, NK_EDIT_GOTO_END_ON_ACTIVATE }; enum nk_edit_types { NK_EDIT_SIMPLE, NK_EDIT_FIELD, NK_EDIT_BOX, NK_EDIT_EDITOR }; enum nk_edit_events { NK_EDIT_ACTIVE, NK_EDIT_INACTIVE, NK_EDIT_ACTIVATED, NK_EDIT_DEACTIVATED, NK_EDIT_COMMITED }; ``` ### Edit Functions ```c nk_flags nk_edit_string(struct nk_context*, nk_flags, char *buffer, int *len, int max, nk_plugin_filter); nk_flags nk_edit_string_zero_terminated(struct nk_context*, nk_flags, char *buffer, int max, nk_plugin_filter); nk_flags nk_edit_buffer(struct nk_context*, nk_flags, struct nk_text_edit*, nk_plugin_filter); void nk_edit_focus(struct nk_context*, nk_flags flags); void nk_edit_unfocus(struct nk_context*); ``` ### Text Edit (Low-Level) ```c void nk_textedit_init_default(struct nk_text_edit*); void nk_textedit_init(struct nk_text_edit*, const struct nk_allocator*, nk_size size); void nk_textedit_init_fixed(struct nk_text_edit*, void *memory, nk_size size); void nk_textedit_free(struct nk_text_edit*); void nk_textedit_text(struct nk_text_edit*, const char*, int total_len); void nk_textedit_delete(struct nk_text_edit*, int where, int len); void nk_textedit_delete_selection(struct nk_text_edit*); void nk_textedit_select_all(struct nk_text_edit*); nk_bool nk_textedit_cut(struct nk_text_edit*); nk_bool nk_textedit_paste(struct nk_text_edit*, char const*, int len); void nk_textedit_undo(struct nk_text_edit*); void nk_textedit_redo(struct nk_text_edit*); ``` ### Filters ```c nk_bool nk_filter_default(const struct nk_text_edit*, nk_rune unicode); nk_bool nk_filter_ascii(const struct nk_text_edit*, nk_rune unicode); nk_bool nk_filter_float(const struct nk_text_edit*, nk_rune unicode); nk_bool nk_filter_decimal(const struct nk_text_edit*, nk_rune unicode); nk_bool nk_filter_hex(const struct nk_text_edit*, nk_rune unicode); nk_bool nk_filter_oct(const struct nk_text_edit*, nk_rune unicode); nk_bool nk_filter_binary(const struct nk_text_edit*, nk_rune unicode); ``` --- ## Chart ```c nk_bool nk_chart_begin(struct nk_context*, enum nk_chart_type, int num, float min, float max); nk_bool nk_chart_begin_colored(struct nk_context*, enum nk_chart_type, struct nk_color, struct nk_color active, int num, float min, float max); void nk_chart_add_slot(struct nk_context *ctx, const enum nk_chart_type, int count, float min_value, float max_value); void nk_chart_add_slot_colored(struct nk_context *ctx, const enum nk_chart_type, struct nk_color, struct nk_color active, int count, float min_value, float max_value); nk_flags nk_chart_push(struct nk_context*, float); nk_flags nk_chart_push_slot(struct nk_context*, float, int); void nk_chart_end(struct nk_context*); void nk_plot(struct nk_context*, enum nk_chart_type, const float *values, int count, int offset); void nk_plot_function(struct nk_context*, enum nk_chart_type, void *userdata, float(*value_getter)(void* user, int index), int count, int offset); ``` --- ## Popup ```c nk_bool nk_popup_begin(struct nk_context*, enum nk_popup_type, const char*, nk_flags, struct nk_rect bounds); void nk_popup_close(struct nk_context*); void nk_popup_end(struct nk_context*); void nk_popup_get_scroll(const struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); void nk_popup_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y); ``` --- ## Combo (Dropdown) ### Simple (returns selected index) ```c int nk_combo(struct nk_context*, const char *const *items, int count, int selected, int item_height, struct nk_vec2 size); int nk_combo_separator(struct nk_context*, const char *items_separated_by_separator, int separator, int selected, int count, int item_height, struct nk_vec2 size); int nk_combo_string(struct nk_context*, const char *items_separated_by_zeros, int selected, int count, int item_height, struct nk_vec2 size); int nk_combo_callback(struct nk_context*, void(*item_getter)(void*, int, const char**), void *userdata, int selected, int count, int item_height, struct nk_vec2 size); ``` ### Combobox (mutable selected) ```c nk_bool nk_combobox(struct nk_context*, const char *const *items, int count, int *selected, int item_height, struct nk_vec2 size); nk_bool nk_combobox_string(struct nk_context*, const char *items_separated_by_zeros, int *selected, int count, int item_height, struct nk_vec2 size); nk_bool nk_combobox_separator(struct nk_context*, const char *items_separated_by_separator, int separator, int *selected, int count, int item_height, struct nk_vec2 size); nk_bool nk_combobox_callback(struct nk_context*, void(*item_getter)(void*, int, const char**), void*, int *selected, int count, int item_height, struct nk_vec2 size); ``` ### Abstract Combo (custom content) ```c nk_bool nk_combo_begin_text(struct nk_context*, const char *selected, int, struct nk_vec2 size); nk_bool nk_combo_begin_label(struct nk_context*, const char *selected, struct nk_vec2 size); nk_bool nk_combo_begin_color(struct nk_context*, struct nk_color color, struct nk_vec2 size); nk_bool nk_combo_begin_symbol(struct nk_context*, enum nk_symbol_type, struct nk_vec2 size); nk_bool nk_combo_begin_symbol_label(struct nk_context*, const char *selected, enum nk_symbol_type, struct nk_vec2 size); nk_bool nk_combo_begin_symbol_text(struct nk_context*, const char *selected, int, enum nk_symbol_type, struct nk_vec2 size); nk_bool nk_combo_begin_image(struct nk_context*, struct nk_image img, struct nk_vec2 size); nk_bool nk_combo_begin_image_label(struct nk_context*, const char *selected, struct nk_image, struct nk_vec2 size); nk_bool nk_combo_begin_image_text(struct nk_context*, const char *selected, int, struct nk_image, struct nk_vec2 size); nk_bool nk_combo_item_label(struct nk_context*, const char*, nk_flags alignment); nk_bool nk_combo_item_text(struct nk_context*, const char*, int, nk_flags alignment); nk_bool nk_combo_item_image_label(struct nk_context*, struct nk_image, const char*, nk_flags alignment); nk_bool nk_combo_item_image_text(struct nk_context*, struct nk_image, const char*, int, nk_flags alignment); nk_bool nk_combo_item_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags alignment); nk_bool nk_combo_item_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags alignment); void nk_combo_close(struct nk_context*); void nk_combo_end(struct nk_context*); ``` --- ## Contextual (Right-Click Menu) ```c nk_bool nk_contextual_begin(struct nk_context*, nk_flags, struct nk_vec2, struct nk_rect trigger_bounds); nk_bool nk_contextual_item_text(struct nk_context*, const char*, int, nk_flags align); nk_bool nk_contextual_item_label(struct nk_context*, const char*, nk_flags align); nk_bool nk_contextual_item_image_label(struct nk_context*, struct nk_image, const char*, nk_flags alignment); nk_bool nk_contextual_item_image_text(struct nk_context*, struct nk_image, const char*, int len, nk_flags alignment); nk_bool nk_contextual_item_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags alignment); nk_bool nk_contextual_item_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags alignment); void nk_contextual_close(struct nk_context*); void nk_contextual_end(struct nk_context*); ``` --- ## Tooltip ```c void nk_tooltip(struct nk_context*, const char*); void nk_tooltip_offset(struct nk_context *ctx, const char *text, enum nk_tooltip_pos position, struct nk_vec2 offset); void nk_tooltipf(struct nk_context*, const char*, ...); void nk_tooltipfv(struct nk_context*, const char*, va_list); void nk_tooltipf_offset(struct nk_context*, enum nk_tooltip_pos, struct nk_vec2, const char*, ...); void nk_tooltipfv_offset(struct nk_context*, enum nk_tooltip_pos, struct nk_vec2, const char*, va_list); nk_bool nk_tooltip_begin(struct nk_context*, float width); nk_bool nk_tooltip_begin_offset(struct nk_context*, float, enum nk_tooltip_pos, struct nk_vec2); void nk_tooltip_end(struct nk_context*); ``` --- ## Menubar / Menu ```c void nk_menubar_begin(struct nk_context*); void nk_menubar_end(struct nk_context*); nk_bool nk_menu_begin_text(struct nk_context*, const char *title, int title_len, nk_flags align, struct nk_vec2 size); nk_bool nk_menu_begin_label(struct nk_context*, const char*, nk_flags align, struct nk_vec2 size); nk_bool nk_menu_begin_image(struct nk_context*, const char*, struct nk_image, struct nk_vec2 size); nk_bool nk_menu_begin_image_text(struct nk_context*, const char*, int, nk_flags align, struct nk_image, struct nk_vec2 size); nk_bool nk_menu_begin_image_label(struct nk_context*, const char*, nk_flags align, struct nk_image, struct nk_vec2 size); nk_bool nk_menu_begin_symbol(struct nk_context*, const char*, enum nk_symbol_type, struct nk_vec2 size); nk_bool nk_menu_begin_symbol_text(struct nk_context*, const char*, int, nk_flags align, enum nk_symbol_type, struct nk_vec2 size); nk_bool nk_menu_begin_symbol_label(struct nk_context*, const char*, nk_flags align, enum nk_symbol_type, struct nk_vec2 size); nk_bool nk_menu_item_text(struct nk_context*, const char*, int, nk_flags align); nk_bool nk_menu_item_label(struct nk_context*, const char*, nk_flags alignment); nk_bool nk_menu_item_image_label(struct nk_context*, struct nk_image, const char*, nk_flags alignment); nk_bool nk_menu_item_image_text(struct nk_context*, struct nk_image, const char*, int len, nk_flags alignment); nk_bool nk_menu_item_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags alignment); nk_bool nk_menu_item_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags alignment); void nk_menu_close(struct nk_context*); void nk_menu_end(struct nk_context*); ``` --- ## Horizontal Rule ```c void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk_bool rounding); ``` --- ## Style ### Global Style ```c void nk_style_default(struct nk_context*); void nk_style_from_table(struct nk_context*, const struct nk_color*); void nk_style_load_cursor(struct nk_context*, enum nk_style_cursor, const struct nk_cursor*); void nk_style_load_all_cursors(struct nk_context*, const struct nk_cursor*); const char* nk_style_get_color_by_name(enum nk_style_colors); void nk_style_set_font(struct nk_context*, const struct nk_user_font*); nk_bool nk_style_set_cursor(struct nk_context*, enum nk_style_cursor); void nk_style_show_cursor(struct nk_context*); void nk_style_hide_cursor(struct nk_context*); ``` ### Style Stack (Push / Pop) ```c nk_bool nk_style_push_font(struct nk_context*, const struct nk_user_font*); nk_bool nk_style_push_float(struct nk_context*, float*, float); nk_bool nk_style_push_vec2(struct nk_context*, struct nk_vec2*, struct nk_vec2); nk_bool nk_style_push_style_item(struct nk_context*, struct nk_style_item*, struct nk_style_item); nk_bool nk_style_push_flags(struct nk_context*, nk_flags*, nk_flags); nk_bool nk_style_push_color(struct nk_context*, struct nk_color*, struct nk_color); nk_bool nk_style_pop_font(struct nk_context*); nk_bool nk_style_pop_float(struct nk_context*); nk_bool nk_style_pop_vec2(struct nk_context*); nk_bool nk_style_pop_style_item(struct nk_context*); nk_bool nk_style_pop_flags(struct nk_context*); nk_bool nk_style_pop_color(struct nk_context*); ``` ### Style Item Construction ```c struct nk_style_item nk_style_item_color(struct nk_color); struct nk_style_item nk_style_item_image(struct nk_image img); struct nk_style_item nk_style_item_nine_slice(struct nk_nine_slice slice); struct nk_style_item nk_style_item_hide(void); ``` --- ## Color Construction ### RGB ```c struct nk_color nk_rgb(int r, int g, int b); struct nk_color nk_rgb_iv(const int *rgb); struct nk_color nk_rgb_bv(const nk_byte *rgb); struct nk_color nk_rgb_f(float r, float g, float b); struct nk_color nk_rgb_fv(const float *rgb); struct nk_color nk_rgb_cf(struct nk_colorf c); struct nk_color nk_rgb_hex(const char *rgb); struct nk_color nk_rgb_factor(struct nk_color col, float factor); ``` ### RGBA ```c struct nk_color nk_rgba(int r, int g, int b, int a); struct nk_color nk_rgba_u32(nk_uint); struct nk_color nk_rgba_iv(const int *rgba); struct nk_color nk_rgba_bv(const nk_byte *rgba); struct nk_color nk_rgba_f(float r, float g, float b, float a); struct nk_color nk_rgba_fv(const float *rgba); struct nk_color nk_rgba_cf(struct nk_colorf c); struct nk_color nk_rgba_hex(const char *rgb); ``` ### HSV / HSVA ```c struct nk_color nk_hsv(int h, int s, int v); struct nk_color nk_hsv_iv(const int *hsv); struct nk_color nk_hsv_bv(const nk_byte *hsv); struct nk_color nk_hsv_f(float h, float s, float v); struct nk_color nk_hsv_fv(const float *hsv); struct nk_color nk_hsva(int h, int s, int v, int a); struct nk_color nk_hsva_iv(const int *hsva); struct nk_color nk_hsva_bv(const nk_byte *hsva); struct nk_color nk_hsva_f(float h, float s, float v, float a); struct nk_color nk_hsva_fv(const float *hsva); struct nk_colorf nk_hsva_colorf(float h, float s, float v, float a); struct nk_colorf nk_hsva_colorfv(const float *c); ``` ### Color Decomposition ```c void nk_color_f(float *r, float *g, float *b, float *a, struct nk_color); void nk_color_fv(float *rgba_out, struct nk_color); struct nk_colorf nk_color_cf(struct nk_color); void nk_color_d(double *r, double *g, double *b, double *a, struct nk_color); void nk_color_dv(double *rgba_out, struct nk_color); nk_uint nk_color_u32(struct nk_color); void nk_color_hex_rgba(char *output, struct nk_color); void nk_color_hex_rgb(char *output, struct nk_color); ``` ### Color to HSV ```c void nk_color_hsv_i(int *out_h, int *out_s, int *out_v, struct nk_color); void nk_color_hsv_b(nk_byte *out_h, nk_byte *out_s, nk_byte *out_v, struct nk_color); void nk_color_hsv_iv(int *hsv_out, struct nk_color); void nk_color_hsv_bv(nk_byte *hsv_out, struct nk_color); void nk_color_hsv_f(float *out_h, float *out_s, float *out_v, struct nk_color); void nk_color_hsv_fv(float *hsv_out, struct nk_color); void nk_color_hsva_i(int *h, int *s, int *v, int *a, struct nk_color); void nk_color_hsva_b(nk_byte *h, nk_byte *s, nk_byte *v, nk_byte *a, struct nk_color); void nk_color_hsva_iv(int *hsva_out, struct nk_color); void nk_color_hsva_bv(nk_byte *hsva_out, struct nk_color); void nk_color_hsva_f(float *out_h, float *out_s, float *out_v, float *out_a, struct nk_color); void nk_color_hsva_fv(float *hsva_out, struct nk_color); void nk_colorf_hsva_f(float *out_h, float *out_s, float *out_v, float *out_a, struct nk_colorf in); void nk_colorf_hsva_fv(float *hsva, struct nk_colorf in); ``` --- ## Custom Drawing (Command Buffer) ### Stroke (Outline) ```c void nk_stroke_line(struct nk_command_buffer *b, float x0, float y0, float x1, float y1, float line_thickness, struct nk_color); void nk_stroke_curve(struct nk_command_buffer*, float, float, float, float, float, float, float, float, float line_thickness, struct nk_color); void nk_stroke_rect(struct nk_command_buffer*, struct nk_rect, float rounding, float line_thickness, struct nk_color); void nk_stroke_circle(struct nk_command_buffer*, struct nk_rect, float line_thickness, struct nk_color); 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); void nk_stroke_triangle(struct nk_command_buffer*, float, float, float, float, float, float, float line_thickness, struct nk_color); void nk_stroke_polyline(struct nk_command_buffer*, const float *points, int point_count, float line_thickness, struct nk_color col); void nk_stroke_polygon(struct nk_command_buffer*, const float *points, int point_count, float line_thickness, struct nk_color); ``` ### Fill (Solid) ```c void nk_fill_rect(struct nk_command_buffer*, struct nk_rect, float rounding, struct nk_color); 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); void nk_fill_circle(struct nk_command_buffer*, struct nk_rect, struct nk_color); void nk_fill_arc(struct nk_command_buffer*, float cx, float cy, float radius, float a_min, float a_max, struct nk_color); void nk_fill_triangle(struct nk_command_buffer*, float x0, float y0, float x1, float y1, float x2, float y2, struct nk_color); void nk_fill_polygon(struct nk_command_buffer*, const float *points, int point_count, struct nk_color); ``` ### Draw Image / Text ```c void nk_draw_image(struct nk_command_buffer*, struct nk_rect, const struct nk_image*, struct nk_color); void nk_draw_nine_slice(struct nk_command_buffer*, struct nk_rect, const struct nk_nine_slice*, struct nk_color); void nk_draw_text(struct nk_command_buffer*, struct nk_rect, const char *text, int len, const struct nk_user_font*, struct nk_color bg, struct nk_color fg); ``` --- ## Draw List (Vertex Buffer Level) ### Setup ```c void nk_draw_list_init(struct nk_draw_list*); void nk_draw_list_setup(struct nk_draw_list*, const struct nk_convert_config*, struct nk_buffer *cmds, struct nk_buffer *vertices, struct nk_buffer *elements, enum nk_anti_aliasing line_aa, enum nk_anti_aliasing shape_aa); ``` ### Iteration ```c const struct nk_draw_command* nk__draw_list_begin(const struct nk_draw_list*, const struct nk_buffer*); const struct nk_draw_command* nk__draw_list_next(const struct nk_draw_command*, const struct nk_buffer*, const struct nk_draw_list*); const struct nk_draw_command* nk__draw_list_end(const struct nk_draw_list*, const struct nk_buffer*); ``` ### Path ```c void nk_draw_list_path_clear(struct nk_draw_list*); void nk_draw_list_path_line_to(struct nk_draw_list*, struct nk_vec2 pos); void nk_draw_list_path_arc_to_fast(struct nk_draw_list*, struct nk_vec2 center, float radius, int a_min, int a_max); void nk_draw_list_path_arc_to(struct nk_draw_list*, struct nk_vec2 center, float radius, float a_min, float a_max, unsigned int segments); void nk_draw_list_path_rect_to(struct nk_draw_list*, struct nk_vec2 a, struct nk_vec2 b, float rounding); void nk_draw_list_path_curve_to(struct nk_draw_list*, struct nk_vec2 p2, struct nk_vec2 p3, struct nk_vec2 p4, unsigned int num_segments); void nk_draw_list_path_fill(struct nk_draw_list*, struct nk_color); void nk_draw_list_path_stroke(struct nk_draw_list*, struct nk_color, enum nk_draw_list_stroke closed, float thickness); ``` ### Draw List Primitives ```c void nk_draw_list_stroke_line(struct nk_draw_list*, struct nk_vec2 a, struct nk_vec2 b, struct nk_color, float thickness); void nk_draw_list_stroke_rect(struct nk_draw_list*, struct nk_rect rect, struct nk_color, float rounding, float thickness); void nk_draw_list_stroke_triangle(struct nk_draw_list*, struct nk_vec2 a, struct nk_vec2 b, struct nk_vec2 c, struct nk_color, float thickness); void nk_draw_list_stroke_circle(struct nk_draw_list*, struct nk_vec2 center, float radius, struct nk_color, unsigned int segs, float thickness); void nk_draw_list_stroke_curve(struct nk_draw_list*, struct nk_vec2 p0, struct nk_vec2 cp0, struct nk_vec2 cp1, struct nk_vec2 p1, struct nk_color, unsigned int segments, float thickness); void nk_draw_list_stroke_poly_line(struct nk_draw_list*, const struct nk_vec2 *pnts, const unsigned int cnt, struct nk_color, enum nk_draw_list_stroke, float thickness, enum nk_anti_aliasing); void nk_draw_list_fill_rect(struct nk_draw_list*, struct nk_rect rect, struct nk_color, float rounding); void nk_draw_list_fill_rect_multi_color(struct nk_draw_list*, struct nk_rect rect, struct nk_color left, struct nk_color top, struct nk_color right, struct nk_color bottom); void nk_draw_list_fill_triangle(struct nk_draw_list*, struct nk_vec2 a, struct nk_vec2 b, struct nk_vec2 c, struct nk_color); void nk_draw_list_fill_circle(struct nk_draw_list*, struct nk_vec2 center, float radius, struct nk_color col, unsigned int segs); void nk_draw_list_fill_poly_convex(struct nk_draw_list*, const struct nk_vec2 *points, const unsigned int count, struct nk_color, enum nk_anti_aliasing); void nk_draw_list_add_image(struct nk_draw_list*, struct nk_image texture, struct nk_rect rect, struct nk_color); void nk_draw_list_add_text(struct nk_draw_list*, const struct nk_user_font*, struct nk_rect, const char *text, int len, float font_height, struct nk_color); void nk_draw_list_push_userdata(struct nk_draw_list*, nk_handle userdata); ``` --- ## Font Atlas ```c struct nk_font_config nk_font_config(float pixel_height); void nk_font_atlas_init_default(struct nk_font_atlas*); void nk_font_atlas_init(struct nk_font_atlas*, const struct nk_allocator*); void nk_font_atlas_init_custom(struct nk_font_atlas*, const struct nk_allocator *persistent, const struct nk_allocator *transient); void nk_font_atlas_begin(struct nk_font_atlas*); struct nk_font* nk_font_atlas_add(struct nk_font_atlas*, const struct nk_font_config*); struct nk_font* nk_font_atlas_add_default(struct nk_font_atlas*, float height, const struct nk_font_config*); struct nk_font* nk_font_atlas_add_from_memory(struct nk_font_atlas *atlas, void *memory, nk_size size, float height, const struct nk_font_config *config); struct nk_font* nk_font_atlas_add_from_file(struct nk_font_atlas *atlas, const char *file_path, float height, const struct nk_font_config*); struct nk_font* nk_font_atlas_add_compressed(struct nk_font_atlas*, void *memory, nk_size size, float height, const struct nk_font_config*); struct nk_font* nk_font_atlas_add_compressed_base85(struct nk_font_atlas*, const char *data, float height, const struct nk_font_config *config); const void* nk_font_atlas_bake(struct nk_font_atlas*, int *width, int *height, enum nk_font_atlas_format); void nk_font_atlas_end(struct nk_font_atlas*, nk_handle tex, struct nk_draw_null_texture*); void nk_font_atlas_cleanup(struct nk_font_atlas *atlas); void nk_font_atlas_clear(struct nk_font_atlas*); const struct nk_font_glyph* nk_font_find_glyph(const struct nk_font*, nk_rune unicode); ``` --- ## Buffer ```c void nk_buffer_init_default(struct nk_buffer*); void nk_buffer_init(struct nk_buffer*, const struct nk_allocator*, nk_size size); void nk_buffer_init_fixed(struct nk_buffer*, void *memory, nk_size size); void nk_buffer_info(struct nk_memory_status*, const struct nk_buffer*); void nk_buffer_push(struct nk_buffer*, enum nk_buffer_allocation_type type, const void *memory, nk_size size, nk_size align); void nk_buffer_mark(struct nk_buffer*, enum nk_buffer_allocation_type type); void nk_buffer_reset(struct nk_buffer*, enum nk_buffer_allocation_type type); void nk_buffer_clear(struct nk_buffer*); void nk_buffer_free(struct nk_buffer*); void* nk_buffer_memory(struct nk_buffer*); const void* nk_buffer_memory_const(const struct nk_buffer*); nk_size nk_buffer_total(const struct nk_buffer*); ``` --- ## String (nk_str) ```c void nk_str_init_default(struct nk_str*); void nk_str_init(struct nk_str*, const struct nk_allocator*, nk_size size); void nk_str_init_fixed(struct nk_str*, void *memory, nk_size size); void nk_str_clear(struct nk_str*); void nk_str_free(struct nk_str*); int nk_str_append_text_char(struct nk_str*, const char*, int); int nk_str_append_str_char(struct nk_str*, const char*); int nk_str_append_text_utf8(struct nk_str*, const char*, int); int nk_str_append_str_utf8(struct nk_str*, const char*); int nk_str_append_text_runes(struct nk_str*, const nk_rune*, int); int nk_str_append_str_runes(struct nk_str*, const nk_rune*); int nk_str_insert_at_char(struct nk_str*, int pos, const char*, int); int nk_str_insert_at_rune(struct nk_str*, int pos, const char*, int); int nk_str_insert_text_char(struct nk_str*, int pos, const char*, int); int nk_str_insert_str_char(struct nk_str*, int pos, const char*); int nk_str_insert_text_utf8(struct nk_str*, int pos, const char*, int); int nk_str_insert_str_utf8(struct nk_str*, int pos, const char*); int nk_str_insert_text_runes(struct nk_str*, int pos, const nk_rune*, int); int nk_str_insert_str_runes(struct nk_str*, int pos, const nk_rune*); void nk_str_remove_chars(struct nk_str*, int len); void nk_str_remove_runes(struct nk_str *str, int len); void nk_str_delete_chars(struct nk_str*, int pos, int len); void nk_str_delete_runes(struct nk_str*, int pos, int len); char* nk_str_at_char(struct nk_str*, int pos); char* nk_str_at_rune(struct nk_str*, int pos, nk_rune *unicode, int *len); nk_rune nk_str_rune_at(const struct nk_str*, int pos); const char* nk_str_at_char_const(const struct nk_str*, int pos); const char* nk_str_at_const(const struct nk_str*, int pos, nk_rune *unicode, int *len); char* nk_str_get(struct nk_str*); const char* nk_str_get_const(const struct nk_str*); int nk_str_len(struct nk_str*); int nk_str_len_char(struct nk_str*); ```