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


C++ Ball::GetCenterY方法代码示例

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


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

示例1: TiXmlDeclaration

//---------------------------------------------------------------------------
// ----- Methods :: File Serialize (XML) ----- //
//---------------------------------------------------------------------------
bool	Strip::Save		(const TCHAR* lpszFileName)
{
	// ----- Initialize & Declare ----- //
	FILE* stream = _tfopen(lpszFileName, _T("wb") CHARSET);

	if (stream == NULL || _pPimpl == NULL)
	{
		return false;
	}

	TiXmlDocument		doc;
	TiXmlDeclaration*	pDecl;
	TiXmlElement*		pRoot;
	TiXmlElement*		pBlockNode;
	TiXmlElement*		pUnitNode;
	TiXmlElement*		pBallNode;

	Block*				pBlockObject;
	Unit*				pUnitObject;
	Ball*				pBallObject;

	int					vectorBlockSize;
	int					vectorUnitCountX;
	int					vectorUnitCountY;
	int					vectorBallSize;

	pDecl = new TiXmlDeclaration("1.0", "euc-kr", "");
	doc.LinkEndChild(pDecl);

	// ----- Set a Strip Data ----- //
	pRoot = new TiXmlElement(ROOT_NAME_STRIP);
	pRoot->SetDoubleAttribute(ATTR_NAME_WIDTH,	_pPimpl->dWidth);
	pRoot->SetDoubleAttribute(ATTR_NAME_HEIGHT,	_pPimpl->dHeight);
	doc.LinkEndChild(pRoot);

	// ----- Insert a Block Data ----- //
	pBlockObject = FirstBlock();
	if (pBlockObject != NULL)
	{
		do
		{
			pBlockNode = new TiXmlElement(NODE_NAME_BLOCK);

			pBlockNode->SetDoubleAttribute(ATTR_NAME_COLUMN,	pBlockObject->GetColumn	());
			pBlockNode->SetDoubleAttribute(ATTR_NAME_ROW,		pBlockObject->GetRow	());
			pBlockNode->SetDoubleAttribute(ATTR_NAME_WIDTH,		pBlockObject->GetWidth	());
			pBlockNode->SetDoubleAttribute(ATTR_NAME_HEIGHT,	pBlockObject->GetHeight	());
			pBlockNode->SetDoubleAttribute(ATTR_NAME_START_X,	pBlockObject->GetStartX	());
			pBlockNode->SetDoubleAttribute(ATTR_NAME_START_Y,	pBlockObject->GetStartY	());

			// ----- Insert a Unit (in Block) Data ----- //
			pUnitObject = pBlockObject->FirstUnit();
			if (pUnitObject != NULL)
			{
				do
				{
					pUnitNode = new TiXmlElement(NODE_NAME_UNIT);

					pUnitNode->SetDoubleAttribute(ATTR_NAME_COLUMN,		pUnitObject->GetColumn	());
					pUnitNode->SetDoubleAttribute(ATTR_NAME_ROW,		pUnitObject->GetRow		());
					pUnitNode->SetDoubleAttribute(ATTR_NAME_START_X,	pUnitObject->GetStartX	());
					pUnitNode->SetDoubleAttribute(ATTR_NAME_START_Y,	pUnitObject->GetStartY	());
					pUnitNode->SetDoubleAttribute(ATTR_NAME_CENTER_X,	pUnitObject->GetCenterX	());
					pUnitNode->SetDoubleAttribute(ATTR_NAME_CENTER_Y,	pUnitObject->GetCenterY	());
					pUnitNode->SetDoubleAttribute(ATTR_NAME_WIDTH,		pUnitObject->GetWidth	());
					pUnitNode->SetDoubleAttribute(ATTR_NAME_HEIGHT,		pUnitObject->GetHeight	());

					// ----- Insert a Ball (in Unit) Data ----- //
					pBallObject = pUnitObject->FirstBall();
					if (pBallObject != NULL)
					{
						do
						{
							pBallNode = new TiXmlElement(NODE_NAME_BALL);

							pBallNode->SetDoubleAttribute(ATTR_NAME_DIAMETER,		pBallObject->GetDiameter	());
							pBallNode->SetDoubleAttribute(ATTR_NAME_CENTER_X,		pBallObject->GetCenterX		());
							pBallNode->SetDoubleAttribute(ATTR_NAME_CENTER_Y,		pBallObject->GetCenterY		());
							pBallNode->SetDoubleAttribute(ATTR_NAME_BALL_STATUS,	pBallObject->GetStatus		());

							pUnitNode->LinkEndChild(pBallNode);
						}
						while ((pBallObject = pUnitObject->NextBall()) != NULL);
					}

					pBlockNode->LinkEndChild(pUnitNode);
				}
				while ((pUnitObject = pBlockObject->NextUnit()) != NULL);
			}

			pRoot->LinkEndChild(pBlockNode);
		}
		while ((pBlockObject = NextBlock()) != NULL);
	}

	// ----- Save and Close ----- //
	doc.SaveFile(stream);
//.........这里部分代码省略.........
开发者ID:japgo,项目名称:mygithub,代码行数:101,代码来源:strip.cpp


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