コード例 #1
0
Layout *SystemMenuResource::LoadLayout( const U8Archive &arc, const std::string &lytName )
{
	// read layout data
	u8 *stuff = arc.GetFile( "/arc/blyt/" + lytName + ".brlyt" );
	if( !stuff )
	{
		return NULL;
	}

	// load layout
	Layout *ret = new Layout;
	if( !ret->Load( stuff ) )
	{
		delete ret;
		return NULL;
	}
	//ret->SetLanguage( "ENG" );

	// load fonts and textures
	//ret->LoadFonts( U8Archive(SystemFont::GetFont(), SystemFont::GetFontSize()) );
	ret->LoadFonts( arc );
	if( !ret->LoadTextures( arc ) )
	{
		delete ret;
		return NULL;
	}

	//gprintf( "loaded layout: \"%s\" %.2f x %.2f\n", lytName.c_str(), ret->GetWidth(), ret->GetHeight() );
	return ret;
}
コード例 #2
0
void CCMSDIntegrator::ParseCMSD(std::string filename)
{

	CMSD::CCMSD doc = CMSD::CCMSD::LoadFromFile(filename);
	doc.SaveToFile((::ExeDirectory() + "Test1.xml").c_str(), true);
	//CMSD::CCMSD::DataSection d = doc.DataSection().first();
	CMSD::CwhiteSpaceType root = doc.whiteSpace.first();
	CMSD::CCMSDDocument cmsddocument = doc.CMSDDocument[0];
	CMSD::CDataSectionType2  data  = cmsddocument.DataSection[0];

	for(int i=0; i< data.PartType.count() ; i++)
	{
		Part * apart ( (Part*) Part().CreateSave<Part>());
		apart->Load(data.PartType[i].GetNode());
		//std::vector<IObjectPtr> &someparts ( apart->objects());
		//Part * part2=(Part *) someparts[0].get();
	}
	for(int i=0; i< data.ProcessPlan.count() ; i++)
	{
		ProcessPlan * aplan ( (ProcessPlan *) IObject::CreateSave<ProcessPlan>());
		aplan->Load(data.ProcessPlan[i].GetNode());
	}
	for(int i=0; i< data.Resource.count() ; i++)
	{
		if(Cell::IsResourceCell(data.Resource[i].GetNode()))
		{
			Cell * acell( (Cell *) IObject::CreateSave<Cell>());
			acell->Load(data.Resource[i].GetNode());
		}
		else
		{
			Resource * aresource  ((Resource *) IObject::CreateSave<Resource>());
			aresource->Load(data.Resource[i].GetNode());
		}
	}
	for(int i=0; i< data.Job.count() ; i++)
	{
		Job * ajob  ( IObject::CreateSave<Job>() );
		ajob->Load(data.Job[i].GetNode());
	}
	for(int i=0; i< data.DistributionDefinition.count() ; i++)
	{
		Distribution * astat ( (Distribution *) IObject::CreateSave<Distribution>() );
		astat->LoadDefinition(data.DistributionDefinition[i].GetNode());
	}
	for(int i=0; i< data.Calendar.count() ; i++)
	{
		Calendar *  calendar ( (Calendar *) IObject::CreateSave<Calendar>());
		calendar->Load(data.Calendar[i].GetNode());
	}
	for(int i=0; i< data.Layout.count() ; i++)
	{
		Layout * layout ((Layout *)  IObject::CreateSave<Layout>());
		layout->Load(data.Layout[i].GetNode());
	}
	//CMSD::CInventoryItem inv = data.InventoryItem[0];
	//inv.Location

	int j=0;
}