コード例 #1
0
ファイル: nuklear.c プロジェクト: DanielAeolusLaude/RetroArch
static void *nk_menu_init(void **userdata)
{
   settings_t *settings = config_get_ptr();
   nk_menu_handle_t   *nk = NULL;
   menu_handle_t *menu = (menu_handle_t*)
      calloc(1, sizeof(*menu));
   unsigned width, height = 0;

   video_driver_get_size(&width, &height);

   if (!menu)
      goto error;

   if (!menu_display_init_first_driver())
      goto error;

   nk = (nk_menu_handle_t*)calloc(1, sizeof(nk_menu_handle_t));

   if (!nk)
      goto error;

   *userdata = nk;

   fill_pathname_join(nk->assets_directory, settings->directory.assets,
         "nuklear", sizeof(nk->assets_directory));
   nk_menu_init_device(nk);

   return menu;
error:
   if (menu)
      free(menu);
   return NULL;
}
コード例 #2
0
ファイル: nuklear.c プロジェクト: Alexandre-Garcia/RetroArch
static void nk_menu_context_reset(void *data)
{
   char iconpath[PATH_MAX_LENGTH] = {0};
   nk_menu_handle_t *nk              = (nk_menu_handle_t*)data;
   settings_t *settings           = config_get_ptr();
   unsigned width, height = 0;

   video_driver_get_size(&width, &height);

   if (!nk || !settings)
      return;

   fill_pathname_join(iconpath, settings->directory.assets,
         "nuklear", sizeof(iconpath));
   fill_pathname_slash(iconpath, sizeof(iconpath));

   nk_menu_layout(nk);
   nk_menu_init_device(nk);

   wimp_context_bg_destroy(nk);
   nk_menu_context_reset_textures(nk, iconpath);

   task_push_image_load(settings->path.menu_wallpaper, "cb_menu_wallpaper",
         menu_display_handle_wallpaper_upload, NULL);
}
コード例 #3
0
ファイル: nuklear.c プロジェクト: Warriors-Blade/RetroArch
static void *nk_menu_init(void **userdata)
{
   settings_t *settings = config_get_ptr();
   nk_menu_handle_t   *nk = NULL;
   menu_handle_t *menu = (menu_handle_t*)
      calloc(1, sizeof(*menu));
   unsigned width, height = 0;

   video_driver_get_size(&width, &height);

   if (!menu)
      goto error;

   if (!menu_display_init_first_driver())
      goto error;

   nk = (nk_menu_handle_t*)calloc(1, sizeof(nk_menu_handle_t));

   if (!nk)
      goto error;

   *userdata = nk;

   fill_pathname_join(nk->assets_directory, settings->directory.assets,
         "nuklear", sizeof(nk->assets_directory));
   nk_menu_init_device(nk);

   /* for demo puposes only, opens all windows */ 
#if 0
      for (int i=0; i < NK_WND_LAST; i++)
         nk->window[i].open = true;
#else
      nk->window[NK_WND_MAIN].open = true;
      nk->window[NK_WND_FILE_PICKER].open = true;
#endif

   return menu;
error:
   if (menu)
      free(menu);
   return NULL;
}