[nk] add more stub windows

This commit is contained in:
radius 2016-05-25 19:58:16 -05:00
parent 6d7dc34238
commit ed911fcf27
8 changed files with 140 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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);

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "nk_menu.h"
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <file/file_path.h>
#include <string/stdstring.h>
#include <lists/string_list.h>
#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);
}

View File

@ -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),

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "nk_menu.h"
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <file/file_path.h>
#include <string/stdstring.h>
#include <lists/string_list.h>
#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);
}

View File

@ -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),