?? 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 + -