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

📄 gfx.h

📁 liu7788414
💻 H
字号:
/*
* ============================================================================
*  Name     : CGlobalData from CGlobalData.h
*  Part of  : Game
*  Created  : 2003-06-16 by Qiu Wei Min
*  Modified : 2003-09-03 by Zheng Jie Sheng to adapt on LGVX6000
*  Modified : 2004-09-16 by Chen Yong to add  for the tga
*  Description:
*     Declares main application class.
*  Version  :
*  Copyright: Gameloft S.A.
* ============================================================================
*/

#ifndef GFX_H
#define GFX_H

//#include "engine.h"
#include "sysdef.h"
// INCLUDES

// CONSTANTS

// CLASS DECLARATION

//for blt
enum {
	GFX_FLIPX = 1,
	GFX_FLIPY = 2,
	GFX_ROT90 = 4,
	//Effect Operation
	GFX_SEMITRANS = 0x10,
	GFX_SCREEN = 0x20, //same as the screen mode effect in photoshop
	GFX_HIGHLIGHT = 0x30,
	GFX_HURTEFFECT = 0x40,
	GFX_MONO2COLOR = 0x80,

	GFX_EFFECT_MASK = 0xf0
};


#define GFXBMP_TRANS	1
#define GFXBMP_ALPHA	2

// Color model
#define	CM_RGB332 0
#define	CM_RGB444 1
#define	CM_RGB565 2

#if defined T720
#define HW_COLORMODEL		CM_RGB444
#else
#define HW_COLORMODEL		CM_RGB565
#endif

#ifdef BREW11
typedef struct
{
	byte			_head[12];
	char			_data[4];
} NativeImage;
#endif

typedef struct {
	unsigned char bpp;
	unsigned char flag;
	short npal;//number of entries in pallete
	short w, h;
	unsigned char *pData;
#ifdef BREW11
	NativeImage *pNativeBmp;			// data after CONVERTBMP()
#endif
}GFXBMP;







//class CEngine;
class CResFile;

//#ifndef AEE_SIMULATOR
//inline void LongCopy2(unsigned char *d,unsigned char *s,int w,int h, int d2, int s2);
//#else
//inline void LongCopy1(unsigned short *d, unsigned short *s,int w,int h, int d2, int s2);
//#endif


class CGfx
{
public:
	void DrawColorMask(short transcoeff, short addcolor, int x, int y, int w, int h);



	GFXBMP* CreateNativeBmp(void *pBuf, int w, int h, bool bGlobal = false);

	void UpdateToForeground();


	CGfx(void);

	~CGfx();

	GFXBMP* LoadBmp(const char *pName, bool bGlobal = false);

	void SetVideoBmp(GFXBMP *p)
	{
		m_pVideo = p;
	}

	GFXBMP* GetVideo()
	{
		return m_pVideo;
	}

	void SetBWLevel(char level)
	{
		m_bw_level = level;
		m_pLastBWPal = NULL;
	}

	char GetBWLevel()
	{
		return m_bw_level;
	}

/*	IDisplay* GetiDisp(){
		return idisp;
	}
*/

	int GetNativeColor(int rgb)
	{
#if (HW_COLORMODEL == CM_RGB565)
		return ((rgb >> 8) & 0xf800) | ((rgb >> 5) & 0x7e0) | ((rgb >> 3) & 0x1f);
#elif (HW_COLORMODEL == CM_RGB444)
		return ((rgb >> 12) & 0x0f00) | ((rgb >> 8) & 0xf0) | ((rgb >> 4) & 0x0f);
#endif
	}

	void Blt8_16(GFXBMP *pDes, int dx, int dy, int w, int h, GFXBMP *pSrc, int sx, int sy, int flag);
	void Blt16_16(GFXBMP *pDes, int dx, int dy, int w, int h, GFXBMP *pSrc, int sx, int sy, int flag);
	void Blt(GFXBMP *pDes, int dx, int dy, int w, int h, GFXBMP *pSrc, int sx, int sy, int flag);
	void DrawBmp(int dx, int dy, int w, int h, GFXBMP *pSrc, int sx, int sy, int flag);
	void DrawOpaque( int dx, int dy, int w, int h, GFXBMP *pSrc, int sx, int sy );
	void ComputBWPalette(unsigned short *pSrc, int nPal);
	void BltTile(GFXBMP *pDes, int dx, int dy, GFXBMP *pSrc, int sx, int sy, int flag);
	void FillRec(int dx, int dy, int w, int h, int color);
	void GFX_FillRec(GFXBMP* pDes, int dx, int dy, int w, int h, int color);
	void DrawRect(int dx, int dy, int w, int h, int color);
	void GFX_DrawRect(GFXBMP *pDes, int dx, int dy, int w, int h, int color);
	void DrawLine(int startX, int startY, int endX, int endY, short color)	;
	void GFX_DrawLine(GFXBMP *pDes, int startX, int startY, int endX, int endY, short color);
	void writePixel(GFXBMP *pDes, int dx, int dy, unsigned short color, bool bSmallCircle = false);
	void drawCircle(GFXBMP *pDes, int x, int y, int r, unsigned short color, bool bSmallCircle = false);
protected:


	char m_bw_level;//black&white effect level, max=16

//	CEngine *m_pEngine;

	GFXBMP *m_pVideo;

	unsigned short m_tmppal[256], *m_pLastBWPal;

//	IDisplay  *idisp;
	
private:
	int Clip_Line(GFXBMP *g ,int *px1,int *py1,int *px2, int *py2);
	int Draw_Line(int x0, int y0, int x1, int y1, unsigned short color, unsigned short *vb_start, int lpitch);
};

#endif

// End of File

⌨️ 快捷键说明

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