[nk] add main window stub

This commit is contained in:
radius 2016-05-25 19:38:20 -05:00
parent ae1522293e
commit 6d7dc34238
7 changed files with 68 additions and 7 deletions

View File

@ -423,6 +423,7 @@ endif
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_shader_parameters.o
OBJ += menu/drivers/nuklear.o
DEFINES += -DHAVE_NUKLEAR

View File

@ -918,6 +918,7 @@ 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_main.c"
#include "../menu/drivers/nuklear.c"
#endif

View File

@ -53,9 +53,12 @@ static void nk_menu_main(nk_menu_handle_t *nk)
struct nk_context *ctx = &nk->ctx;
if (nk->window[ZRMENU_WND_SHADER_PARAMETERS].open)
nk_menu_wnd_shader_parameters(nk);
nk_wnd_shader_parameters(nk);
if (nk->window[ZRMENU_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_buffer_info(&nk->status, &nk->ctx.memory);
}
@ -285,6 +288,7 @@ static void *nk_menu_init(void **userdata)
nk_menu_init_device(nk);
nk->window[ZRMENU_WND_SHADER_PARAMETERS].open = true;
nk->window[ZRMENU_WND_MAIN].open = true;
return menu;
error:

View File

@ -21,7 +21,7 @@
#include "nk_menu.h"
/* sets window position and size */
void nk_menu_wnd_set_state(nk_menu_handle_t *zr, const int id,
void nk_wnd_set_state(nk_menu_handle_t *zr, const int id,
struct nk_vec2 pos, struct nk_vec2 size)
{
zr->window[id].position = pos;
@ -29,7 +29,7 @@ void nk_menu_wnd_set_state(nk_menu_handle_t *zr, const int id,
}
/* gets window position and size */
void nk_menu_wnd_get_state(nk_menu_handle_t *zr, const int id,
void nk_wnd_get_state(nk_menu_handle_t *zr, const int id,
struct nk_vec2 *pos, struct nk_vec2 *size)
{
*pos = zr->window[id].position;

View File

@ -88,6 +88,6 @@ typedef struct nk_menu_handle
video_font_raster_block_t list_block;
} nk_menu_handle_t;
void nk_menu_wnd_shader_parameters(nk_menu_handle_t *zr);
void nk_menu_wnd_main(nk_menu_handle_t *zr);
void nk_wnd_shader_parameters(nk_menu_handle_t *zr);
void nk_wnd_main(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_main(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 = ZRMENU_WND_MAIN;
settings_t *settings = config_get_ptr();
if (nk_begin(ctx, &layout, "Main", 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

@ -35,7 +35,7 @@
#include "../../../retroarch.h"
void nk_menu_wnd_shader_parameters(nk_menu_handle_t *zr)
void nk_wnd_shader_parameters(nk_menu_handle_t *zr)
{
unsigned i;
video_shader_ctx_t shader_info;
@ -74,6 +74,6 @@ void nk_menu_wnd_shader_parameters(nk_menu_handle_t *zr)
}
}
/* save position and size to restore after context reset */
nk_menu_wnd_set_state(zr, id, nk_window_get_position(ctx), nk_window_get_size(ctx));
nk_wnd_set_state(zr, id, nk_window_get_position(ctx), nk_window_get_size(ctx));
nk_end(ctx);
}