From ed911fcf2718cf586c885dfcbcf96aeed580cfa4 Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 25 May 2016 19:58:16 -0500 Subject: [PATCH] [nk] add more stub windows --- Makefile.common | 2 + griffin/griffin.c | 2 + menu/drivers/nuklear.c | 23 ++++++-- menu/drivers/nuklear/nk_menu.h | 10 +++- menu/drivers/nuklear/nk_wnd_file_picker.c | 55 +++++++++++++++++++ menu/drivers/nuklear/nk_wnd_main.c | 2 +- menu/drivers/nuklear/nk_wnd_settings.c | 55 +++++++++++++++++++ .../nuklear/nk_wnd_shader_parameters.c | 2 +- 8 files changed, 140 insertions(+), 11 deletions(-) create mode 100644 menu/drivers/nuklear/nk_wnd_file_picker.c create mode 100644 menu/drivers/nuklear/nk_wnd_settings.c diff --git a/Makefile.common b/Makefile.common index de5f35bf16..997a9312fa 100644 --- a/Makefile.common +++ b/Makefile.common @@ -424,7 +424,9 @@ ifeq ($(HAVE_NUKLEAR), 1) OBJ += menu/drivers/nuklear/nk_common.o OBJ += menu/drivers/nuklear/nk_menu.o OBJ += menu/drivers/nuklear/nk_wnd_main.o + OBJ += menu/drivers/nuklear/nk_wnd_file_picker.o OBJ += menu/drivers/nuklear/nk_wnd_shader_parameters.o + OBJ += menu/drivers/nuklear/nk_wnd_settings.o OBJ += menu/drivers/nuklear.o DEFINES += -DHAVE_NUKLEAR endif diff --git a/griffin/griffin.c b/griffin/griffin.c index 8cafb8184c..0d7da3977b 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -918,6 +918,8 @@ MENU #include "../menu/drivers/nuklear/nk_common.c" #include "../menu/drivers/nuklear/nk_menu.c" #include "../menu/drivers/nuklear/nk_wnd_shader_parameters.c" +#include "../menu/drivers/nuklear/nk_wnd_file_picker.c" +#include "../menu/drivers/nuklear/nk_wnd_settings.c" #include "../menu/drivers/nuklear/nk_wnd_main.c" #include "../menu/drivers/nuklear.c" #endif diff --git a/menu/drivers/nuklear.c b/menu/drivers/nuklear.c index 765483d8ff..80d0fd3172 100644 --- a/menu/drivers/nuklear.c +++ b/menu/drivers/nuklear.c @@ -52,13 +52,19 @@ static void nk_menu_main(nk_menu_handle_t *nk) { struct nk_context *ctx = &nk->ctx; - if (nk->window[ZRMENU_WND_SHADER_PARAMETERS].open) + if (nk->window[NK_WND_SETTINGS].open) + nk_wnd_settings(nk); + if (nk->window[NK_WND_FILE_PICKER].open) + nk_wnd_file_picker(nk); + if (nk->window[NK_WND_SHADER_PARAMETERS].open) nk_wnd_shader_parameters(nk); - if (nk->window[ZRMENU_WND_MAIN].open) + if (nk->window[NK_WND_MAIN].open) nk_wnd_main(nk); - nk->window[ZRMENU_WND_SHADER_PARAMETERS].open = !nk_window_is_closed(ctx, "Shader Parameters"); - nk->window[ZRMENU_WND_MAIN].open = !nk_window_is_closed(ctx, "Main"); + nk->window[NK_WND_SETTINGS].open = !nk_window_is_closed(ctx, "Settings"); + nk->window[NK_WND_FILE_PICKER].open = !nk_window_is_closed(ctx, "Select File"); + nk->window[NK_WND_SHADER_PARAMETERS].open = !nk_window_is_closed(ctx, "Shader Parameters"); + nk->window[NK_WND_MAIN].open = !nk_window_is_closed(ctx, "Main"); nk_buffer_info(&nk->status, &nk->ctx.memory); } @@ -287,8 +293,13 @@ static void *nk_menu_init(void **userdata) "nuklear", sizeof(nk->assets_directory)); nk_menu_init_device(nk); - nk->window[ZRMENU_WND_SHADER_PARAMETERS].open = true; - nk->window[ZRMENU_WND_MAIN].open = true; + /* for demo puposes only, opens all windows */ +#if 1 + for (int i=0; i < NK_WND_LAST; i++) + nk->window[i].open = true; +#else + nk->window[NK_WND_MAIN].open = true; +#endif return menu; error: diff --git a/menu/drivers/nuklear/nk_menu.h b/menu/drivers/nuklear/nk_menu.h index 8ea2babaea..a726be447a 100644 --- a/menu/drivers/nuklear/nk_menu.h +++ b/menu/drivers/nuklear/nk_menu.h @@ -29,9 +29,11 @@ enum enum { - ZRMENU_WND_MAIN = 0, - ZRMENU_WND_SETTINGS, - ZRMENU_WND_SHADER_PARAMETERS, + NK_WND_MAIN = 0, + NK_WND_SETTINGS, + NK_WND_FILE_PICKER, + NK_WND_SHADER_PARAMETERS, + NK_WND_LAST, }; enum nk_menu_theme @@ -90,4 +92,6 @@ typedef struct nk_menu_handle void nk_wnd_shader_parameters(nk_menu_handle_t *zr); void nk_wnd_main(nk_menu_handle_t *zr); +void nk_wnd_file_picker(nk_menu_handle_t *zr); +void nk_wnd_settings(nk_menu_handle_t *zr); diff --git a/menu/drivers/nuklear/nk_wnd_file_picker.c b/menu/drivers/nuklear/nk_wnd_file_picker.c new file mode 100644 index 0000000000..7235224d70 --- /dev/null +++ b/menu/drivers/nuklear/nk_wnd_file_picker.c @@ -0,0 +1,55 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2014-2015 - Jean-André Santoni + * Copyright (C) 2016 - Andrés Suárez + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "nk_menu.h" + +#include +#include +#include +#include + +#include +#include +#include + +#include "../../menu_driver.h" +#include "../../menu_hash.h" + + + + +void nk_wnd_file_picker(nk_menu_handle_t *zr) +{ + unsigned i; + video_shader_ctx_t shader_info; + struct nk_panel layout; + struct nk_context *ctx = &zr->ctx; + const int id = NK_WND_FILE_PICKER; + settings_t *settings = config_get_ptr(); + + if (nk_begin(ctx, &layout, "Select File", nk_rect(240, 10, 300, 400), + NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_MOVABLE| + NK_WINDOW_SCALABLE|NK_WINDOW_BORDER)) + { + nk_layout_row_dynamic(ctx, 30, 1); + + + } + /* save position and size to restore after context reset */ + nk_wnd_set_state(zr, id, nk_window_get_position(ctx), nk_window_get_size(ctx)); + nk_end(ctx); +} \ No newline at end of file diff --git a/menu/drivers/nuklear/nk_wnd_main.c b/menu/drivers/nuklear/nk_wnd_main.c index be5e971edf..c2d43e2740 100644 --- a/menu/drivers/nuklear/nk_wnd_main.c +++ b/menu/drivers/nuklear/nk_wnd_main.c @@ -38,7 +38,7 @@ void nk_wnd_main(nk_menu_handle_t *zr) video_shader_ctx_t shader_info; struct nk_panel layout; struct nk_context *ctx = &zr->ctx; - const int id = ZRMENU_WND_MAIN; + const int id = NK_WND_MAIN; settings_t *settings = config_get_ptr(); if (nk_begin(ctx, &layout, "Main", nk_rect(240, 10, 300, 400), diff --git a/menu/drivers/nuklear/nk_wnd_settings.c b/menu/drivers/nuklear/nk_wnd_settings.c new file mode 100644 index 0000000000..60224dd4ac --- /dev/null +++ b/menu/drivers/nuklear/nk_wnd_settings.c @@ -0,0 +1,55 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2016 - Daniel De Matteis + * Copyright (C) 2014-2015 - Jean-André Santoni + * Copyright (C) 2016 - Andrés Suárez + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "nk_menu.h" + +#include +#include +#include +#include + +#include +#include +#include + +#include "../../menu_driver.h" +#include "../../menu_hash.h" + + + + +void nk_wnd_settings(nk_menu_handle_t *zr) +{ + unsigned i; + video_shader_ctx_t shader_info; + struct nk_panel layout; + struct nk_context *ctx = &zr->ctx; + const int id = NK_WND_SETTINGS; + settings_t *settings = config_get_ptr(); + + if (nk_begin(ctx, &layout, "Settings", nk_rect(240, 10, 300, 400), + NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_MOVABLE| + NK_WINDOW_SCALABLE|NK_WINDOW_BORDER)) + { + nk_layout_row_dynamic(ctx, 30, 1); + + + } + /* save position and size to restore after context reset */ + nk_wnd_set_state(zr, id, nk_window_get_position(ctx), nk_window_get_size(ctx)); + nk_end(ctx); +} \ No newline at end of file diff --git a/menu/drivers/nuklear/nk_wnd_shader_parameters.c b/menu/drivers/nuklear/nk_wnd_shader_parameters.c index 8ebc5103a5..99126b9911 100644 --- a/menu/drivers/nuklear/nk_wnd_shader_parameters.c +++ b/menu/drivers/nuklear/nk_wnd_shader_parameters.c @@ -41,7 +41,7 @@ void nk_wnd_shader_parameters(nk_menu_handle_t *zr) video_shader_ctx_t shader_info; struct nk_panel layout; struct nk_context *ctx = &zr->ctx; - const int id = ZRMENU_WND_SHADER_PARAMETERS; + const int id = NK_WND_SHADER_PARAMETERS; settings_t *settings = config_get_ptr(); if (nk_begin(ctx, &layout, "Shader Parameters", nk_rect(240, 10, 300, 400),