Browse Source

Updated example

pull/5375/head
Ray 4 days ago
parent
commit
18e1ec504f
2 changed files with 5 additions and 4 deletions
  1. +4
    -3
      examples/text/text_inline_styling.c
  2. +1
    -1
      src/platforms/rcore_desktop_glfw.c

+ 4
- 3
examples/text/text_inline_styling.c View File

@ -108,8 +108,9 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module Functions Definition // Module Functions Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw text using inline styling, using input color as the base alpha multiplied to inline styles
// Draw text using inline styling
// PARAM: color is the default text color, background color is BLANK by default // PARAM: color is the default text color, background color is BLANK by default
// NOTE: Using input color as the base alpha multiplied to inline styles
static void DrawTextStyled(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color color) static void DrawTextStyled(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color color)
{ {
// Text inline styling strategy used: [ ] delimiters for format // Text inline styling strategy used: [ ] delimiters for format
@ -179,12 +180,12 @@ static void DrawTextStyled(Font font, const char *text, Vector2 position, float
if (text[i - 1] == 'c') if (text[i - 1] == 'c')
{ {
colFront = GetColor(colHexValue); colFront = GetColor(colHexValue);
colFront.a *= (float)color.a / 255.0f;
colFront.a *= (float)color.a/255.0f;
} }
else if (text[i - 1] == 'b') else if (text[i - 1] == 'b')
{ {
colBack = GetColor(colHexValue); colBack = GetColor(colHexValue);
colBack.a *= (float)color.a / 255.0f;
colBack.a *= (float)color.a/255.0f;
} }
i += (colHexCount + 1); // Skip color value retrieved and ']' i += (colHexCount + 1); // Skip color value retrieved and ']'

+ 1
- 1
src/platforms/rcore_desktop_glfw.c View File

@ -130,7 +130,7 @@ int InitPlatform(void); // Initialize platform (graphics, inputs and mo
void ClosePlatform(void); // Close platform void ClosePlatform(void); // Close platform
// Error callback event // Error callback event
static void ErrorCallback(int error, const char *description); // GLFW3 Error Callback, runs on GLFW3 error
static void ErrorCallback(int error, const char *description); // GLFW3 Error Callback, runs on GLFW3 error
// Window callbacks events // Window callbacks events
static void WindowSizeCallback(GLFWwindow *window, int width, int height); // GLFW3 WindowSize Callback, runs when window is resized static void WindowSizeCallback(GLFWwindow *window, int width, int height); // GLFW3 WindowSize Callback, runs when window is resized

Loading…
Cancel
Save