⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ban.cpp

📁 小球打砖块
💻 CPP
字号:
// Ban.cpp: implementation of the Ban class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "mqgGAME.h"
#include "Ban.h"
#include "Ball.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Ban::Ban()
{
	pBall=NULL;
	pYouBian=NULL;
	pZuoBian=NULL;
}

void Ban::IniBan()
{
	cr.left=226;
	cr.top=330;
	cr.right=324;
	cr.bottom=350;
}

Ban::~Ban()
{

}

void Ban::Move(int n)
{
	n=n*10;
	if(cr.left<=10 && n<0 || cr.right>=550 && n>0)
		return;
	cr.left=cr.left+n;
	cr.right=cr.right+n;
	if(pBall->zt==0)
		pBall->PingYi(n);
}

void Ban::IsZhuang()
{
	RECT tt,cr2;
	cr2.left=cr.left;
	cr2.top=cr.top;
	cr2.right=cr.right;
	cr2.bottom=cr.bottom-18;
	if(IntersectRect(&tt,&cr2,&pBall->cr))
		pBall->ZhuanXiang(2);
}

void Ban::Draw(CDC *pDC)
{
/*	CPen Pen(PS_NULL,0,RGB(255,255,255));
	pDC->SelectObject(&Pen);
*/
	CBrush Brush( RGB(255,0,255 ) );
	pDC->SelectObject(&Brush);
	pDC->Rectangle(&cr);

	CBrush Brush2( RGB(0,255,255 ) );
	pDC->SelectObject(&Brush2);
	pDC->Rectangle(cr.left+10,cr.top+5,cr.right-10,cr.bottom-5);
/*
	DeleteObject(Pen);
	DeleteObject(Brush);
	DeleteObject(Brush2);*/
}

⌨️ 快捷键说明

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