rename Font into RLFont

prevent conflict with Xlib.h
This commit is contained in:
SergeyMC9730 2024-03-07 22:51:20 +08:00
commit 19cd976000

View file

@ -135,8 +135,8 @@ struct {
//--------------------------------------------------------------------------------------
static void RandomizeEmoji(void); // Fills the emoji array with random emojis
static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection
static void DrawTextBoxed(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
static void DrawTextBoxedSelectable(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection
//--------------------------------------------------------------------------------------
// Global variables
@ -166,9 +166,9 @@ int main(void)
// Load the font resources
// NOTE: fontAsian is for asian languages,
// fontEmoji is the emojis and fontDefault is used for everything else
Font fontDefault = LoadFont("resources/dejavu.fnt");
Font fontAsian = LoadFont("resources/noto_cjk.fnt");
Font fontEmoji = LoadFont("resources/symbola.fnt");
RLFont fontDefault = LoadFont("resources/dejavu.fnt");
RLFont fontAsian = LoadFont("resources/noto_cjk.fnt");
RLFont fontEmoji = LoadFont("resources/symbola.fnt");
Vector2 hoveredPos = { 0.0f, 0.0f };
Vector2 selectedPos = { 0.0f, 0.0f };
@ -234,7 +234,7 @@ int main(void)
{
const int message = emoji[selected].message;
const int horizontalPadding = 20, verticalPadding = 30;
Font *font = &fontDefault;
RLFont *font = &fontDefault;
// Set correct font for asian languages
if (TextIsEqual(messages[message].language, "Chinese") ||
@ -331,13 +331,13 @@ static void RandomizeEmoji(void)
//--------------------------------------------------------------------------------------
// Draw text using font inside rectangle limits
static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
static void DrawTextBoxed(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
{
DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, WHITE, WHITE);
}
// Draw text using font inside rectangle limits with support for text selection
static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint)
static void DrawTextBoxedSelectable(RLFont font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint)
{
int length = TextLength(text); // Total length in bytes of the text, scanned by codepoints in loop