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

📄 hgefont.h

📁 2D游戏引擎hge的代码
💻 H
字号:
/*
** Haaf's Game Engine 1.4
** Copyright (C) 2003-2004, Relish Games
** hge.relishgames.com
**
** hgeFont helper class header
*/


#ifndef HGEFONT_H
#define HGEFONT_H


#include "hgehelpers.h"
#include "hgesprite.h"


#define HGETEXT_LEFT	0
#define HGETEXT_RIGHT	1
#define HGETEXT_CENTER	2

/*
** HGE Font class
*/
class hgeFont
{
public:
	hgeFont(char *filename);
	~hgeFont();

	void		Render(float x, float y, char *string, int align=HGETEXT_LEFT);
	void		printf(float x, float y, char *format, ...);

	void		SetColor(DWORD col);
	void		SetZ(float z);
	void		SetBlendMode(int blend);
	void		SetScale(float scale) {fScale=scale;}
	void		SetRotation(float rot) {fRot=rot;}
	void		SetTracking(float tracking) {fTracking=tracking;}

	DWORD		GetColor() const {return dwCol;}
	float		GetZ() const {return fZ;}
	int			GetBlendMode() const {return nBlend;}
	float		GetScale() const {return fScale;}
	float		GetRotation() const {return fRot;}
	float		GetTracking() const {return fTracking;}

	hgeSprite*	GetSprite(char chr) const { return letters[chr]; }
	float		GetHeight() const { return fHeight; }
	float		GetStringWidth(char *string);

private:
	hgeFont();
	char*		_skip_token(char *szStr);

	HTEXTURE	hTexture;
	hgeSprite*	letters[256];
	float		fHeight;
	float		fScale, fRot;
	float		fTracking;

	DWORD		dwCol;
	float		fZ;
	int			nBlend;
};


#endif

⌨️ 快捷键说明

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