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

📄 font.h

📁 小型的3D游戏引擎
💻 H
字号:
/* This code is based on the font loading code in */
/* OpenGL Game Progamming by Hawkins and Astle    */

#ifndef _FONT_H_
#define _FONT_H_

#include "../Texture.h"

#define COLORKEY_RED	0
#define COLORKEY_GREEN	255
#define COLORKEY_BLUE	0

class GcFont
{
public:

	// Constructor / Destructor
	GcFont();
	~GcFont();

	// Build font
	bool Build(char *fontFile, int cols, int rows, int width, int height, int spacing);

	// Print the text
	void Print(char *string, int x, int y);

	// Delete the font
	void Delete();

	// Set the scale
	void SetScale(float sScale) { scale = sScale; }

private:

	bool LoadTexture(char *fontFile);

	int		colums;			// The numbers of colums in the bitmap
	int		rows;			// The numbers of rows in the bitmap
	int		width;			// The width of each letter
	int		height;			// The hieght of each letter
	int		spacing;		// The spacing betwen the letters
	uint	base;			// The begining point of the list
	float	scale;			// The scale of the bitmap
	uint	fontID;			// The ID for the font texture
	uint	texWidth;
	uint	texHeight;
};

#endif

⌨️ 快捷键说明

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