Beispiel #1
0
//why not image:dump 因为也只有这里用,写到类里没意思。
void graph::dump_resource(const std::string& type) const
{
	std::cout << "\n"__FUNCTION__" " << type << std::endl;
	unsigned long time = get_time_now();

	file_source* source = find_file_source(type.c_str());
	if (source)
		source->dump_resource();

	if (type == "all")
	{
		dump_resource("image");
		dump_resource("texture");
		dump_resource("texture_font");	
		dump_resource("font");
	}
	else if (type == "image")
	{
		for (auto it = image_map.begin(); it != image_map.end(); ++it)
		{
			const image* img = it->second;
			std::cout << it->first << " ref: " << img->m_ref << " time: " << TIME(img) << std::endl;
		}	
	}
	else if (type == "texture")
	{
		for (auto it = texture_map.begin(); it != texture_map.end(); ++it)
		{
			const texture* tex = it->second;
			std::cout << it->first << " time: " << TIME(tex) << std::endl;
		}	
	}
	else if (type == "texture_font")
	{
		for (auto it = texture_font_map.begin(); it != texture_font_map.end(); ++it)
		{
			const texture_font* tf = it->second;
			std::cout << it->first << " time: " << TIME(tf) << std::endl;
			for (auto it2 = tf->m_map_char.begin(); it2 != tf->m_map_char.end(); ++it2)
			{
				const texture_char* tc = it2->second;
				std::cout << "\t" << core::UnicodeCharToANSI(it2->first) << " time: " << TIME(tc) << std::endl;
			}
		}
	}
	else if (type == "font")
	{
		dump_font();
	}
}
Beispiel #2
0
/* ------------------------------------------------------------------ */
static void choose_font(void)
{
OBJECT *loading;
int cx, cy, cw, ch;
bool is_prn;

   is_prn = (form_alert( 1, "[0][select device][screen|printer]" )==2);
   dprintf(( "\033Hselected %s workstation\n", is_prn? "printer": "screen" ));

   if( init_wkstn( is_prn ) ) {

      graf_mouse(BUSY_BEE, 0);
      dprintf(( "ready to load fonts ... " )); dgetchar();
      rsrc_gaddr( R_TREE, LDGFONTS, &loading );
      form_center( loading, &cx, &cy, &cw, &ch);
      form_dial(FMD_START, 0, 0, 0, 0, cx, cy, cw, ch);
      objc_draw( loading, ROOT, MAX_DEPTH, cx, cy, cw, ch);
      (void)vst_load_fonts(handle, 0);
      form_dial( FMD_FINISH, 0, 0, 0, 0, cx, cy, cw, ch );
      dprintf(( "\033Hdone\nnow getting font names ..." )); dgetchar();
      if( get_fontnames( *(tGemFont **)(&_contrl[10]) ) ) {
	 dprintf(( "done\n" )); dgetchar();
	 graf_mouse(ARROW, 0);
	 while( select_font( is_prn ) ) {
	    if( iSelected == NO_INDEX ) {
	       form_alert( 1, "[1][You must choose|a font to dump][Try Again]" );
	    }
	    else if( gem_file_name[0] == '\0' ) {
	       form_alert( 1, "[1][You must choose a|"
			 "gem font file name][Try Again]" );
	    }
	    else {
	       dump_font();
	       gem_file_name[0] = '\0'; /* reset entries for next round */
	       iSelected = NO_INDEX;
	    } /* if */
	 } /* while */
      } /* if */

      vst_unload_fonts(handle, 0);

      free(name_table);

      dprintf(( "\033Hclosing %s workstation ...", is_prn? "printer": "screen" ));
      if( is_prn ) v_clswk(handle);
      else v_clsvwk(handle);
   }
   else form_alert(1, "[3][Can't open workstation][OK]");

} /* choose_font() */
Beispiel #3
0
int mxf2c(const char *src, const char *out) {



	struct SDL_Font *font = SDL_InitFont(src);
	if(!font) {
		fprintf(stderr, "Error font couldnt be opened..");
		return 0;
	}

	dump_font(font,out);

	SDL_FreeFont(font);
	return 1;
}
Beispiel #4
0
/*
 *****************************************************************************
 * Function	: dump_resources
 * Syntax	: void dump_resources(const resource_t *top)
 * Input	:
 *	top	- Top of the resource tree
 * Output	:
 *	nop
 * Description	: Dump the parsed resource-tree to stdout
 * Remarks	:
 *****************************************************************************
*/
void dump_resources(const resource_t *top)
{
	printf("Internal resource-tree dump:\n");
	while(top)
	{
		printf("Resource: %s\nId: %s\n",
		       get_typename(top),
		       get_nameid_str(top->name));
		switch(top->type)
		{
		case res_acc:
			dump_accelerator(top->res.acc);
			break;
		case res_bmp:
			dump_bitmap(top->res.bmp);
			break;
		case res_cur:
			dump_cursor(top->res.cur);
			break;
		case res_curg:
			dump_cursor_group(top->res.curg);
			break;
		case res_dlg:
			dump_dialog(top->res.dlg);
			break;
		case res_dlgex:
			dump_dialogex(top->res.dlgex);
			break;
		case res_fnt:
			dump_font(top->res.fnt);
			break;
		case res_icog:
			dump_icon_group(top->res.icog);
			break;
		case res_ico:
			dump_icon(top->res.ico);
			break;
		case res_men:
			dump_menu(top->res.men);
			break;
		case res_menex:
			dump_menuex(top->res.menex);
			break;
		case res_rdt:
			dump_rcdata(top->res.rdt);
			break;
		case res_stt:
			dump_stringtable(top->res.stt);
			break;
		case res_usr:
			dump_user(top->res.usr);
			break;
		case res_msg:
			dump_messagetable(top->res.msg);
			break;
		case res_ver:
			dump_versioninfo(top->res.ver);
			break;
		case res_dlginit:
			dump_dlginit(top->res.dlgi);
			break;
		case res_toolbar:
			dump_toolbar(top->res.tbt);
			break;
		case res_anicur:
		case res_aniico:
			dump_ani_curico(top->res.ani);
			break;
		default:
			printf("Report this: Unknown resource type parsed %08x\n", top->type);
		}
		printf("\n");
		top = top->next;
	}
}