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

📄 font.h

📁 有个小游戏
💻 H
字号:
#ifndef __FONT_H
#define __FONT_H

/*
	FONT.H

	The CFont class

	Author: Kevin Hawkins
	Date: 3/29/2001
	Description: The CFont class. Currently only supports Bitmap fonts.

*/

#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>

class CFont
{
private:
	unsigned int texID;		// font texture id
	unsigned int callList;	// font display list
	float r, g, b, a;		// RGBA
	int screenX, screenY;	// screen coordinates
	float xpos, ypos, zpos;	// 3d coordinates

	void LoadTexture();		// loads the TGA font texture
	void CreateCallLists();	// creates the font display list

public:
	CFont();
	CFont(char *name, int size);
	~CFont();

	void Build(char *name, int size);
	void ClearFont();

	void Print(const char *str, ...);

	void SetPos2D(int x, int y) { screenX = x; screenY = y; }
	void SetPos3D(float x, float y, float z) { xpos = x; ypos = y; zpos = z; }

	void SetRGB(float red, float green, float blue) { r = red; g = green; b = blue; a = 1.0; }
	void SetRGBA(float red, float green, float blue, float alpha) { r = red; g = green; b = blue; a = alpha; }
};

#endif

⌨️ 快捷键说明

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