ban.cpp

来自「小球打砖块」· C++ 代码 · 共 79 行

CPP
79
字号
// 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 + =
减小字号Ctrl + -
显示快捷键?