Exemplo n.º 1
0
void draw_game::draw_Field(int x, int y, const field& object) const
{
	typedef enum GameObject::field::ERASE_CHK FLAG;
	auto field_size = object.get_size();
	x += offset.x;
	y += offset.y;
	//背景描画
	//DrawBox(x - frame_tickness, y - frame_tickness, x + (frame_tickness + block_size_.x) * field_size.x, y + (frame_tickness + block_size_.y) * field_size.y, GetColor(50, 50, 150), true);
	DrawGraph(x - frame_tickness, y - frame_tickness, *res[RES::FIELD], true);
	for (int i = 0; i < field_size.y; ++i)
	{
		for (int j = 0; j < field_size.x; ++j)
		{
			switch (object.get_flag(j, i))
			{
			case FLAG::WALLCONNECT:
			{
				util::scoped_dx_blendmode d(DX_BLENDMODE_ADD, 100);
				DrawBox(
					x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness),
					x + (j + 1) * (block_size_.x + frame_tickness) - frame_tickness, y + (i + 1) * (block_size_.y + frame_tickness) - frame_tickness,
					GetColor(255, 255, 255), true
					);
			}
				draw_Block(x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness), object.get_block_const(j, i), true);
				/*DxLib::SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128);
				DrawBox(
					x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness),
					x + (j + 1) * (block_size_.x + frame_tickness) - frame_tickness, y + (i + 1) * (block_size_.y + frame_tickness) - frame_tickness,
					GetColor(255, 0, 255), true
					);*/
				break;
			case FLAG::ERASING:
				draw_Block(x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness), object.get_block_const(j, i), true);
				if (object.get_block_const(j, i).get_block_type() != GameObject::WALL)
				{
					util::scoped_dx_blendmode d(DX_BLENDMODE_ALPHA, 255 - object.get_block_const(j, i).get_eraseframe() / 2);
					DrawBox(
					x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness),
					x + (j + 1) * (block_size_.x + frame_tickness) - frame_tickness, y + (i + 1) * (block_size_.y + frame_tickness) - frame_tickness,
					GetColor(255, 255, 0), true
					);
				}
				break;
			
			default:
				draw_Block(x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness), object.get_block_const(j, i), false);
			
				break;
			}
		}
	}
	//スコアの描画
	DrawFormatStringToHandle
		(x + ((block_size_.x + frame_tickness) * field_size.x) / 2,
		y + (block_size_.y + frame_tickness) * field_size.y + 5,
		GetColor(0, 0, 0), *res[FONT], "%d", object.get_score()
		);
}
Exemplo n.º 2
0
void draw_game::draw_Flags(int x, int y, const field& object) const
{
	auto field_size = object.get_size();
	typedef enum GameObject::field::ERASE_CHK FLAG;
	x += offset.x;
	y += offset.y;
	for (int i = 0; i < field_size.y; ++i)
	{
		for (int j = 0; j < field_size.x; ++j)
		{
			int flag = object.get_flag(j, i);
			std::string str;
			int color = 0;
			int color2 = object.connectnum[i * field_size.x + j] != 0 ? GetColor(255, 0, 0) : GetColor(255, 255, 255);
			switch (flag)
			{
			case FLAG::ERASE:
				str = "Er";
				color = GetColor(255, 0, 0);
				break;
			case FLAG::ERASING:
				str = "Eg";
				color = GetColor(255, 0, 0);
				break;
			case FLAG::WALLCONNECT:
				str = "Wc";
				color = GetColor(0, 255, 255);
				break;
			case FLAG::WALL_COOL_DOWN:
				str = "Cd";
				color = GetColor(255, 0, 255);
				break;
			default:
				str = "No";
				break;
			}
			if (object.get_block_const(j, i).is_new())
			{
				str = "Nw";
			}
			DrawString(3 + x + j * (block_size + frame_tickness), y + i * (block_size + frame_tickness), str.c_str(), color);
			DrawFormatString(3 + x + j * (block_size + frame_tickness), 20 + y + i * (block_size + frame_tickness), GetColor(255, 0, 255), "%d", object.connectnum[i * field_size.x + j]);
			DrawFormatString(3 + x + j * (block_size + frame_tickness), 40 + y + i * (block_size + frame_tickness), GetColor(255, 0, 255), "%d", object.get_block_const(j, i).get_eraseframe());

			//(j * (block_size_.x + 5), i * (block_size_.y + 5), object.get_block(j, i));
		}
	}
}