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


C++ Bone::display方法代码示例

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


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

示例1: display

bool Board::display() //Displays the board
{
	if (!hasSpinner() && rightRow.size() == 0)
		return false;

	if (!hasSpinner())  //if no spinner is in the board
	{
		vector<Bone> vecRow = getRow('e');
		int numChars = vecRow.size()*4;
		numChars = 60 - numChars/2;
		int x = numChars;
		int y = 27;
		for (unsigned int i = 0; i < vecRow.size(); i++)
		{
			Bone tempBone = vecRow[i];
			if (i == 0)
				tempBone.swap();
			tempBone.display(x,y,'e');
		}
	}
	else               //if there is a spinner on the board
	{
		int tempX = 60;
		int tempY = 27;
		spinner.display(tempX,tempY,'e');

		if (rightRow.size() != 0)
		{
			int x = 62;
			int y = 27;
			bool up = false;
			bool left = false;
			bool lastDouble = false;
			for (unsigned int i = 0; i < rightRow.size(); i++) //the following code accounts for the possibility of the bones coming out of the board's limits
			{
				if (x >= 114 && !up)
				{
					up = true;
					if (lastDouble)
					{
						y = y - 3;
						x = x - 2;
					}
					else
					{
						x = x - 2;
						y = y - 2;
					}
				}
				if (y <= 8 && !left)
				{
					left = true;
					if (lastDouble)
					{
						y = y + 2;
						x = x - 3;
					}
					else
					{
						y = y + 2;
						x = x - 2;
					}
				}

				if (up)
					if (left)
						rightRow[i].display(x,y,'w');
					else
						rightRow[i].display(x,y,'n');
				else
					rightRow[i].display(x,y,'e');

				if (rightRow[i].isDouble())
					lastDouble = true;
				else
					lastDouble = false;
			}
		}

		if (leftRow.size() != 0)
		{
			int x = 58;
			int y = 27;
			bool down = false;
			bool right = false;
			bool lastDouble = false;
			for (unsigned int i = 0; i < leftRow.size(); i++)
			{
				if (x <= 4 && !down)
				{
					down = true;
					if (lastDouble)
					{
						x = x + 2;
						y = y + 3;
					}
					else
					{
						x = x + 2;
						y = y + 2;
//.........这里部分代码省略.........
开发者ID:vascofg,项目名称:prog-dominoes,代码行数:101,代码来源:Board.cpp


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