diff --git a/menu/drivers/wimp.c b/menu/drivers/wimp.c index 0863ab0cd4..32919fb37e 100644 --- a/menu/drivers/wimp.c +++ b/menu/drivers/wimp.c @@ -86,6 +86,197 @@ bool zr_checkbox_bool(struct zr_context* cx, const char* text, bool *active) /* zahnrad code */ enum theme {THEME_BLACK, THEME_WHITE, THEME_RED, THEME_BLUE, THEME_DARK}; +static void set_style(struct zr_context *ctx, enum theme theme) +{ + if (theme == THEME_WHITE) { + ctx->style.colors[ZR_COLOR_TEXT] = zr_rgba(70, 70, 70, 255); + ctx->style.colors[ZR_COLOR_TEXT_HOVERING] = zr_rgba(10, 10, 10, 255); + ctx->style.colors[ZR_COLOR_TEXT_ACTIVE] = zr_rgba(20, 20, 20, 255); + ctx->style.colors[ZR_COLOR_WINDOW] = zr_rgba(175, 175, 175, 255); + ctx->style.colors[ZR_COLOR_HEADER] = zr_rgba(175, 175, 175, 255); + ctx->style.colors[ZR_COLOR_BORDER] = zr_rgba(0, 0, 0, 255); + ctx->style.colors[ZR_COLOR_BUTTON] = zr_rgba(185, 185, 185, 255); + ctx->style.colors[ZR_COLOR_BUTTON_HOVER] = zr_rgba(170, 170, 170, 255); + ctx->style.colors[ZR_COLOR_BUTTON_ACTIVE] = zr_rgba(160, 160, 160, 255); + ctx->style.colors[ZR_COLOR_TOGGLE] = zr_rgba(150, 150, 150, 255); + ctx->style.colors[ZR_COLOR_TOGGLE_HOVER] = zr_rgba(120, 120, 120, 255); + ctx->style.colors[ZR_COLOR_TOGGLE_CURSOR] = zr_rgba(175, 175, 175, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE] = zr_rgba(190, 190, 190, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE_HOVER] = zr_rgba(150, 150, 150, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE_TEXT] = zr_rgba(70, 70, 70, 255); + ctx->style.colors[ZR_COLOR_SLIDER] = zr_rgba(190, 190, 190, 255); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR] = zr_rgba(80, 80, 80, 255); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR_HOVER] = zr_rgba(70, 70, 70, 255); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR_ACTIVE] = zr_rgba(60, 60, 60, 255); + ctx->style.colors[ZR_COLOR_PROGRESS] = zr_rgba(190, 190, 190, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR] = zr_rgba(80, 80, 80, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR_HOVER] = zr_rgba(70, 70, 70, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR_ACTIVE] = zr_rgba(60, 60, 60, 255); + ctx->style.colors[ZR_COLOR_PROPERTY] = zr_rgba(175, 175, 175, 255); + ctx->style.colors[ZR_COLOR_PROPERTY_HOVER] = zr_rgba(160, 160, 160, 255); + ctx->style.colors[ZR_COLOR_PROPERTY_ACTIVE] = zr_rgba(165, 165, 165, 255); + ctx->style.colors[ZR_COLOR_INPUT] = zr_rgba(150, 150, 150, 255); + ctx->style.colors[ZR_COLOR_INPUT_CURSOR] = zr_rgba(0, 0, 0, 255); + ctx->style.colors[ZR_COLOR_INPUT_TEXT] = zr_rgba(0, 0, 0, 255); + ctx->style.colors[ZR_COLOR_COMBO] = zr_rgba(175, 175, 175, 255); + ctx->style.colors[ZR_COLOR_HISTO] = zr_rgba(160, 160, 160, 255); + ctx->style.colors[ZR_COLOR_HISTO_BARS] = zr_rgba(45, 45, 45, 255); + ctx->style.colors[ZR_COLOR_HISTO_HIGHLIGHT] = zr_rgba( 255, 0, 0, 255); + ctx->style.colors[ZR_COLOR_PLOT] = zr_rgba(160, 160, 160, 255); + ctx->style.colors[ZR_COLOR_PLOT_LINES] = zr_rgba(45, 45, 45, 255); + ctx->style.colors[ZR_COLOR_PLOT_HIGHLIGHT] = zr_rgba(255, 0, 0, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR] = zr_rgba(180, 180, 180, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR] = zr_rgba(140, 140, 140, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR_HOVER] = zr_rgba(150, 150, 150, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR_ACTIVE] = zr_rgba(160, 160, 160, 255); + ctx->style.colors[ZR_COLOR_TABLE_LINES] = zr_rgba(100, 100, 100, 255); + ctx->style.colors[ZR_COLOR_TAB_HEADER] = zr_rgba(180, 180, 180, 255); + ctx->style.colors[ZR_COLOR_SCALER] = zr_rgba(100, 100, 100, 255); + } else if (theme == THEME_RED) { + ctx->style.rounding[ZR_ROUNDING_SCROLLBAR] = 0; + ctx->style.properties[ZR_PROPERTY_SCROLLBAR_SIZE] = zr_vec2(10,10); + ctx->style.colors[ZR_COLOR_TEXT] = zr_rgba(190, 190, 190, 255); + ctx->style.colors[ZR_COLOR_TEXT_HOVERING] = zr_rgba(195, 195, 195, 255); + ctx->style.colors[ZR_COLOR_TEXT_ACTIVE] = zr_rgba(200, 200, 200, 255); + ctx->style.colors[ZR_COLOR_WINDOW] = zr_rgba(30, 33, 40, 215); + ctx->style.colors[ZR_COLOR_HEADER] = zr_rgba(181, 45, 69, 220); + ctx->style.colors[ZR_COLOR_BORDER] = zr_rgba(51, 55, 67, 255); + ctx->style.colors[ZR_COLOR_BUTTON] = zr_rgba(181, 45, 69, 255); + ctx->style.colors[ZR_COLOR_BUTTON_HOVER] = zr_rgba(190, 50, 70, 255); + ctx->style.colors[ZR_COLOR_BUTTON_ACTIVE] = zr_rgba(195, 55, 75, 255); + ctx->style.colors[ZR_COLOR_TOGGLE] = zr_rgba(51, 55, 67, 255); + ctx->style.colors[ZR_COLOR_TOGGLE_HOVER] = zr_rgba(45, 60, 60, 255); + ctx->style.colors[ZR_COLOR_TOGGLE_CURSOR] = zr_rgba(181, 45, 69, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE] = zr_rgba(181, 45, 69, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE_HOVER] = zr_rgba(181, 45, 69, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE_TEXT] = zr_rgba(190, 190, 190, 255); + ctx->style.colors[ZR_COLOR_SLIDER] = zr_rgba(51, 55, 67, 255); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR] = zr_rgba(181, 45, 69, 255); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR_HOVER] = zr_rgba(186, 50, 74, 255); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR_ACTIVE] = zr_rgba(191, 55, 79, 255); + ctx->style.colors[ZR_COLOR_PROGRESS] = zr_rgba(51, 55, 67, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR] = zr_rgba(181, 45, 69, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR_HOVER] = zr_rgba(186, 50, 74, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR_ACTIVE] = zr_rgba(191, 55, 79, 255); + ctx->style.colors[ZR_COLOR_PROPERTY] = zr_rgba(51, 55, 67, 255); + ctx->style.colors[ZR_COLOR_PROPERTY_HOVER] = zr_rgba(55, 60, 72, 255); + ctx->style.colors[ZR_COLOR_PROPERTY_ACTIVE] = zr_rgba(60, 65, 77, 255); + ctx->style.colors[ZR_COLOR_INPUT] = zr_rgba(51, 55, 67, 225); + ctx->style.colors[ZR_COLOR_INPUT_CURSOR] = zr_rgba(190, 190, 190, 255); + ctx->style.colors[ZR_COLOR_INPUT_TEXT] = zr_rgba(190, 190, 190, 255); + ctx->style.colors[ZR_COLOR_COMBO] = zr_rgba(51, 55, 67, 255); + ctx->style.colors[ZR_COLOR_HISTO] = zr_rgba(51, 55, 67, 255); + ctx->style.colors[ZR_COLOR_HISTO_BARS] = zr_rgba(170, 40, 60, 255); + ctx->style.colors[ZR_COLOR_HISTO_HIGHLIGHT] = zr_rgba( 255, 0, 0, 255); + ctx->style.colors[ZR_COLOR_PLOT] = zr_rgba(51, 55, 67, 255); + ctx->style.colors[ZR_COLOR_PLOT_LINES] = zr_rgba(170, 40, 60, 255); + ctx->style.colors[ZR_COLOR_PLOT_HIGHLIGHT] = zr_rgba(255, 0, 0, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR] = zr_rgba(30, 33, 40, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR] = zr_rgba(64, 84, 95, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR_HOVER] = zr_rgba(70, 90, 100, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR_ACTIVE] = zr_rgba(75, 95, 105, 255); + ctx->style.colors[ZR_COLOR_TABLE_LINES] = zr_rgba(100, 100, 100, 255); + ctx->style.colors[ZR_COLOR_TAB_HEADER] = zr_rgba(181, 45, 69, 220); + ctx->style.colors[ZR_COLOR_SCALER] = zr_rgba(100, 100, 100, 255); + } else if (theme == THEME_BLUE) { + ctx->style.rounding[ZR_ROUNDING_SCROLLBAR] = 0; + ctx->style.properties[ZR_PROPERTY_SCROLLBAR_SIZE] = zr_vec2(10,10); + ctx->style.colors[ZR_COLOR_TEXT] = zr_rgba(20, 20, 20, 255); + ctx->style.colors[ZR_COLOR_TEXT_HOVERING] = zr_rgba(195, 195, 195, 255); + ctx->style.colors[ZR_COLOR_TEXT_ACTIVE] = zr_rgba(200, 200, 200, 255); + ctx->style.colors[ZR_COLOR_WINDOW] = zr_rgba(202, 212, 214, 215); + ctx->style.colors[ZR_COLOR_HEADER] = zr_rgba(137, 182, 224, 220); + ctx->style.colors[ZR_COLOR_BORDER] = zr_rgba(140, 159, 173, 255); + ctx->style.colors[ZR_COLOR_BUTTON] = zr_rgba(137, 182, 224, 255); + ctx->style.colors[ZR_COLOR_BUTTON_HOVER] = zr_rgba(142, 187, 229, 255); + ctx->style.colors[ZR_COLOR_BUTTON_ACTIVE] = zr_rgba(147, 192, 234, 255); + ctx->style.colors[ZR_COLOR_TOGGLE] = zr_rgba(177, 210, 210, 255); + ctx->style.colors[ZR_COLOR_TOGGLE_HOVER] = zr_rgba(245, 245, 245, 255); + ctx->style.colors[ZR_COLOR_TOGGLE_CURSOR] = zr_rgba(142, 187, 229, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE] = zr_rgba(147, 192, 234, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE_HOVER] = zr_rgba(150, 150, 150, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE_TEXT] = zr_rgba(70, 70, 70, 255); + ctx->style.colors[ZR_COLOR_SLIDER] = zr_rgba(177, 210, 210, 255); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR] = zr_rgba(137, 182, 224, 245); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR_HOVER] = zr_rgba(142, 188, 229, 255); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR_ACTIVE] = zr_rgba(147, 193, 234, 255); + ctx->style.colors[ZR_COLOR_PROGRESS] = zr_rgba(177, 210, 210, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR] = zr_rgba(137, 182, 224, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR_HOVER] = zr_rgba(142, 188, 229, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR_ACTIVE] = zr_rgba(147, 193, 234, 255); + ctx->style.colors[ZR_COLOR_PROPERTY] = zr_rgba(210, 210, 210, 255); + ctx->style.colors[ZR_COLOR_PROPERTY_HOVER] = zr_rgba(235, 235, 235, 255); + ctx->style.colors[ZR_COLOR_PROPERTY_ACTIVE] = zr_rgba(230, 230, 230, 255); + ctx->style.colors[ZR_COLOR_INPUT] = zr_rgba(210, 210, 210, 225); + ctx->style.colors[ZR_COLOR_INPUT_CURSOR] = zr_rgba(20, 20, 20, 255); + ctx->style.colors[ZR_COLOR_INPUT_TEXT] = zr_rgba(20, 20, 20, 255); + ctx->style.colors[ZR_COLOR_COMBO] = zr_rgba(210, 210, 210, 255); + ctx->style.colors[ZR_COLOR_HISTO] = zr_rgba(210, 210, 210, 255); + ctx->style.colors[ZR_COLOR_HISTO_BARS] = zr_rgba(137, 182, 224, 255); + ctx->style.colors[ZR_COLOR_HISTO_HIGHLIGHT] = zr_rgba( 255, 0, 0, 255); + ctx->style.colors[ZR_COLOR_PLOT] = zr_rgba(210, 210, 210, 255); + ctx->style.colors[ZR_COLOR_PLOT_LINES] = zr_rgba(137, 182, 224, 255); + ctx->style.colors[ZR_COLOR_PLOT_HIGHLIGHT] = zr_rgba(255, 0, 0, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR] = zr_rgba(190, 200, 200, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR] = zr_rgba(64, 84, 95, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR_HOVER] = zr_rgba(70, 90, 100, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR_ACTIVE] = zr_rgba(75, 95, 105, 255); + ctx->style.colors[ZR_COLOR_TABLE_LINES] = zr_rgba(100, 100, 100, 255); + ctx->style.colors[ZR_COLOR_TAB_HEADER] = zr_rgba(156, 193, 220, 255); + ctx->style.colors[ZR_COLOR_SCALER] = zr_rgba(100, 100, 100, 255); + } else if (theme == THEME_DARK) { + ctx->style.rounding[ZR_ROUNDING_SCROLLBAR] = 0; + ctx->style.properties[ZR_PROPERTY_SCROLLBAR_SIZE] = zr_vec2(10,10); + ctx->style.colors[ZR_COLOR_TEXT] = zr_rgba(210, 210, 210, 255); + ctx->style.colors[ZR_COLOR_TEXT_HOVERING] = zr_rgba(195, 195, 195, 255); + ctx->style.colors[ZR_COLOR_TEXT_ACTIVE] = zr_rgba(200, 200, 200, 255); + ctx->style.colors[ZR_COLOR_WINDOW] = zr_rgba(45, 53, 56, 215); + ctx->style.colors[ZR_COLOR_HEADER] = zr_rgba(46, 46, 46, 220); + ctx->style.colors[ZR_COLOR_BORDER] = zr_rgba(46, 46, 46, 255); + ctx->style.colors[ZR_COLOR_BUTTON] = zr_rgba(48, 83, 111, 255); + ctx->style.colors[ZR_COLOR_BUTTON_HOVER] = zr_rgba(53, 88, 116, 255); + ctx->style.colors[ZR_COLOR_BUTTON_ACTIVE] = zr_rgba(58, 93, 121, 255); + ctx->style.colors[ZR_COLOR_TOGGLE] = zr_rgba(50, 58, 61, 255); + ctx->style.colors[ZR_COLOR_TOGGLE_HOVER] = zr_rgba(55, 63, 66, 255); + ctx->style.colors[ZR_COLOR_TOGGLE_CURSOR] = zr_rgba(48, 83, 111, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE] = zr_rgba(48, 83, 111, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE_HOVER] = zr_rgba(48, 83, 111, 255); + ctx->style.colors[ZR_COLOR_SELECTABLE_TEXT] = zr_rgba(210, 210, 210, 255); + ctx->style.colors[ZR_COLOR_SLIDER] = zr_rgba(50, 58, 61, 255); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR] = zr_rgba(48, 83, 111, 245); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR_HOVER] = zr_rgba(53, 88, 116, 255); + ctx->style.colors[ZR_COLOR_SLIDER_CURSOR_ACTIVE] = zr_rgba(58, 93, 121, 255); + ctx->style.colors[ZR_COLOR_PROGRESS] = zr_rgba(50, 58, 61, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR] = zr_rgba(48, 83, 111, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR_HOVER] = zr_rgba(53, 88, 116, 255); + ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR_ACTIVE] = zr_rgba(58, 93, 121, 255); + ctx->style.colors[ZR_COLOR_PROPERTY] = zr_rgba(50, 58, 61, 255); + ctx->style.colors[ZR_COLOR_PROPERTY_HOVER] = zr_rgba(55, 63, 66, 255); + ctx->style.colors[ZR_COLOR_PROPERTY_ACTIVE] = zr_rgba(60, 68, 71, 255); + ctx->style.colors[ZR_COLOR_INPUT] = zr_rgba(50, 58, 61, 225); + ctx->style.colors[ZR_COLOR_INPUT_CURSOR] = zr_rgba(210, 210, 210, 255); + ctx->style.colors[ZR_COLOR_INPUT_TEXT] = zr_rgba(210, 210, 210, 255); + ctx->style.colors[ZR_COLOR_COMBO] = zr_rgba(50, 58, 61, 255); + ctx->style.colors[ZR_COLOR_HISTO] = zr_rgba(50, 58, 61, 255); + ctx->style.colors[ZR_COLOR_HISTO_BARS] = zr_rgba(48, 83, 111, 255); + ctx->style.colors[ZR_COLOR_HISTO_HIGHLIGHT] = zr_rgba(255, 0, 0, 255); + ctx->style.colors[ZR_COLOR_PLOT] = zr_rgba(50, 58, 61, 255); + ctx->style.colors[ZR_COLOR_PLOT_LINES] = zr_rgba(48, 83, 111, 255); + ctx->style.colors[ZR_COLOR_PLOT_HIGHLIGHT] = zr_rgba(255, 0, 0, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR] = zr_rgba(50, 58, 61, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR] = zr_rgba(48, 83, 111, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR_HOVER] = zr_rgba(53, 88, 116, 255); + ctx->style.colors[ZR_COLOR_SCROLLBAR_CURSOR_ACTIVE] = zr_rgba(58, 93, 121, 255); + ctx->style.colors[ZR_COLOR_TABLE_LINES] = zr_rgba(100, 100, 100, 255); + ctx->style.colors[ZR_COLOR_TAB_HEADER] = zr_rgba(48, 83, 111, 255); + ctx->style.colors[ZR_COLOR_SCALER] = zr_rgba(100, 100, 100, 255); + } else { + zr_load_default_style(ctx, ZR_DEFAULT_ALL); + } +} + + + struct wimp { void *memory; struct zr_context ctx; @@ -93,7 +284,7 @@ struct wimp { struct zr_memory_status status; }; -static void wimp_main(struct zr_context *ctx, int width, int height) +static void wimp_main(struct zr_context *ctx, int width, int height, struct wimp *gui) { settings_t *settings = config_get_ptr(); @@ -118,8 +309,26 @@ static void wimp_main(struct zr_context *ctx, int width, int height) zr_checkbox_bool(ctx, "Show FPS", &(settings->fps_show)); zr_checkbox_bool(ctx, "Show FPS", &(settings->fps_show)); zr_checkbox_bool(ctx, "Show FPS", &(settings->fps_show)); - zr_layout_row_dynamic(ctx, 30, 1); + zr_layout_row_dynamic(ctx, 30, 2); + zr_label(ctx, "Volume:", ZR_TEXT_LEFT); zr_slider_float(ctx, -80, &settings->audio.volume, 12, 0.5); + zr_layout_row_dynamic(ctx, 30, 1); + zr_property_int(ctx, "Max Users:", 1, (int*)&(settings->input.max_users), MAX_USERS, 1, 1); + + struct zr_panel combo; + static const char *themes[] = {"Black", "White", "Red", "Blue", "Dark", "Grey"}; + enum theme old = gui->theme; + if (zr_combo_begin_text(ctx, &combo, themes[gui->theme], 300)) { + zr_layout_row_dynamic(ctx, 25, 1); + gui->theme = zr_combo_item(ctx, themes[THEME_BLACK], ZR_TEXT_CENTERED) ? THEME_BLACK : gui->theme; + gui->theme = zr_combo_item(ctx, themes[THEME_WHITE], ZR_TEXT_CENTERED) ? THEME_WHITE : gui->theme; + gui->theme = zr_combo_item(ctx, themes[THEME_RED], ZR_TEXT_CENTERED) ? THEME_RED : gui->theme; + gui->theme = zr_combo_item(ctx, themes[THEME_BLUE], ZR_TEXT_CENTERED) ? THEME_BLUE : gui->theme; + gui->theme = zr_combo_item(ctx, themes[THEME_DARK], ZR_TEXT_CENTERED) ? THEME_DARK : gui->theme; + if (old != gui->theme) set_style(ctx, gui->theme); + zr_combo_end(ctx); + } + } zr_end(ctx); @@ -135,7 +344,7 @@ static int wimp_start(struct wimp *gui, int width, int height) init = 1; } - wimp_main(ctx, width, height); + wimp_main(ctx, width, height, gui); zr_buffer_info(&gui->status, &gui->ctx.memory); return ret; }