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


C++ Mover::GetPause方法代码示例

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


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

示例1: SaveLevelToDisk

bool LevelFileIO::SaveLevelToDisk(const char * cFilePath, LevelScene * pScene){
	if(pScene && pScene->GridOk()){
		const int GridWidth = pScene->GetWidth();
		const int GridHeight = pScene->GetHeight();

		ofstream FileOut(cFilePath);
		if(FileOut.is_open()){
			FileOut << "Foof72" << endl;

			FileOut << GridWidth << endl;
			FileOut << GridHeight << endl;
			const int Total = GridWidth * GridHeight;
			for(int y = 0; y < GridHeight; y++){
				//const int YSkip = y * GridWidth;
				for(int x = 0; x < GridWidth; x++){
					//Output the level grid one tile at a time
					const int TileID = pScene->GetGridUnit(x,y);
					FileOut << TileID << endl;
				}
			}
			const float PlayerStartX = pScene->GetPlayerStartX();
			const float PlayerStartY = pScene->GetPlayerStartY();
			//Then player start location
			if(PlayerStartX > -1 && PlayerStartY > -1){
				FileOut << PlayerStartX << endl;
				FileOut << PlayerStartY << endl;
			}else{
				FileOut << 0 << endl;
				FileOut << 0 << endl;
			}
			//Exit Location
			FileOut << pScene->ExitPos_X << endl
				<< pScene->ExitPos_Y << endl;

			//Output total number of game objects in level
			FileOut << pScene->PropList.size() + pScene->EnemyList.size() + pScene->DecoList.size() + pScene->HazardList.size() + pScene->TokenList.size() << endl;

			//Output props (coins , etc) if they exist
			const int nProps = pScene->PropList.size();
			FileOut << nProps << endl;
			if(nProps > 0){
				for(vector<PropStruct*>::iterator it = pScene->PropList.begin(); it < pScene->PropList.end(); it++){
					PropStruct * pProp = (*it);
					FileOut << ((int)pProp->uType - 1) << endl
							<< pProp->x << endl
							<< pProp->y << endl;
				}
			}
			//Output ENEMIES
			const int nEnemies = pScene->EnemyList.size();
			FileOut << nEnemies << endl;
			if(nEnemies > 0){
				for(vector<PropStruct*>::iterator it = pScene->EnemyList.begin(); it < pScene->EnemyList.end(); it++){
					PropStruct * pProp = (*it);
					FileOut << pProp->ExtendedInfo->ArrayID << endl
							<< pProp->x << endl
							<< pProp->y << endl;

					switch(pProp->ExtendedInfo->SubType){
						case 2:{
							Mover * pMover = (Mover*)pProp;
							FileOut << (int)pMover->GetFunctionType() << endl
								<< (int)pMover->GetMoverType() << endl 
								<< pMover->OriginX << endl
								<< pMover->OriginY << endl
								<< pMover->GetSpeed() << endl
								<< pMover->GetWidth() << endl
								<< pMover->GetPause() << endl
								<< pMover->Sync << endl;
							break;
						}
						case 3:{ //Snapmouth

							break;
						}
						case 5:{ // Destructible
							FileOut << (pProp->x - pProp->ExtendedInfo->fDefaultScale) << endl
								     << (pProp->x + pProp->ExtendedInfo->fDefaultScale) << endl;
							break;
						}
						case 0:{
							//Compute Potential Visibility Bounds
							float VisibilityMax, VisibilityMin;
							float XDelta = 0.1f;

							float X = pProp->x;
							float Y = TraceFloorHeight(X, pProp->y) + 0.1f;
							float PrevY = Y;
							while(abs(Y - PrevY) < 0.15f){
								PrevY = Y;
								X += XDelta;
								Y = TraceFloorHeight(X, Y) + 0.1f;
							}
							VisibilityMax = X - XDelta*2.0f;
							
							X = pProp->x;
							Y = TraceFloorHeight(X, pProp->y) + 0.1f;
							PrevY = Y;
							while(abs(Y - PrevY) < 0.15f){
								PrevY = Y;
//.........这里部分代码省略.........
开发者ID:JIoffe,项目名称:Flame-Broiled-Fury-BETA,代码行数:101,代码来源:LevelFileIO.cpp


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