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

📄 directxfont.h

📁 这个是我第一次完成的一个简单的3D ALIEN SHOOTING GAME的RESOURCE MANAGER部分,大家可以看看,然后提点意见~THX
💻 H
字号:
// DirectXFont.h
//

// Author:			Lea Hayes
// Date Created:	13/03/2006
// Date Modified:	13/03/2006

// Description:
//		Opens and manipulates font.
//

#pragma once

#include "IResource.h"


class DirectXFont : public Resources::IResource
{
// Enumerations.
public:
	enum DrawFormat
	{
		TopAlign			= DT_TOP,
		LeftAlign			= DT_LEFT,
		CentreAlign			= DT_CENTER,
		RightAlign			= DT_RIGHT,
		VCentreAlign		= DT_VCENTER,
		BottomAlign			= DT_BOTTOM,
		WorkBreak			= DT_WORDBREAK,
		SingleLine			= DT_SINGLELINE,
		ExpandTabs			= DT_EXPANDTABS,
		NoClipping			= DT_NOCLIP,
		CalculateRect		= DT_CALCRECT,
		RightToLeft			= DT_RTLREADING
	};

// Construction and destruction.
public:
	DirectXFont();
	DirectXFont(LPCSTR lpszFontName, INT nHeight, UINT nWidth,
		bool bBold, bool bItalic, UINT nMipLevels, LPCSTR lpszTypeFace);
	virtual ~DirectXFont();

	HRESULT SetFont(LPCSTR lpszFontName, INT nHeight, UINT nWidth,
		bool bBold, bool bItalic, UINT nMipLevels, LPCSTR lpszTypeFace);

// Pure virtual functions which must be overriden.
	virtual void OnProcess(float nTime) {}
	virtual void OnRender(float nTime) {}

	void DrawText(LPD3DXSPRITE pSurface, LPCSTR lpszText, int nLength,
		RECT &rtRectOut, DWORD dwFormat, D3DCOLOR rgbColour);

	virtual DWORD GetUniqueID() const;

// Virtual functions which can be overriden.
	virtual void OnDestroy();

// Properties.
public:
	inline LPD3DXFONT GetFont()
	{
		return m_pFont;
	}

protected:
	void CleanUp();

// Attributes.
private:
	LPD3DXFONT m_pFont;					// Font itself.
};

⌨️ 快捷键说明

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