📄 ball.cpp
字号:
// Ball.cpp: implementation of the Ball class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "mqgGAME.h"
#include "Ball.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Ball::Ball()
{
}
void Ball::IniBall()
{
zt=0; //状态0:起始静止;1:飞;-1:死;
dx=1;
dy=-1;
cr.left=265;
cr.top=308;
cr.right=285;
cr.bottom=328;
}
Ball::~Ball()
{
}
void Ball::Draw(CDC *pDC)
{
/**/ CBrush Brush( RGB( ( rand() & 0xff ),( rand() & 0xff ), ( rand() & 0xff ) ) );
//CPen Pen(PS_NULL,0,RGB(255,255,255));
pDC->SelectObject(&Brush);
//pDC->SelectObject(&Pen);
pDC->Ellipse(&cr);
/* DeleteObject(Pen);
DeleteObject(Brush);*/
}
void Ball::Fei()
{
cr.left=cr.left+dx*3;
cr.top=cr.top+dy*3;
cr.right=cr.right+dx*3;
cr.bottom=cr.bottom+dy*3;
}
void Ball::PingYi(int x)
{
cr.left=cr.left+x;
cr.right=cr.right+x;
}
void Ball::ZhuanXiang(int zx)
{
switch(zx)
{
case 0:
break;
case 1:
dx=-dx;
break;
case 2:
dy=-dy;
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -