Exemple #1
0
/** 
 * import umdraw mesh list
 */
bool UMSoftwareIO::import_mesh_list(UMMeshList& dst, const umio::UMObjectPtr src, const umstring& absolute_file_path)
{
	if (!src) return false;

	bool result = false;
	umio::UMMesh::IDToMeshMap::iterator it = src->mutable_mesh_map().begin();
	for (; it != src->mutable_mesh_map().end(); ++it)
	{
		umio::UMMesh& ummesh = it->second;

		UMMeshPtr mesh(std::make_shared<UMMesh>());
		dst.push_back(mesh);
		result = true;
		
		sort_by_material(ummesh);
		load_material(absolute_file_path, mesh, ummesh);
		load_vertex_index(mesh, ummesh);
		load_vertex(mesh, ummesh);
		load_normal(mesh, ummesh);
		load_uv(mesh, ummesh);
		load_skin(mesh, ummesh);
		mesh->update_box();
	}
	return result;
}
Exemple #2
0
void vid_preinit()
{
	graphics_init(528, 320, (void*)0xAC200000);
	set_pen(create_rgb16(0, 0, 0));
	if (!load_skin())
		draw_rect(0, 0, 528, 320);
	lcdc_copy_vram();
}
Exemple #3
0
extern skin_t*
tcvp_open_ui(xtk_widget_t *w, void *p)
{
    char *buf;
    widget_data_t *wd;

    widget_data_t *owd = xtk_widget_get_data(w);

    char *uifile = owd->action_data;
    skin_t *s = owd->skin;

    buf = malloc(strlen(uifile) + strlen(s->path) + 2);
    sprintf(buf, "%s/%s", s->path, uifile);

    skin_t *skin = load_skin(buf);
    if(!skin) {
        return NULL;
    }

    skin->window = xtk_window_create(NULL, 0, 0, skin->width, skin->height);
    xtk_window_set_dnd_callback(skin->window, tcvp_add_file);
    xtk_window_set_class(skin->window, "TCVP");

    if(create_ui(skin->window, skin, skin->config, NULL) != 0){
        tc2_print("TCVPX", TC2_PRINT_ERROR,
                  "Unable to load skin: \"%s\"\n", buf);
        return NULL;
    }

    free(buf);

    wd = tcallocdz(sizeof(*wd), NULL, widgetdata_free);
    wd->action = skin->dblclick;
    wd->skin = tcref(skin);
    xtk_widget_container_set_data(skin->window, wd);

    xtk_window_set_doubleclick_callback(skin->window, lookup_action);

    xtk_window_set_sticky_callback(skin->window, sticky_cb);
    xtk_window_set_on_top_callback(skin->window, on_top_cb);

    char *default_text = malloc(1024);
    tcconf_getvalue(skin->config, "title", "%s", &wd->value);
    if(wd->value == NULL) {
        wd->value = strdup(tcvp_ui_tcvpx_conf_window_title);
    }
    register_textwidget(skin->window, wd->value);

    parse_text(wd->value, default_text, 1024);
    xtk_window_set_title(skin->window, default_text);
    free(default_text);

    xtk_window_show(skin->window);

    if((s->state & ST_STICKY) != 0) {
        xtk_window_set_sticky(skin->window, 1);
        skin->state |= ST_STICKY;
    }

    if((s->state & ST_ON_TOP) != 0) {
        xtk_window_set_always_on_top(skin->window, 1);
        skin->state |= ST_ON_TOP;
    }

    tcconf_getvalue(skin->config, "id", "%s", &skin->id);
    skin->skin_hash = s->skin_hash;
    if(skin->id != NULL) {
        tchash_search(skin->skin_hash, skin->id, -1, skin, NULL);
    }

    ui_count++;

    return skin;
}
Exemple #4
0
int
main (int argc, char *argv[])
{
  int cnt;
  const char *p;
  char arg[128];
  
#ifdef __WIN32__
  HMODULE hModule;
  char *sBuffer;
  DWORD dWord;
  char *dirname;
  char *base_dir;
  char *pixmap_dir;
  char *locale_dir;
  
  // Init the path for the Windows version by getting the 
  // executable location.
  hModule = GetModuleHandle("skinedit.exe");
  sBuffer = (char *) malloc(4096 * sizeof(char));
  dWord = GetModuleFileName(hModule, sBuffer, 4096);
  dirname = g_dirname(sBuffer);
  base_dir = g_strconcat(dirname, "\\", NULL);
  g_free(dirname);
  free(sBuffer);
  
  pixmap_dir = g_strconcat(base_dir, "pixmaps\\", NULL);
  locale_dir = g_strconcat(base_dir, "locale\\", NULL);
#endif

#ifdef ENABLE_NLS
#ifndef __WIN32__
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#else
  bindtextdomain(PACKAGE, locale_dir);
  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);

#ifndef __WIN32__
  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
#else
  add_pixmap_directory (pixmap_dir);
#endif

  signal(SIGINT, signal_handler);

  fprintf(stdout, _("SkinEdit v%s, (C) 2002-2003 Julien BLACHE <*****@*****.**>\n"), VERSION);
  fprintf(stdout, _("                  2004-2005 Romain Lievin <*****@*****.**>\n"));
  fprintf(stdout, "\n");
  fprintf(stdout, _("This program is free software; you can redistribute it and/or modify\n"));
  fprintf(stdout, _("it under the terms of the GNU General Public License as published by\n"));
  fprintf(stdout, _("the Free Software Foundation; version 2 of the License\n"));
  fprintf(stdout, _("This program is distributed in the hope that it will be useful,\n"));
  fprintf(stdout, _("but WITHOUT ANY WARRANTY; without even the implied warranty of\n"));
  fprintf(stdout, _("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"));
  fprintf(stdout, _("GNU General Public License for more details.\n"));

  gtk_widget_show (main_wnd = create_main_window());

  sbar_print(_("Skinedit v%s -- Supported formats : TiEmu v2.00 (R/W), VTiv2.1 (R/W), VTiv2.5 (R/W)"), VERSION);

    // scan command line
    for (cnt = 1; cnt < argc; cnt++) {
      
      // get argument
      p = argv[cnt];
      if (*p == '-') {
	// argument
	p++;
      } else {
	// filename
	if(load_skin(p) == 0)
	  skin_infos.changed = 1;
      }
      
      strcpy(arg, p);
      
      if (strexact(arg, "-help") || strexact(arg, "h"))
	help();
      if (strexact(arg, "-version") || strexact(arg, "v"))
	exit(0);
    }
    
    gtk_main ();
    return 0;
}
Exemple #5
0
void playlist_play(void)
{
    char *filename = NULL;

    if (get_playlist_length() == 0)
        return;

    /* If the user wants a skin randomly selected on play */
    if (cfg.random_skin_on_play)
    {
        /* Get the current skin list */
        scan_skins();
        /* If there are entries */
        if (g_list_length(skinlist)) {
            /* Get a random value to select the skin to use */
            int randval = (gint)(random() / (RAND_MAX + 1.0) * (g_list_length(skinlist) + 1));
            /* If the random value is 0, use the default skin */
            /* Otherwise subtract 1 from the random value and */
            /* select the skin */
            if (randval == 0)
                load_skin(NULL);
            else
            {
                struct SkinNode *skin;
                skin = g_list_nth(skinlist, randval - 1)->data;
                load_skin(skin->path);
            }
        }
        /* Call scan_skins() again to make sure skin selector */
        /* is up to date */
        scan_skins();
    }

    if (get_input_playing())
        input_stop();

    vis_clear_data(mainwin_vis);
    vis_clear_data(playlistwin_vis);
    svis_clear_data(mainwin_svis);
    mainwin_disable_seekbar();

    PL_LOCK();
    if (playlist)
    {
        if (!playlist_position)
        {
            if (cfg.shuffle)
                playlist_position = shuffle_list->data;
            else
                playlist_position = playlist->data;
        }
        filename = playlist_position->filename;
    }
    PL_UNLOCK();

    if (!filename)
        return;

    input_play(filename);

    if (input_get_time() != -1)
    {
        equalizerwin_load_auto_preset(filename);
        input_set_eq(cfg.equalizer_active, cfg.equalizer_preamp,
                     cfg.equalizer_bands);
    }
    playlist_check_pos_current();
}