[examples] Fix examples to work in MSVC (#5267)

* Fix warnings in many examples
Add examples to MSVC solution correctly

* fix CI error

---------

Co-authored-by: Ray <raysan5@gmail.com>
This commit is contained in:
Jeffery Myers
2025-10-15 10:02:52 -07:00
committed by GitHub
parent e3a562ab57
commit 7191749d66
34 changed files with 1550 additions and 405 deletions

View File

@ -86,7 +86,7 @@ int main(void)
DrawTextStyled(GetFontDefault(), text, (Vector2){ 100, 220 }, 40.0f, 2.0f, BLACK);
textSize = MeasureTextStyled(GetFontDefault(), text, 40.0f, 2.0f);
DrawRectangleLines(100, 220, textSize.x, textSize.y, GREEN);
DrawRectangleLines(100, 220, (int)textSize.x, (int)textSize.y, GREEN);
EndDrawing();
//----------------------------------------------------------------------------------
@ -154,7 +154,7 @@ static void DrawTextStyled(Font font, const char *text, Vector2 position, float
// Parse following color
char colHexText[9] = { 0 };
char *textPtr = &text[i]; // Color should start here, let's see...
const char *textPtr = &text[i]; // Color should start here, let's see...
int colHexCount = 0;
while ((textPtr != NULL) && (textPtr[colHexCount] != '\0') && (textPtr[colHexCount] != ']'))
@ -186,7 +186,7 @@ static void DrawTextStyled(Font font, const char *text, Vector2 position, float
else increaseX += ((float)font.glyphs[index].advanceX*scaleFactor + spacing);
// Draw background rectangle color (if required)
if (colBack.a > 0) DrawRectangle(position.x + textOffsetX, position.y + textOffsetY - backRecPadding, increaseX, fontSize + 2*backRecPadding, colBack);
if (colBack.a > 0) DrawRectangleRec((Rectangle) { position.x + textOffsetX, position.y + textOffsetY - backRecPadding, increaseX, fontSize + 2 * backRecPadding }, colBack);
if ((codepoint != ' ') && (codepoint != '\t'))
{
@ -236,7 +236,7 @@ static Vector2 MeasureTextStyled(Font font, const char *text, float fontSize, fl
{
i += 2; // Skip "[c" or "[b" to start parsing color
char *textPtr = &text[i]; // Color should start here, let's see...
const char *textPtr = &text[i]; // Color should start here, let's see...
int colHexCount = 0;
while ((textPtr != NULL) && (textPtr[colHexCount] != '\0') && (textPtr[colHexCount] != ']'))

View File

@ -144,9 +144,9 @@ int main(void)
// Draw font texture scaled to screen
float atlasScale = 380.0f/font.texture.width;
DrawRectangle(400, 16, font.texture.width*atlasScale, font.texture.height*atlasScale, BLACK);
DrawTexturePro(font.texture, (Rectangle){ 0, 0, font.texture.width, font.texture.height },
(Rectangle){ 400, 16, font.texture.width*atlasScale, font.texture.height*atlasScale }, (Vector2){ 0, 0 }, 0.0f, WHITE);
DrawRectangleRec((Rectangle) { 400.0f, 16.0f, font.texture.width* atlasScale, font.texture.height* atlasScale }, BLACK);
DrawTexturePro(font.texture, (Rectangle){ 0, 0, (float)font.texture.width, (float)font.texture.height },
(Rectangle){ 400.0f, 16.0f, font.texture.width*atlasScale, font.texture.height*atlasScale }, (Vector2){ 0, 0 }, 0.0f, WHITE);
DrawRectangleLines(400, 16, 380, 380, RED);
DrawText(TextFormat("ATLAS SIZE: %ix%i px (x%02.2f)", font.texture.width, font.texture.height, atlasScale), 20, 380, 20, BLUE);