亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? block.cpp

?? 俄羅斯方塊 采用MFC和GDI+編寫的,自己感覺寫得不是很好,不過看上去還行
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
#include "stdafx.h"
#include "Block.h"

Block::Block(void)
{
}

Color Block::backColors[8] = {Color(),Color::Red,Color::Blue,Color::Red,
		Color::Yellow,Color::Green,Color::White,Color::Black};

Color Block::foreColor[8] = {Color(),Color::Purple,Color::LightBlue,
		Color::Yellow,Color::Red,Color::LightGreen,Color::Black,Color::White};


Block::~Block(void)
{
	if(this->square1 != NULL)
		delete square1;
	if(this->square2 != NULL)
		delete square2;
	if(this->square3 != NULL)
		delete square3;
	if(this->square4 != NULL)
		delete square4;
}
Block::Block(Point location, BlockTypes newBlockType,GameField &engine)
{
	//
	//
	this->_engine = & engine;
	this->squareSize = engine.SquareSize;
	this->StatusRotation = RotationDirecttions::NORTH;
	int createType = Random(1,7);
	if(newBlockType == BlockTypes::Undefined)
	{
		BlockType = (BlockTypes)createType;
	}
	else
	{
		BlockType = newBlockType;
	}
	
	this->square1 = new Square(Size(this->squareSize,this->squareSize),backColors[(int)BlockType],foreColor[(int)BlockType]);
	this->square2 = new Square(Size(this->squareSize,this->squareSize),backColors[(int)BlockType],foreColor[(int)BlockType]);
	this->square3 = new Square(Size(this->squareSize,this->squareSize),backColors[(int)BlockType],foreColor[(int)BlockType]);
	this->square4 = new Square(Size(this->squareSize,this->squareSize),backColors[(int)BlockType],foreColor[(int)BlockType]);

	switch(BlockType)
	{
	case BlockTypes::Square_:
		this->square1->_Location = location;
		this->square2->_Location.X = location.X + squareSize;
		this->square2->_Location.Y = location.Y;
		this->square3->_Location.X = location.X;
		this->square3->_Location.Y = location.Y + squareSize;
		this->square4->_Location.X = location.X + squareSize;
		this->square4->_Location.Y = location.Y + squareSize;
		break;
	case BlockTypes::Line:
		this->square1->_Location = location;
		this->square2->_Location.X = location.X;
		this->square2->_Location.Y = location.Y + squareSize;
		this->square3->_Location.X = location.X;
		this->square3->_Location.Y = location.Y +2*squareSize;
		this->square4->_Location.X = location.X;
		this->square4->_Location.Y = location.Y + 3*squareSize;
		break;
	case BlockTypes::J:
		this->square1->_Location = location;
		this->square2->_Location.X = location.X - squareSize;
		this->square2->_Location.Y = location.Y;
		this->square3->_Location.X = location.X;
		this->square3->_Location.Y = location.Y + squareSize;
		this->square4->_Location.X = location.X ;
		this->square4->_Location.Y = location.Y + 2*squareSize;
		break;
	case BlockTypes::L:
		this->square1->_Location = location;
		this->square2->_Location.X = location.X + squareSize;
		this->square2->_Location.Y = location.Y;
		this->square3->_Location.X = location.X ;
		this->square3->_Location.Y = location.Y + squareSize;
		this->square4->_Location.X = location.X;
		this->square4->_Location.Y = location.Y + 2*squareSize;
		break;
	case BlockTypes::S:
		this->square1->_Location = location;
		this->square2->_Location.X = location.X -squareSize;
		this->square2->_Location.Y = location.Y;
		this->square3->_Location.X = location.X;
		this->square3->_Location.Y = location.Y + squareSize;
		this->square4->_Location.X = location.X + squareSize;
		this->square4->_Location.Y = location.Y +squareSize;
		break;
	case BlockTypes::T:
		this->square1->_Location = location;
		this->square2->_Location.X = location.X -squareSize;
		this->square2->_Location.Y = location.Y;
		this->square3->_Location.X = location.X;
		this->square3->_Location.Y = location.Y - squareSize;
		this->square4->_Location.X = location.X + squareSize;
		this->square4->_Location.Y = location.Y;
		break;
	case BlockTypes::Z:
		this->square1->_Location = location;
		this->square2->_Location.X = location.X -squareSize;
		this->square2->_Location.Y = location.Y;
		this->square3->_Location.X = location.X;
		this->square3->_Location.Y = location.Y - squareSize;
		this->square4->_Location.X = location.X + squareSize;
		this->square4->_Location.Y = location.Y -squareSize;
		break;
	default:
		break;
	}
}

bool Block::Down()
{
	if(GameField::IsEmpty(square1->_Location.X / squareSize,square1->_Location.Y /squareSize + 1)
		&&GameField::IsEmpty(square2->_Location.X / squareSize,square2->_Location.Y /squareSize +1)
		&&GameField::IsEmpty(square3->_Location.X / squareSize,square3->_Location.Y /squareSize +1)
		&&GameField::IsEmpty(square4->_Location.X / squareSize,square4->_Location.Y /squareSize +1) )
	{
		Hide();
		square1->_Location.Y += squareSize;
		square2->_Location.Y += squareSize;
		square3->_Location.Y += squareSize;
		square4->_Location.Y += squareSize;
		Show();
		return true;
	}
	else
	{
		GameField::StopSquare(*square1,square1->_Location.X / squareSize,square1->_Location.Y / squareSize);
		GameField::StopSquare(*square2,square2->_Location.X / squareSize,square2->_Location.Y / squareSize);
		GameField::StopSquare(*square3,square3->_Location.X / squareSize,square3->_Location.Y / squareSize);
		GameField::StopSquare(*square4,square4->_Location.X / squareSize,square4->_Location.Y / squareSize);
		return false;
	}
}

bool Block::Right()
{
	if(GameField::IsEmpty((int)square1->_Location.X / squareSize + 1,(int)square1->_Location.Y  / squareSize)
		&&GameField::IsEmpty((int)square2->_Location.X / squareSize + 1,(int)square2->_Location.Y  / squareSize)
		&&GameField::IsEmpty((int)square3->_Location.X / squareSize + 1,(int)square3->_Location.Y  / squareSize)
		&&GameField::IsEmpty((int)square4->_Location.X / squareSize + 1,(int)square4->_Location.Y  / squareSize) )
	{
		Hide();
		square1->_Location.X += squareSize;
		square2->_Location.X += squareSize;
		square3->_Location.X += squareSize;
		square4->_Location.X += squareSize;
		Show();
		return true;
	}
	else
	{
		return false;
	}
}

bool Block::Left()
{
	if(GameField::IsEmpty((int)square1->_Location.X / squareSize - 1,(int)square1->_Location.Y  / squareSize)
		&&GameField::IsEmpty((int)square2->_Location.X / squareSize - 1,(int)square2->_Location.Y  / squareSize)
		&&GameField::IsEmpty((int)square3->_Location.X / squareSize - 1,(int)square3->_Location.Y  / squareSize)
		&&GameField::IsEmpty((int)square4->_Location.X / squareSize - 1,(int)square4->_Location.Y  / squareSize) )
	{
		Hide();
		square1->_Location.X -= squareSize;
		square2->_Location.X -= squareSize;
		square3->_Location.X -= squareSize;
		square4->_Location.X -= squareSize;
		Show();
		return true;
	}
	else
	{
		return false;
	}
}

void Block::Rotate()
{
	Point OldPosition1 = square1->_Location;
	Point OldPosition2 = square2->_Location;
	Point OldPosition3 = square3->_Location;
	Point OldPosition4 = square4->_Location;
	RotationDirecttions OldStatusRotation = this->StatusRotation;
	Hide();
	switch(this->BlockType)
	{
	case BlockTypes::Square_:
		Show();
		return;
	case BlockTypes::L:
		switch(this->StatusRotation)
		{
		case RotationDirecttions::NORTH:
			this->StatusRotation = RotationDirecttions::EAST;
			square2->_Location.X = square1->_Location.X;
			square2->_Location.Y = square1->_Location.Y - squareSize;
			square3->_Location.X = square1->_Location.X + squareSize;
			square3->_Location.Y = square1->_Location.Y ;
			square4->_Location.X = square1->_Location.X + squareSize*2;
			square4->_Location.Y = square1->_Location.Y ;
			break;
		case RotationDirecttions::EAST:
			this->StatusRotation = RotationDirecttions::SOUTH;
			square2->_Location.X = square1->_Location.X - squareSize;
			square2->_Location.Y = square1->_Location.Y ;
			square3->_Location.X = square1->_Location.X ;
			square3->_Location.Y = square1->_Location.Y - squareSize;
			square4->_Location.X = square1->_Location.X ;
			square4->_Location.Y = square1->_Location.Y - squareSize*2;
			break;
		case RotationDirecttions::SOUTH:
			this->StatusRotation = RotationDirecttions::WEST;
			square2->_Location.X = square1->_Location.X;
			square2->_Location.Y = square1->_Location.Y + squareSize;
			square3->_Location.X = square1->_Location.X - squareSize;
			square3->_Location.Y = square1->_Location.Y ;
			square4->_Location.X = square1->_Location.X - squareSize*2;
			square4->_Location.Y = square1->_Location.Y ;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久蜜桃av一区二区天堂| 成人午夜免费av| 亚洲亚洲精品在线观看| 亚洲一区视频在线| 亚洲激情网站免费观看| 伊人性伊人情综合网| 亚洲一区在线电影| 日本欧洲一区二区| 精品无人码麻豆乱码1区2区| 老色鬼精品视频在线观看播放| 日韩激情一区二区| 捆绑调教一区二区三区| 国产一区二区女| 不卡电影一区二区三区| 91国偷自产一区二区三区成为亚洲经典| 一本久道中文字幕精品亚洲嫩| 91免费看视频| 欧美日韩午夜精品| 精品乱人伦小说| 国产丝袜在线精品| 有坂深雪av一区二区精品| 亚洲国产欧美在线人成| 美女视频一区在线观看| 成人三级伦理片| 91成人国产精品| 精品国产乱码久久久久久蜜臀| 久久蜜桃av一区精品变态类天堂 | 色偷偷一区二区三区| 欧美性猛交xxxxxxxx| 日韩精品中文字幕一区| 国产喷白浆一区二区三区| 亚洲天天做日日做天天谢日日欢| 亚洲图片欧美视频| 久久99精品久久久久| 99久久精品免费看国产| 久久影院午夜片一区| 亚洲柠檬福利资源导航| 日韩激情一区二区| av成人免费在线观看| 欧美一区二区三区免费大片| 中文在线一区二区| 日本欧美一区二区| 99精品国产91久久久久久| 欧美一级艳片视频免费观看| 亚洲欧洲日韩在线| 国产精品一区2区| 欧美电影在线免费观看| 亚洲免费毛片网站| 国产成人av影院| 欧美电视剧免费全集观看| 亚洲精品欧美在线| 成人动漫视频在线| 久久久精品人体av艺术| 日韩国产一区二| 在线视频国内自拍亚洲视频| 国产精品网站在线观看| 久久99国产精品免费| 欧美群妇大交群中文字幕| 自拍偷拍国产亚洲| av一区二区三区在线| 久久精品亚洲国产奇米99| 蜜臀av在线播放一区二区三区| 色悠久久久久综合欧美99| 亚洲欧洲国产日韩| 成人av在线播放网址| 国产精品无码永久免费888| 国产一区在线视频| 久久这里只有精品6| 久久成人久久爱| 日韩精品一区二区三区在线| 热久久国产精品| 7777精品伊人久久久大香线蕉| 一区二区在线观看视频在线观看| 91丨九色丨尤物| 亚洲欧美综合在线精品| 99re成人精品视频| 亚洲图片激情小说| 色噜噜久久综合| 亚洲高清免费一级二级三级| 欧美日免费三级在线| 首页国产丝袜综合| 日韩欧美国产高清| 国产精品一区一区三区| 国产成人精品亚洲午夜麻豆| 日本精品视频一区二区| 自拍av一区二区三区| 91尤物视频在线观看| 亚洲自拍都市欧美小说| 欧美日本乱大交xxxxx| 日韩成人伦理电影在线观看| 欧美一级二级三级乱码| 麻豆一区二区在线| 久久蜜桃一区二区| 色综合久久久久| 亚洲电影欧美电影有声小说| 日韩欧美一区在线观看| 国产福利一区二区三区| 亚洲欧美精品午睡沙发| 最新国产の精品合集bt伙计| 日本乱码高清不卡字幕| 免费欧美日韩国产三级电影| 久久午夜国产精品| 色综合久久中文综合久久97| 天堂在线亚洲视频| 国产视频一区二区三区在线观看| 99久久综合精品| 偷窥国产亚洲免费视频| 国产亚洲欧洲997久久综合| 91美女在线观看| 麻豆国产91在线播放| 综合激情成人伊人| 精品国产乱码久久| 色综合久久中文字幕| 九一九一国产精品| 一区二区三区四区国产精品| 精品福利视频一区二区三区| 日本精品视频一区二区三区| 国产一区在线看| 天堂蜜桃一区二区三区| 国产精品国产自产拍高清av| 欧美一区二区三区啪啪| 91视频观看免费| 久久99精品久久久| 亚洲福利一二三区| 亚洲国产经典视频| 日韩精品一区二区三区视频播放 | 久久精品水蜜桃av综合天堂| 91久久线看在观草草青青| 国产一区二区主播在线| 伊人色综合久久天天| 日本一区二区三区久久久久久久久不| 欧美日韩二区三区| 91老司机福利 在线| 国产精品一二二区| 久久精品国产精品亚洲综合| 亚洲18女电影在线观看| 亚洲免费观看在线观看| 中文欧美字幕免费| 久久久亚洲精品石原莉奈| 日韩精品中文字幕一区| 91精品久久久久久久91蜜桃| 欧美伊人久久久久久久久影院| 99久久精品免费| 成人免费观看av| 国产成人av影院| 高清av一区二区| 懂色av一区二区三区免费看| 国产精品一区二区三区乱码 | 成人免费毛片aaaaa**| 国内精品久久久久影院一蜜桃| 免费看黄色91| 精品一区二区在线看| 久久97超碰国产精品超碰| 久久国产福利国产秒拍| 精品亚洲国内自在自线福利| 日本一区中文字幕| 麻豆91在线播放免费| 国内精品第一页| 高清不卡一区二区| 波多野结衣中文一区| 97se狠狠狠综合亚洲狠狠| 色综合色综合色综合色综合色综合| 色综合久久中文字幕| 欧美日韩精品电影| 日韩视频免费观看高清完整版| 欧美成人高清电影在线| 久久久久久99精品| 毛片不卡一区二区| 激情六月婷婷综合| 国产91对白在线观看九色| 99这里只有精品| 欧美日韩日日骚| 欧美videofree性高清杂交| 久久久五月婷婷| 成人欧美一区二区三区1314| 一区二区三区精品| 久久成人综合网| 99国内精品久久| 欧美日韩一区国产| 精品99999| 亚洲精品亚洲人成人网在线播放| 亚洲香蕉伊在人在线观| 精一区二区三区| 一本色道久久加勒比精品| 欧美一级日韩免费不卡| 中日韩免费视频中文字幕| 天天色图综合网| 国产成人精品亚洲午夜麻豆| 欧美色手机在线观看| 国产亚洲欧美一级| 午夜视黄欧洲亚洲| 成人h动漫精品一区二区| 欧美高清性hdvideosex| 亚洲欧洲精品一区二区精品久久久| 偷窥国产亚洲免费视频| 99视频国产精品| 亚洲精品一区二区三区福利| 夜夜精品视频一区二区 | 亚洲国产视频在线| 国产乱码精品一区二区三区五月婷|