ball.h

来自「一个跳跳球的游戏」· C头文件 代码 · 共 36 行

H
36
字号

#if !defined(AFX_BALL_H__D380AC40_F5F9_4E61_BD04_F2EE8EE65875__INCLUDED_)
#define AFX_BALL_H__D380AC40_F5F9_4E61_BD04_F2EE8EE65875__INCLUDED_

#include "Sprite.h"
using namespace gamespace;

class CBall : public CSprite
{
private:
	CBall();
	void ConstructL(CFbsBitmap* aBmp,CFbsBitmap* aBmpMask,TInt aCellWidth=0,TInt aCellHeight=0);

public:
	~CBall();
	static CBall* NewL(CFbsBitmap* aBmp,CFbsBitmap* aBmpMask,TInt aCellWidth=0,TInt aCellHeight=0);
	static CBall* NewLC(CFbsBitmap* aBmp,CFbsBitmap* aBmpMask,TInt aCellWidth=0,TInt aCellHeight=0);

private:
	TInt iSpeedX;
	TInt iSpeedY;
	TRect iRect;//活动范围

private:
	void Init();

public:
	void SetActiveRect(const TRect& aRect);
	void SetSpeed(TInt aX,TInt aY);
	void CollideWithActiveRect();
	void CollideWithBall(CBall& aBall);
	void GetSpeed(TInt& aX,TInt& aY);
};

#endif

⌨️ 快捷键说明

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