-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
put your ttf file into "3rdparty\extras\xash-extras\gfx\fonts\" change cl_font.c FONT_COUNT g_FontsPath g_FontsSize
- Loading branch information
Showing
5 changed files
with
5,388 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* cl_font.h | ||
* | ||
* This file is part of the Xash3D FWGS project. | ||
* | ||
* Xash3D FWGS is a fork of the Xash3D Engine by Unkle Mike. | ||
* | ||
* This header file contains the declarations for font handling in the client. | ||
* | ||
* Author: [Your Name] | ||
* Date: [Current Date] | ||
*/ | ||
|
||
#ifndef CL_FONT_H | ||
#define CL_FONT_H | ||
|
||
#include "stb_truetype.h" | ||
|
||
#define FONTS_MAX_BUFFER 1000 | ||
#define FONT_PAGE_MAX 8 | ||
|
||
typedef struct { | ||
int m_iTexture; | ||
int m_iWidth,m_iHeight; | ||
int m_iXOff,m_iYOff; | ||
BYTE *pTexture; | ||
int m_iCharWidth; | ||
int Char; | ||
} CHARINFO; | ||
|
||
typedef struct { | ||
byte *m_pFontData; | ||
stbtt_fontinfo m_fontInfo; | ||
|
||
double scale; | ||
|
||
int m_iAscent, m_iMaxCharWidth; | ||
int m_iCharCount; | ||
int m_iWidth, m_iHeight; | ||
int m_iBuffer[FONTS_MAX_BUFFER]; | ||
CHARINFO m_tFontTexture[FONTS_MAX_BUFFER]; | ||
} Font; | ||
|
||
int Font_Init(Font* self, char* name); | ||
int Font_CheckCharExists(Font* self, int ch); | ||
int Font_LoadChar(Font* self, int ch); | ||
CHARINFO* Font_GetChar(Font* self, int ch); | ||
int Font_DrawChar(cl_font_t *font, rgba_t color, int x, int y, int number, int flags); | ||
void Font_SetWidth(Font* self, int iWidth); | ||
#endif // CL_FONT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.