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

📄 layer.h

📁 一个symbian上成熟的小游戏源码
💻 H
字号:
#ifndef H_LAYER_H
#define H_LAYER_H

#include <e32std.h>
#include <e32base.h>
#include <W32STD.H>//For CWindowGc
#include "GraphicsTool.h"

namespace gamespace
{

/************************************************************************/
/* 保存传入的源图片,画指定的帧索引的Cell */
/************************************************************************/
class CLayer : public CBase
{
protected:
	TInt iCellWidth;//单元格宽高
	TInt iCellHeight;

	TInt iRows;//大图片的行数,列数
	TInt iCols;

	TInt iBmWidth;//大图片的宽高
	TInt iBmHeight;

	CFbsBitmap* iBmp;
	CFbsBitmap* iBmpMask;

public:
	TInt iX,iY;//当前cell的左顶点在场景中对应的坐标,可能场景的左顶点坐标并不是(0,0),即不是场景系

private:
	void Init();
	
public:
	CLayer();
	~CLayer();
	void SetSource(CFbsBitmap* aBmp,CFbsBitmap* aBmpMask,TInt aCellWidth=0,TInt aCellHeight=0);//0为全图
	
	//设置cell在场景中的左上坐标,不是场景系
	void SetPosition(TInt aX,TInt aY);
	void SetPosition(const TPoint& aPoint);

	TInt CellWidth();
	TInt CellHeight();

	//得到场景中当前单元格的矩形区域值
	TRect CellRect();
	
	virtual void Draw(TInt frameIndex,CBitmapContext& aGc) const;//画图片上的位置为frameIndex的cell,frameIndex从1开始
};

}

#endif

⌨️ 快捷键说明

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