mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-24 21:50:44 +00:00
reenable other windows that were removed when the api changed
- need to reimplement checkbox_bool - need to reimplement the menu bar but more than anything, needs a design, making a gui without any guidelines will mean we'll end up with a shiny new mess, instead of fixing anything I can hack stuff together but I am not really a gui designer and it's important at this point
This commit is contained in:
parent
2f7684c743
commit
abbd269f02
@ -40,247 +40,6 @@
|
||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
||||
|
||||
|
||||
/* gamepad demo variables */
|
||||
enum widget_id
|
||||
{
|
||||
WINDOW_MODE = 0,
|
||||
MODEL_DETAIL,
|
||||
TEXTURES,
|
||||
SHADOWS,
|
||||
LIGHTNING,
|
||||
EFFECTS,
|
||||
CONSOLE,
|
||||
BRIGHTNESS,
|
||||
VOLUME,
|
||||
WIDGET_MAX
|
||||
};
|
||||
enum display_settings {
|
||||
WINDOWED = 0, FULLSCREEN};
|
||||
enum detail_settings {LOW, MEDIUM, HIGH, EXTRA_HIGH};
|
||||
enum state_settings {OFF, ON};
|
||||
const char *display[] = {"Windowed", "Fullscreen"};
|
||||
const char *state[] = {"Off", "On"};
|
||||
const char *detail[] = {"Low", "Medium", "High", "Extra High"};
|
||||
|
||||
static int window_mode = FULLSCREEN;
|
||||
static int model_detail = HIGH;
|
||||
static int texture_detail = EXTRA_HIGH;
|
||||
static int shadow_detail = HIGH;
|
||||
static int lighning_detail = LOW;
|
||||
static int effects_detail = MEDIUM;
|
||||
static int show_console = ON;
|
||||
static int brightness = 90;
|
||||
static int volume = 30;
|
||||
static int active = WINDOW_MODE;
|
||||
/* end of gamepad demo variables */
|
||||
|
||||
|
||||
/*tatic int ui_selector(struct nk_context *ctx, const char *title, int *selected, const char *items[],
|
||||
int max, int active)
|
||||
{
|
||||
struct nk_vec2 item_padding;
|
||||
struct nk_rect bounds, label, content, tri, sel;
|
||||
struct nk_panel *layout;
|
||||
struct nk_command_buffer *out;
|
||||
struct nk_color col;
|
||||
struct nk_vec2 result[3];
|
||||
nk_size text_len, text_width;
|
||||
|
||||
if (!ctx || !ctx->current)
|
||||
return 0;
|
||||
|
||||
layout = nk_window_get_panel(ctx);
|
||||
|
||||
out = nk_window_get_canvas(ctx);
|
||||
if (!nk_widget(&bounds, ctx))
|
||||
return 0;
|
||||
|
||||
item_padding = nk_get_property(ctx, NK_PROPERTY_ITEM_PADDING);
|
||||
bounds.x += item_padding.x;
|
||||
bounds.y += item_padding.y;
|
||||
bounds.w -= 2 * item_padding.x;
|
||||
bounds.h -= 2 * item_padding.y;
|
||||
|
||||
label.h = bounds.h;
|
||||
label.w = bounds.w / 2.0f;
|
||||
label.x = bounds.x + item_padding.x;
|
||||
label.y = bounds.y + label.h/2.0f - (float)ctx->style.font.height/2.0f;
|
||||
|
||||
content.x = bounds.x + bounds.w/2.0f;
|
||||
content.y = bounds.y;
|
||||
content.w = bounds.w / 2.0f;
|
||||
content.h = bounds.h;
|
||||
|
||||
if (active) nk_draw_rect(out, bounds, 0, nk_rgba(220, 220, 220, 135));
|
||||
text_len = strlen(title);
|
||||
col = (active) ? nk_rgba(0, 0, 0, 255): nk_rgba(220,220,220,220);
|
||||
nk_draw_text(out, label, title, text_len, &ctx->style.font, nk_rgba(0,0,0,0), col);
|
||||
|
||||
if (nk_input_is_key_pressed(&ctx->input, NK_KEY_RIGHT) && active)
|
||||
*selected = MIN(*selected+1, max-1);
|
||||
else if (nk_input_is_key_pressed(&ctx->input, NK_KEY_LEFT) && active)
|
||||
*selected = MAX(0, *selected-1);
|
||||
|
||||
tri.h = ctx->style.font.height - 2 * item_padding.y;
|
||||
tri.w = tri.h/2.0f;
|
||||
tri.x = content.x + item_padding.x;
|
||||
tri.y = content.y + content.h/2 - tri.h/2.0f;
|
||||
|
||||
sel.x = tri.x + item_padding.x;
|
||||
sel.y = tri.y;
|
||||
sel.h = content.h;
|
||||
|
||||
if (*selected > 0) {
|
||||
nk_triangle_from_direction(result, tri, 0, 0, NK_LEFT);
|
||||
nk_draw_triangle(out, result[0].x, result[0].y, result[1].x, result[1].y,
|
||||
result[2].x, result[2].y, (active) ? nk_rgba(0, 0, 0, 255):
|
||||
nk_rgba(100, 100, 100, 150));
|
||||
}
|
||||
|
||||
tri.x = content.x + (content.w - item_padding.x) - tri.w;
|
||||
sel.w = tri.x - sel.x;
|
||||
|
||||
if (*selected < max-1) {
|
||||
nk_triangle_from_direction(result, tri, 0, 0, NK_RIGHT);
|
||||
nk_draw_triangle(out, result[0].x, result[0].y, result[1].x, result[1].y,
|
||||
result[2].x, result[2].y, (active) ? nk_rgba(0, 0, 0, 255):
|
||||
nk_rgba(100, 100, 100, 150));
|
||||
}
|
||||
|
||||
text_width = ctx->style.font.width(ctx->style.font.userdata,
|
||||
ctx->style.font.height, items[*selected], strlen(items[*selected]));
|
||||
|
||||
label.w = MAX(1, (float)text_width);
|
||||
label.x = (sel.x + (sel.w - label.w) / 2);
|
||||
label.x = MAX(sel.x, label.x);
|
||||
label.w = MIN(sel.x + sel.w, label.x + label.w);
|
||||
if (label.w >= label.x) label.w -= label.x;
|
||||
nk_draw_text(out, label, items[*selected], strlen(items[*selected]),
|
||||
&ctx->style.font, nk_rgba(0,0,0,0), col);
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
static void ui_slider(struct nk_context *ctx, const char *title, int *value, int max, int active)
|
||||
{
|
||||
struct nk_vec2 item_padding;
|
||||
struct nk_rect bounds, label, content, bar, cursor, tri;
|
||||
struct nk_panel *layout;
|
||||
struct nk_command_buffer *out;
|
||||
struct nk_color col;
|
||||
nk_size text_len, text_width;
|
||||
float prog_scale = (float)*value / (float)max;
|
||||
struct nk_vec2 result[3];
|
||||
|
||||
if (!ctx || !ctx->current)
|
||||
return;
|
||||
|
||||
layout = nk_window_get_panel(ctx);
|
||||
|
||||
out = nk_window_get_canvas(ctx);
|
||||
if (!nk_widget(&bounds, ctx))
|
||||
return;
|
||||
|
||||
item_padding = nk_get_property(ctx, NK_PROPERTY_ITEM_PADDING);
|
||||
bounds.x += item_padding.x;
|
||||
bounds.y += item_padding.y;
|
||||
bounds.w -= 2 * item_padding.x;
|
||||
bounds.h -= 2 * item_padding.y;
|
||||
|
||||
label.h = bounds.h;
|
||||
label.w = bounds.w / 2.0f;
|
||||
label.x = bounds.x + item_padding.x;
|
||||
label.y = bounds.y + label.h/2.0f - (float)ctx->style.font.height/2.0f;
|
||||
|
||||
content.x = bounds.x + bounds.w/2.0f;
|
||||
content.y = bounds.y;
|
||||
content.w = bounds.w / 2.0f;
|
||||
content.h = bounds.h;
|
||||
|
||||
if (active) nk_draw_rect(out, bounds, 0, nk_rgba(220, 220, 220, 135));
|
||||
text_len = strlen(title);
|
||||
col = (active) ? nk_rgba(0, 0, 0, 255): nk_rgba(220,220,220,220);
|
||||
nk_draw_text(out, label, title, text_len, &ctx->style.font, nk_rgba(0,0,0,0), col);
|
||||
|
||||
if (nk_input_is_key_pressed(&ctx->input, NK_KEY_LEFT) && active)
|
||||
*value = MAX(0, *value - 10);
|
||||
if (nk_input_is_key_pressed(&ctx->input, NK_KEY_RIGHT) && active)
|
||||
*value = MIN(*value + 10, max);
|
||||
|
||||
tri.h = ctx->style.font.height - 2 * item_padding.y;
|
||||
tri.w = tri.h/2.0f;
|
||||
tri.x = content.x + item_padding.x;
|
||||
tri.y = content.y + content.h/2 - tri.h/2.0f;
|
||||
|
||||
bar.x = tri.x + 4 * item_padding.x + tri.w;
|
||||
bar.h = tri.h / 4.0f;
|
||||
bar.y = tri.y + tri.h/2.0f - bar.h/2.0f;
|
||||
|
||||
if (*value > 0) {
|
||||
nk_triangle_from_direction(result, tri, 0, 0, NK_LEFT);
|
||||
nk_draw_triangle(out, result[0].x, result[0].y, result[1].x, result[1].y,
|
||||
result[2].x, result[2].y, (active) ? nk_rgba(0, 0, 0, 255):
|
||||
nk_rgba(100, 100, 100, 150));
|
||||
}
|
||||
|
||||
tri.x = content.x + (content.w - item_padding.x) - tri.w;
|
||||
bar.w = (tri.x - bar.x) - 4 * item_padding.x;
|
||||
|
||||
if (*value < max)
|
||||
{
|
||||
nk_triangle_from_direction(result, tri, 0, 0, NK_RIGHT);
|
||||
nk_draw_triangle(out, result[0].x, result[0].y, result[1].x, result[1].y,
|
||||
result[2].x, result[2].y, (active) ? nk_rgba(0, 0, 0, 255):
|
||||
nk_rgba(100, 100, 100, 150));
|
||||
}
|
||||
|
||||
bar.w = (bar.w - tri.h/2.0f);
|
||||
if (active)
|
||||
{
|
||||
nk_draw_rect(out, bar, 0, nk_rgba(0, 0, 0, 135));
|
||||
bar.w = bar.w * prog_scale;
|
||||
bar.y = tri.y; bar.x = bar.x + bar.w; bar.w = tri.h; bar.h = tri.h;
|
||||
nk_draw_circle(out, bar, nk_rgba(220, 220, 220, 255));
|
||||
}
|
||||
else
|
||||
{
|
||||
nk_draw_rect(out, bar, 0, nk_rgba(220, 220, 220, 135));
|
||||
bar.w = bar.w * prog_scale;
|
||||
bar.y = tri.y; bar.x = bar.x + bar.w; bar.w = tri.h; bar.h = tri.h;
|
||||
nk_draw_circle(out, bar, nk_rgba(190, 190, 190, 255));
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*bool nk_checkbox_bool(struct nk_context* cx, const char* text, bool *active)
|
||||
{
|
||||
int x = *active;
|
||||
bool ret = nk_check_text(cx, text, &x);
|
||||
*active = x;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
float nk_checkbox_float(struct nk_context* cx, const char* text, float *active)
|
||||
{
|
||||
int x = *active;
|
||||
float ret = nk_check_text(cx, text, &x);
|
||||
*active = x;
|
||||
|
||||
return ret;
|
||||
}*/
|
||||
|
||||
/*static void nk_labelf(struct nk_context *ctx,
|
||||
enum nk_text_align align, const char *fmt, ...)
|
||||
{
|
||||
char buffer[1024];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buffer, sizeof(buffer), fmt, args);
|
||||
buffer[1023] = 0;
|
||||
nk_label(ctx, buffer, align);
|
||||
va_end(args);
|
||||
}*/
|
||||
|
||||
void nk_menu_set_state(nk_menu_handle_t *zr, const int id,
|
||||
struct nk_vec2 pos, struct nk_vec2 size)
|
||||
{
|
||||
|
@ -198,8 +198,7 @@ static void nk_menu_frame(void *data)
|
||||
|
||||
nk_input_end(&nk->ctx);
|
||||
nk_menu_main(nk);
|
||||
if(nk_window_is_closed(&nk->ctx, "Shader Parameters"))
|
||||
nk_menu_wnd_shader_parameters(nk);
|
||||
|
||||
nk_common_device_draw(&device, &nk->ctx, width, height, NK_ANTI_ALIASING_ON);
|
||||
|
||||
menu_display_draw_cursor(
|
||||
@ -295,6 +294,10 @@ static void *nk_menu_init(void **userdata)
|
||||
"nuklear", sizeof(nk->assets_directory));
|
||||
nk_menu_init_device(nk);
|
||||
|
||||
nk->window[ZRMENU_WND_MAIN].open = true;
|
||||
nk->window[ZRMENU_WND_TEST].open = true;
|
||||
nk->window[ZRMENU_WND_SHADER_PARAMETERS].open = true;
|
||||
|
||||
return menu;
|
||||
error:
|
||||
if (menu)
|
||||
|
Loading…
x
Reference in New Issue
Block a user