m_queue.cpp

来自「基于WindowCE上对于windows mobile开发的一个俄罗斯方块程序」· C++ 代码 · 共 76 行

CPP
76
字号
#include "StdAfx.h"
#include "m_Queue.h"
#define IDB_BITMAP_BLOCK                132

m_Queue::m_Queue(void)
{


}

m_Queue::~m_Queue(void)
{
}

void m_Queue::OnDraw(CDC * pDC,int Bottom_X,int Bottom_Y)
{
	for (int i = 0;i<QUEUELENTH;i++)
	{
		_Cell[i].OnDraw(pDC,Bottom_X,Bottom_Y);
	}

}

void m_Queue::SetPosition(int index, short sX, short sY)
{
	_Cell[index].SetPosition(sX,sY);
}


int m_Queue::GetColorIndex(int index)
{
	return _Cell[index]._ColorIndex;
}

void m_Queue::SetColorIndex(int index,int color)
{
	 _Cell[index]._ColorIndex= color;
}

void m_Queue::SetRandomColorIndex()
{
	int index = rand() % COLORKIND;
	double j = 0;
	
	for (int i = 1;i<QUEUELENTH;i++)
	{
		/*   Display   10   numbers.   */   
		int index2 = rand() % COLORKIND;
		j = j+index2;
		_Cell[i]._ColorIndex = index2;
	}
	if ((index*3) == j)
	{
		index = COLORKIND-1-index;
	}
	_Cell[0]._ColorIndex = index;
}

void m_Queue::TurnAround()
{
	int tmp = _Cell[0]._ColorIndex;
	
	_Cell[0]._ColorIndex = _Cell[1]._ColorIndex;
	_Cell[1]._ColorIndex = _Cell[3]._ColorIndex; 
	_Cell[3]._ColorIndex = _Cell[2]._ColorIndex; 
	_Cell[2]._ColorIndex = tmp; 
	
	
}



//m_Queue& m_Queue::operator = (const m_Queue &lhs)
//{
//	return *this;
//}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?