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

📄 surface.h

📁 这个例子告诉你2d Arpg游戏中的动态阴影如何生成
💻 H
字号:
#ifndef SURFACE_H
#define SURFACE_H
#include <ddraw.h>

/////////////////////////////////////////////////////////////////
//DDraw离屏页面类
/////////////////////////////////////////////////////////////////
class Surface  
{
public:
	void CreateNight();
	void FreeSurface();
	void Init();
	Surface();
	Surface( Surface &surf );
	Surface &operator = ( Surface &surf );
	virtual ~Surface();


	bool CreateImageSurface( char *szFileName, bool isSysMemory, bool isColorKey, DWORD ColorKey );
	bool CreateNullSurface( int iw, int ih, bool isSysMemory, bool isColorKey, DWORD ColorKey );
	bool CreateBmpSurface( char *szFileName, bool isSysMemory, bool isColorKey, DWORD ColorKey );
	bool OnCreateSurface( bool isSysMemory, bool isColorKey );
	bool GetWH( int *pWidth, int *pHeight );
	bool CreateCopySurface();
	void Surface::DrawAlphaShadow( int x, int y );

	void DrawSurface( int x, int y, RECT *pRect );
	void DrawNight( int x, int y, RECT *pRect );
	void DrawAutoClip( int x, int y );
	void DrawAlphaMMX( int x, int y );
	void BltTo( int destX, int destY, Surface *pDestSurf, RECT *rcSrc );
	void WriteText( const char *szText, int TextLen, int x, int y, DWORD Color );

	void  SetSurfaceColorKey( DWORD ColorKey );
	int  GetWidth(){return m_iWidth;}
	int  GetHeight(){return m_iHeight;}
	bool IsEmpty() { return m_lpDDSurface == NULL; }
	bool  IsColorKey() {return m_ColorKeyType == DDBLTFAST_SRCCOLORKEY;}
	bool Restore();
	bool CopySurface( Surface * psurf );
	bool CopySurfaceToBmp( char *szBmpName, RECT *pRect );
	LPDIRECTDRAWSURFACE7 m_lpDDSurface;
	LPDIRECTDRAWSURFACE7 m_lpDDSurfaceCopy;
private:
	DWORD m_ColorKeyType;		//透明色种类
	int	  m_iWidth, m_iHeight;
	static HDC		g_hdc;
	static HFONT	g_hFont;
	static RECT		g_TextRect;
};

#endif // !defined(AFX_SURFACE_H__1119098C_1750_4105_8F44_5DDF2DCCDC6C__INCLUDED_)

⌨️ 快捷键说明

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