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


C++ CAnimation::SetReversed方法代码示例

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


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

示例1: LoadBinary


//.........这里部分代码省略.........
		{
			anim = new CAnimation();
			//Frame Count
			in.read((char *)&nFrameCount, sizeof(int));
			for(int j = 0; j < nFrameCount; j++)
			{
			    //Anchor Point
				int nAPointX, nAPointY;
                in.read((char *)&nAPointX, sizeof(int));
                in.read((char *)&nAPointY, sizeof(int));
                //Draw Rect
				int nLeft, nTop, nRight, nBottom;
                in.read((char *)&nLeft, sizeof(int));
				in.read((char *)&nTop, sizeof(int));
				in.read((char *)&nRight, sizeof(int));
				in.read((char *)&nBottom, sizeof(int));
                //Collision Rect
                int nCLeft, nCTop, nCRight, nCBottom;
                in.read((char *)&nCLeft, sizeof(int));
				in.read((char *)&nCTop, sizeof(int));
				in.read((char *)&nCRight, sizeof(int));
				in.read((char *)&nCBottom, sizeof(int));
                //Duration
				float fDuration;
                in.read((char *)&fDuration, sizeof(float));
                //Trigger
				int nTrigLength;
				std::string szTriggerID;
                in.read((char *)&nTrigLength, sizeof(int));
                for (int h = 0; h < nTrigLength; h++) 
                {
					char szletter;
                    in.read((char *)&szletter, sizeof(char));
					szTriggerID.push_back(szletter);
                }
				frame = new CFrame(fDuration, szTriggerID,
					               nAPointX - nRight, nAPointY - nBottom,
					               nTop, nLeft, nBottom, nRight,
								   nCTop, nCLeft, nCBottom, nCRight);
				anim->AddFrame(frame);
			}//end frame loop
			//Path & Filename
			int nPathFileLength;
			std::string szPathFilename;
            in.read((char *)&nPathFileLength, sizeof(int));
            for (int n = 0; n < nPathFileLength; n++)
            {
                char szletter;
                in.read((char *)&szletter, sizeof(char));
			    szPathFilename.push_back(szletter);
            }
            //Filename 
            int nFileLength;
			std::string szFilename;
            in.read((char *)&nFileLength, sizeof(int));
            for (int k = 0; k < nFileLength; k++)
            {
                char szletter;
                in.read((char *)&szletter, sizeof(char));
			    szFilename.push_back(szletter);
            }
            //Name
            int nNameLength;
			std::string szName;
            in.read((char *)&nNameLength, sizeof(int));
            for (int k = 0; k < nNameLength; k++)
            {
                char szletter;
                in.read((char *)&szletter, sizeof(char));
			    szName.push_back(szletter);
            }
			anim->SetName(szName);
            //ImageID
			int nImageID; //-useless
            in.read((char *)&nImageID, sizeof(int));
            //Speed
			float fSpeed;
            in.read((char *)&fSpeed, sizeof(float));
			anim->SetSpeed(fSpeed);
            //Looping
			bool bIsLooping;
            in.read((char *)&bIsLooping, sizeof(bool));
			anim->SetLooping(bIsLooping);
            //Reversed
            bool bIsReversed;
            in.read((char *)&bIsReversed, sizeof(bool));
			anim->SetReversed(bIsReversed);
			list.push_back(anim);
		}//end animation loop
		//add them to the main list - in reverse order
		for(int size = (list.size() - 1); size >= 0; size--)
		{
			AddAnimation(list[size]);
		}
		
		in.close();
		return true;
	}
	return false;
}
开发者ID:Ethanthecrazy,项目名称:baf-labyrinth-game,代码行数:101,代码来源:CAnimationManager.cpp

示例2: LoadXML


//.........这里部分代码省略.........
					pDataChild = pDataChild->FirstChildElement("X");
					x = pDataChild->GetText();
					nx = atoi(x.c_str()); 
					pDataChild = pData->FirstChildElement("RDrawRect");
					pDataChild = pDataChild->FirstChildElement("Y");
					y = pDataChild->GetText();
					ny = atoi(y.c_str()); 
					pDataChild = pData->FirstChildElement("RDrawRect");
					pDataChild = pDataChild->FirstChildElement("Width");
					width = pDataChild->GetText();
					nwidth = atoi(width.c_str());
					pDataChild = pData->FirstChildElement("RDrawRect");
					pDataChild = pDataChild->FirstChildElement("Height");
					height = pDataChild->GetText();
					nheight = atoi(height.c_str());
					//Collision Rect
					pDataChild = pData->FirstChildElement("RCollisionRect");
					pDataChild = pDataChild->FirstChildElement("X");
					x = pDataChild->GetText();
					cx = atoi(x.c_str()); 
					pDataChild = pData->FirstChildElement("RCollisionRect");
					pDataChild = pDataChild->FirstChildElement("Y");
					y = pDataChild->GetText();
					cy = atoi(y.c_str()); 
					pDataChild = pData->FirstChildElement("RCollisionRect");
					pDataChild = pDataChild->FirstChildElement("Width");
					width = pDataChild->GetText();
					cwidth = atoi(width.c_str());
					pDataChild = pData->FirstChildElement("RCollisionRect");
					pDataChild = pDataChild->FirstChildElement("Height");
					height = pDataChild->GetText();
					cheight = atoi(height.c_str());
					//Duration
					pData = pFrames;
					pDataChild = pData->FirstChildElement("FDuration");
					dur = pDataChild->GetText();
					fdur = (float)atof(dur.c_str()); 
					//TriggerID
					std::string name;
					pDataChild = pData->FirstChildElement("SzTriggerID");
					if(pDataChild->GetText())
						name = pDataChild->GetText();
					//Add Frame
					frame = new CFrame(fdur, name, 
						anchorx - (nx + nwidth), anchory - (ny + nheight),
						ny, nx, (ny + nheight), (nx + nwidth),
						cy, cx, (cy + cheight), (cx + cwidth));
					anim->AddFrame(frame);
					pFrames = pFrames->NextSiblingElement("CFrame");
				}//end CFrame	
			}//end list of frames
			std::string speed;
			float fspeed;
			pData = pAnims;
			//ImageID
			//pAnims->FirstAttribute();
			//Animation name
			//pData->FirstChildElement("SzName")->GetText();
			std::string name = pData->FirstChildElement("SzName")->GetText();
			anim->SetName(name);
			//Filename
			//pData->NextSibling("SzFilename");
			//Filename&Path
			//pData->NextSibling("SzFilenameWithPath");
			//Speed
			speed = pAnims->FirstChildElement("FSpeed")->GetText();
			fspeed = (float)atof(speed.c_str());
			anim->SetSpeed(fspeed);
			//IsPlaying

			//IsLooping
			std::string text;
			text = pAnims->FirstChildElement("BIsLooping")->GetText();
			if(text == "true")
				anim->SetLooping(true);
			else if(text == "false")
				anim->SetLooping(false);

			//IsReversed
			text = pAnims->FirstChildElement("BIsReversed")->GetText();
			if(text == "true")
				anim->SetReversed(true);
			else if(text == "false")
				anim->SetReversed(false);

			list.push_back(anim);
			//to next Animation in file
			pAnims = pAnims->NextSiblingElement("CAnimation");

		}//End CAnimation
		//add them to the main list - in reverse order
		for(int size = (list.size() - 1); size >= 0; size--)
		{
			AddAnimation(list[size]);
		}
		return true;
	}

	return false;
}
开发者ID:Ethanthecrazy,项目名称:baf-labyrinth-game,代码行数:101,代码来源:CAnimationManager.cpp


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