diff --git a/demo/sdl_opengl3/main.c b/demo/sdl_opengl3/main.c index 2b5604f7..b758c01e 100644 --- a/demo/sdl_opengl3/main.c +++ b/demo/sdl_opengl3/main.c @@ -79,7 +79,7 @@ * DEMO * * ===============================================================*/ -int main(void) +int main(int argc, char *argv[]) { /* Platform */ SDL_Window *win; diff --git a/demo/style_configurator.c b/demo/style_configurator.c index 44553dd5..5bebc099 100644 --- a/demo/style_configurator.c +++ b/demo/style_configurator.c @@ -1,9 +1,36 @@ // TODO design decisions // plural or not? ie style_button or style_buttons? -// use the duplicate array method, or just yet the user +// use the duplicate array method, or just let the user // manually set those after calling the function by accessing ctx->style->*? + + +static void +style_rgb(struct nk_context* ctx, const char* name, struct nk_color* color) +{ + nk_label(ctx, name, NK_TEXT_LEFT); + if (nk_combo_begin_color(ctx, *color, nk_vec2(nk_widget_width(ctx), 400))) { + nk_layout_row_dynamic(ctx, 120, 1); + struct nk_colorf colorf = nk_color_picker(ctx, nk_color_cf(*color), NK_RGB); + nk_layout_row_dynamic(ctx, 25, 1); + colorf.r = nk_propertyf(ctx, "#R:", 0, colorf.r, 1.0f, 0.01f,0.005f); + colorf.g = nk_propertyf(ctx, "#G:", 0, colorf.g, 1.0f, 0.01f,0.005f); + colorf.b = nk_propertyf(ctx, "#B:", 0, colorf.b, 1.0f, 0.01f,0.005f); + + *color = nk_rgb_cf(colorf); + + nk_combo_end(ctx); + } +} + +// TODO style_style_item? how to handle images if at all? +static void +style_item_color(struct nk_context* ctx, const char* name, struct nk_style_item* item) +{ + style_rgb(ctx, name, &item->data.color); +} + // style_general? pass array in instead of static? static void style_colors(struct nk_context* ctx, struct nk_color color_table[NK_COLOR_COUNT]) @@ -42,20 +69,7 @@ style_colors(struct nk_context* ctx, struct nk_color color_table[NK_COLOR_COUNT] nk_layout_row_dynamic(ctx, 30, 2); for (int i=0; i