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

📄 ctextwriter.h

📁 Visual C++ 游戏开发与设计实例 源代码(所有)
💻 H
字号:
#include ".\applib\cSurface.h"

#if !defined(AFX_CTEXTWRITER_H__88B976A5_5576_41EA_8DD2_DC29FA76C0C1__INCLUDED_)
#define AFX_CTEXTWRITER_H__88B976A5_5576_41EA_8DD2_DC29FA76C0C1__INCLUDED_

#include "resource.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// This structure is used to define the alphabet for the cTextWrite Class

struct Alphabet
{
	unsigned int start;
	unsigned int end;
};

//大号位图中字符分割位置
const Alphabet			DA[40] = 
	{
	{0,14},{19,27},{31,46},{47,61},{65,78},{80,94},
	{96,110},{114,125},{128,143},{145,159},{160,175},
	{176,191},{193,206},{207,222},{224,237},{238,252},{253,267},
	{269,284},{285,291},{292,307},{308,323},{324,338},{340,364},
	{365,380},{382,397},{398,413},{414,429},{430,444},{447,460},
	{464,475},{477,492},{494,508},{509,533},{533,548},{550,564},
	{564,579},{579,599},{600,610},{611,615},{617,620}
	};

//小号位图中字符分割位置
const Alphabet			SDA[40] = 
	{
	{0,8},{8,14},{16,23},{24,31},{32,40},{40,47},
	{48,55},{57,63},{64,72},{72,80},{80,88},
	{88,96},{96,103},{104,111},{112,119},{119,126},{126,133},
	{134,142},{142,146},{146,154},{154,162},{162,169},{170,183},
	{183,191},{191,198},{198,206},{207,215},{215,223},{223,230},
	{232,238},{238,246},{247,254},{254,266},{267,274},{275,282},
	{282,289},{290,300},{300,305},{305,308},{308,310}
	};

//黄色前景位图中字符分割位置
const Alphabet			VA[40] = 
	{
	{0,12},{13,24},{25,37},{36,48},{48,61},{62,74},
	{73,86},{86,98},{97,110},{109,122},{121,136},
	{136,149},{148,161},{161,175},{175,186},{187,198},{198,211},
	{212,226},{225,235},{235,246},{245,258},{258,270},{269,284},
	{286,300},{299,315},{315,327},{327,341},{342,355},{355,367},
	{366,379},{379,393},{393,406},{406,425},{425,438},{438,451},
	{450,462},{463,479},{479,486},{487,494},{495,499}
	};

// cTextWriter Class
//
// This class is used to write text on the screen, it just receive a surface
// as a parameter an blit each letter on the screen, using the Alphabet structure
// of the specified font

class cTextWriter  
{
private:
	Alphabet* AA;
public:
	int m_iAlphabet;
	void Destroy();
	void Create(int iAlphabet = 1);
	int WriteText(LPDIRECTDRAWSURFACE7 pSurface, char* lpszText, int iX, int iY, bool bFixed = false);
	cSurface m_surfLetters;
	cTextWriter();
	virtual ~cTextWriter();
};

#endif // !defined(AFX_CTEXTWRITER_H__88B976A5_5576_41EA_8DD2_DC29FA76C0C1__INCLUDED_)

⌨️ 快捷键说明

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