当前位置: 首页>>代码示例>>C++>>正文


C++ FullPathFileName::init方法代码示例

本文整理汇总了C++中FullPathFileName::init方法的典型用法代码示例。如果您正苦于以下问题:C++ FullPathFileName::init方法的具体用法?C++ FullPathFileName::init怎么用?C++ FullPathFileName::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FullPathFileName的用法示例。


在下文中一共展示了FullPathFileName::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: seedFromFile

void MPLoadMap::seedFromFile( const char* pFileName )
{
	FullPathFileName path;
	path.init( missionPath, pFileName, ".csv" );

	CSVFile file;
	if ( NO_ERR != file.open( path ) )
	{
		Assert( 0, 0, "couldn't open multiplayer mission .csv file" );
		return;
	}

	int i = 1; 
	char fileName[255];
	while( true )
	{
		if ( NO_ERR != file.readString( i, 1, fileName, 255 ) )
			break;

		path.init( missionPath, fileName, ".fit" );
		if ( fileExists( path ) )
		{		
			addFile( fileName, false );
		}

		i++;
	}
}
开发者ID:Echelon9,项目名称:mechcommander2-open,代码行数:28,代码来源:MPLoadMap.cpp

示例2: init

//-------------------------------------------------------------------------------
int32_t Radio::init(PSTR fileName, uint32_t heapSize, PSTR movie)
{
	FullPathFileName pilotAudioPath;
	pilotAudioPath.init(CDsoundPath, fileName, ".pak");
	FullPathFileName noisePath;
	noisePath.init(CDsoundPath, "noise", ".pak");
	//--------------------------------------
	// Startup the packet file.
	radioID				  = currentRadio;
	messagesFile[radioID] = new PacketFile;
	gosASSERT(messagesFile[radioID] != nullptr);
	int32_t result = messagesFile[radioID]->open(pilotAudioPath);
	gosASSERT(result == NO_ERROR);
	if (!noiseFile)
	{
		//--------------------------------------
		// Startup the Noise packet file.
		noiseFile = new PacketFile;
		gosASSERT(noiseFile != nullptr);
		result = noiseFile->open(noisePath);
		gosASSERT(result == NO_ERROR);
	}
	// load message parameters
	if (!messageInfoLoaded)
	{
		if (loadMessageInfo() == NO_ERROR)
			messageInfoLoaded = TRUE;
		else
			Fatal(0, "Unable to load message info.");
	}
	radioList[currentRadio] = this;
	currentRadio++;
	return (NO_ERROR);
}
开发者ID:mechasource,项目名称:mechcommander2,代码行数:35,代码来源:radio.cpp

示例3: if

int	LogisticsMechDisplay::init( )
{
	FitIniFile file;
	FullPathFileName path;
	//path.init( artPath, "mcl_mechinfo", ".fit" );
	/*//magic 16092011 begin
	if ( Environment.screenWidth == 800 ) 
		path.init( artPath, "mcl_mechinfo", ".fit" );
	if ( Environment.screenWidth == 1280 )
		path.init( artPath, "mcl_mechinfo_1280x1024", ".fit" );
	if ( Environment.screenWidth == 1440 )
		path.init( artPath, "mcl_mechinfo_1440x900", ".fit" );
	//magic 16092011 end*/
	//magic 26092011 begin
	if ( Environment.screenWidth == 1280 )
		path.init( artPath, "mcl_mechinfo_1280x1024", ".fit" );
	else if ( Environment.screenWidth == 1440 )
		path.init( artPath, "mcl_mechinfo_1440x900", ".fit" );
	else
		path.init( artPath, "mcl_mechinfo", ".fit" );

	//magic 26092011 end
	if ( NO_ERR !=  file.open( path ) )
	{
		Assert( 0, 0, "Couldn't open mcl_mechinfo.fit" );
		return 0;
	}

	LogisticsScreen::init( file, "Static", "Text", "Rect", "Button" );
	
	mechCamera.init( rects[1].left(), rects[2].top(),
			rects[2].left(), rects[2].bottom() );

	char blockName[64];
	for ( int i = 0; i < 3; i++ )
	{
		sprintf( blockName, "AttributeMeter%ld", i );
		attributeMeters[i].init( &file, blockName );
	}

	
	componentListBox.init( rects[0].left(), rects[0].top(),
		rects[0].width(), rects[0].height() );


	return 1;


}
开发者ID:Echelon9,项目名称:mechcommander2-open,代码行数:49,代码来源:LogisticsMechDisplay.cpp

示例4: updateCampaignMissionInfo

void LogisticsSaveDialog::updateCampaignMissionInfo()
{

	FitIniFile file;
	FullPathFileName path;
	path.init( campaignPath, selectedName, ".fit" );
	if ( NO_ERR != file.open( path ) )
	{
		Assert( 0, 0, "coudln't find the campaign file\n" );
	}

	char fileName[256];

	if ( NO_ERR == file.seekBlock( "Group0Mission0" ) )
	{
		if ( NO_ERR != file.readIdString( "FileName", fileName, 1023 ) )
		{				
			setMission( "" );
		}		
		else
		{
			setMission( fileName );
		}
	}	
	else
		setMission( "" );

}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:28,代码来源:LogisticsDialog.cpp

示例5: readCampaignNameFromFile

void LogisticsSaveDialog::readCampaignNameFromFile( char* fileName, char* resultName, long len )
{
	FullPathFileName path;
	path.init( campaignPath, fileName, ".fit" );

	FitIniFile file;

	if ( NO_ERR != file.open( (char*)(const char*)path ) )
	{
		char errorStr[256];
		sprintf( errorStr, "couldn't open file %s", path );
		Assert( 0, 0, errorStr );
	}

	
	long result = file.seekBlock( "Campaign" );
	Assert( result == NO_ERR, 0, "Coudln't find the mission settings block in the mission file" );

	resultName[0] = 0;
	long lName = 0;

	result = file.readIdLong( "NameID", lName );
	if ( result == NO_ERR )
	{
		cLoadString( lName, resultName, len );
	}
	else
	{
		result = file.readIdString( "CampaignName", resultName, len );
		Assert( result == NO_ERR, 0, "couldn't find the missionName" );
	}
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:32,代码来源:LogisticsDialog.cpp

示例6: isCorrectVersionSaveGame

bool LogisticsSaveDialog::isCorrectVersionSaveGame( char* fileName )
{
	FullPathFileName path;
	path.init( savePath, fileName, ".fit" );

	FitIniFile file;

	if ( NO_ERR != file.open( (char*)(const char*)path ) )
	{
		char errorStr[256];
		sprintf( errorStr, "couldn't open file %s", path );
		STOP((errorStr));
	}

	
	long result = file.seekBlock( "Version" );
	if (result != NO_ERR)
		return false;

	long testVersionNum = 0;
	result = file.readIdLong( "VersionNumber", testVersionNum );
	if ( (result == NO_ERR) && (testVersionNum == SaveGameVersionNumber))
		return true;

	return false;
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:26,代码来源:LogisticsDialog.cpp

示例7:

int	LogisticsMechDisplay::init( )
{
	FitIniFile file;
	FullPathFileName path;
	path.init( artPath, "mcl_mechinfo", ".fit" );
	if ( NO_ERR !=  file.open( path ) )
	{
		Assert( 0, 0, "Couldn't open mcl_mechinfo.fit" );
		return 0;
	}

	LogisticsScreen::init( file, "Static", "Text", "Rect", "Button" );
	
	mechCamera.init( rects[1].left(), rects[2].top(),
			rects[2].left(), rects[2].bottom() );

	char blockName[64];
	for ( int i = 0; i < 3; i++ )
	{
		sprintf( blockName, "AttributeMeter%ld", i );
		attributeMeters[i].init( &file, blockName );
	}

	
	componentListBox.init( rects[0].left(), rects[0].top(),
		rects[0].width(), rects[0].height() );


	return 1;


}
开发者ID:wolfman-x,项目名称:mechcommander2,代码行数:32,代码来源:logisticsmechdisplay.cpp

示例8: setBmp

int aBmpListItem::setBmp( const char* pFileName )
{
	if ( strlen( pFileName ) >= MAXLEN_INSIGNIA_FILE )
		return 0;

	FullPathFileName path;
	path.init( "data\\multiplayer\\insignia\\", pFileName, ".tga" );

	TGAFileHeader header;
	File file;
	if ( NO_ERR == file.open( path ) )
	{
		file.read( (BYTE*)&header, sizeof( header ) );
		if ( header.width != 32 || header.height != 32 || header.pixel_depth < 24 )
			return 0;
	}
	else
		return 0;

	file.close();
		
	bmp.moveTo( 2, 2 );
	bmp.resize( 32, 32 );
	bmp.setTexture( path );
	bmp.setUVs( 0, 0, 32, 32 );
	bmp.setColor( 0xffffffff );
	
	resize( 64, 36 );

	addChild( &bmp );

	fileName = pFileName;
	return true;
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:34,代码来源:mpprefs.cpp

示例9: beginDrag

void MechLabScreen::beginDrag( LogisticsComponent* pComponent )
{
	if ( !pDragComponent )
	{
		pDragComponent = pComponent;

		if ( pDragComponent )
		{
			//initialize the drag object
			int sizeX = pComponent->getComponentWidth();
			int sizeY = pComponent->getComponentHeight();
			
			const char* pFile = pComponent->getIconFileName();

			FullPathFileName path;
			path.init( artPath, pFile, "tga" );

			dragIcon.setTexture( path );
			dragIcon.resize( sizeX * LogisticsComponent::XICON_FACTOR, sizeY * LogisticsComponent::YICON_FACTOR);
			dragIcon.setUVs( 0.f, 0.f, sizeX * 48.f, sizeY * 32.f );
			dragIcon.setColor( 0xffffffff );

			selRect = &selRects[sizeX-1][sizeY-1];

			if ( pComponent->getType() == COMPONENT_FORM_JUMPJET )
			{
				selRect = &selJumpJetRect;
			}

		}
	}
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:32,代码来源:MechLabScreen.cpp

示例10:

ComponentListItem::ComponentListItem(LogisticsComponent* pComp)
{
	if(s_templateItem)
		*this = *s_templateItem;
	pComponent = pComp;
	if(pComp)
	{
		name.setText(pComponent->getName());
		char numericText[32];
		sprintf(numericText, "%ld", pComponent->getCost());
		costText.setText(numericText);
		sprintf(numericText, "%.0lf", pComponent->getHeat());
		heatText.setText(numericText);
		int32_t sizeX = pComponent->getComponentWidth();
		int32_t sizeY = pComponent->getComponentHeight();
		PCSTR pFile = pComponent->getIconFileName();
		FullPathFileName path;
		path.init(artPath, pFile, "tga");
		icon.setTexture(path);
		icon.resize(sizeX * LogisticsComponent::XICON_FACTOR, sizeY * LogisticsComponent::YICON_FACTOR);
		icon.setUVs(0.f, 0.f, sizeX * 48.f, sizeY * 32.f);
		// figure out the difference between this thing's size and
		// the template objects
		int32_t deltaY = icon.height() - s_templateItem->icon.height();
		int32_t deltaX = icon.width() - s_templateItem->icon.width();
		// resize outlines and icon outlines
		outline.resize(outline.width(), outline.height() + deltaY);
		iconOutline.resize(iconOutline.width() + deltaX, iconOutline.height() + deltaY);
		disabledText.resize(outline.width(), outline.height());
		disabledText.moveTo(0, 0);
		disabledText.alignment = 3;
		aObject::init(outline.left(), outline.top(), outline.width(), outline.height());
		addChild(&icon);
		addChild(&name);
		addChild(&costText);
		addChild(&heatText);
		addChild(&costIcon);
		addChild(&heatIcon);
		addChild(&disabledText);
		if(s_templateItem)
		{
			for(size_t i = 0; i < 6; i++)
			{
				for(size_t j = 0; j < COMP_ANIMATION_COUNT; j++)
				{
					if(s_templateItem->pChildAnims[i] == &s_templateItem->animations[j])
					{
						pChildAnims[i] = &animations[j];
					}
				}
			}
		}
	}
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:54,代码来源:componentlistbox.cpp

示例11: CreateFile

long	MissionBriefingScreen::getMissionTGA(const char* missionName)
{
	if (!missionName)
		return 0;

	// do I need to open the file?  I guess so, if this proves too slow,
	// it could be done when a stage is completed
	FullPathFileName path;
	path.init(missionPath, missionName, ".pak");

	if ( 1 == fileExists( path ) )
	{

		// big hack here for some reason we can open files while they're being transferred.
		HANDLE hFile = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0); // MCHD TODO: What is this all about?

		if ( hFile == INVALID_HANDLE_VALUE )
			return 0;

		CloseHandle( hFile );
	}

	// read the tga out of the pak file
	PacketFile file;
	if ( NO_ERR == file.open( path ) ) // in case file has just been created
	{
		if ( file.getNumPackets() > 3 )
		{
	
			file.seekPacket(3);
			long size = file.getPacketSize( );
			BYTE* mem = new BYTE[size];

			file.readPacket( 3, mem );
			
			TGAFileHeader* pHeader = (TGAFileHeader*)mem;
			long bmpWidth = pHeader->width;
			long bmpHeight = pHeader->height;
			flipTopToBottom( (BYTE*)(pHeader + 1), pHeader->pixel_depth, bmpWidth, bmpHeight );
			
			// set up the texture
			long tmpMapTextureHandle = mcTextureManager->textureFromMemory( (unsigned long*)(pHeader+1), gos_Texture_Solid, 0, bmpWidth );

			delete mem;

			return tmpMapTextureHandle;
		}
	}

	return 0;


}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:53,代码来源:MissionBriefingScreen.cpp

示例12: setMission

void LogisticsSaveDialog::setMission( const char* fileName)
{
	if ( strlen( fileName ) )
	{

		long textureHandle = MissionBriefingScreen::getMissionTGA( fileName );

		statics[MAP_STATIC].setTexture( textureHandle );
		statics[MAP_STATIC].setUVs( 0, 127, 127, 0);
		statics[MAP_STATIC].setColor( 0xffffffff );

		FullPathFileName path;
		FitIniFile file;

		path.init( missionPath, fileName, ".fit" );

		if ( NO_ERR == file.open( path ) )
		{
			char missionName[256];
			missionName[0] = 0;
			bool bRes = 0;

			file.seekBlock( "MissionSettings" );
			file.readIdBoolean( "MissionNameUseResourceString", bRes );
			if ( bRes )
			{
				unsigned long lRes;
				file.readIdULong( "MissionNameResourceStringID", lRes );
				cLoadString(lRes, missionName, 255);
			}
			else
			{
				file.readIdString("MissionName", missionName, 255);
			}

			textObjects[2].setText(missionName);

		}
		else
		{
			textObjects[2].setText( "" );
		}

	}
	else
	{
		statics[MAP_STATIC].setColor( 0 );
		textObjects[2].setText( "" );

	}

}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:52,代码来源:LogisticsDialog.cpp

示例13: init

void SplashIntro::init()
{
	FullPathFileName path;
	path.init( artPath, "mcl_splashscreenintro", ".fit" );

	FitIniFile file;
	if ( NO_ERR != file.open( path ) )
	{
		char errorStr[256];
		sprintf( errorStr, "couldn't open file %s", (char*)path );
		Assert(0,0,errorStr );
	}

	LogisticsScreen::init( file, "Static", "Text", "Rect", "Button" );
}
开发者ID:wolfman-x,项目名称:mechcommander2,代码行数:15,代码来源:mainmenu.cpp

示例14: init

int32_t LogisticsMapInfoDialog::init()
{
	FitIniFile file;
	FullPathFileName path;
	path.init(artPath, "mcl_mp_mapinfo", ".fit");
	if (NO_ERROR != file.open(path))
	{
		char buffer2[512];
		sprintf(buffer2, "couldn't open file %s", (PSTR)path);
		Assert(0, 0, buffer2);
		return false;
	}
	LogisticsScreen::init(file, "Static", "Text", "Rect", "Button", "Edit");
	file.seekBlock("InAnim");
	enterAnim.init(&file, "");
	file.seekBlock("OutAnim");
	exitAnim.init(&file, "");
	return 1;
}
开发者ID:mechasource,项目名称:mechcommander2,代码行数:19,代码来源:logisticsdialog.cpp

示例15: end

void MissionResults::end()
{
	//Need to save the game here so salvage and pilot promotion get saved as well!
	// Pity we never call ::end!
	const char* pMissionName = LogisticsData::instance->getLastMission();

	if ( pMissionName && !LogisticsData::instance->isSingleMission() && !LogisticsData::instance->campaignOver() && !MPlayer )
	{
		FitIniFile file;
		char name[256];
		cLoadString( IDS_AUTOSAVE_NAME, name, 255 );
		char fullName[256];
		sprintf( fullName, name, pMissionName );
		FullPathFileName path;
		path.init( savePath, fullName, ".fit" );
		if ( NO_ERR == file.create( path ) )
			LogisticsData::instance->save( file );
	}
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:19,代码来源:MissionResults.cpp


注:本文中的FullPathFileName::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。