Fix warnings in more examples. (#5292)

This commit is contained in:
Jeffery Myers
2025-10-23 04:25:23 -07:00
committed by GitHub
parent 428421f21a
commit 780a7df760
2 changed files with 11 additions and 8 deletions

View File

@@ -88,16 +88,16 @@ int main(void)
for (int i = 0; i < lineCount; i++)
{
Vector2 size = MeasureTextEx(GetFontDefault(), lines[i], fontSize, 2);
textHeight += size.y + 10;
Vector2 size = MeasureTextEx(GetFontDefault(), lines[i], (float)fontSize, 2);
textHeight += (int)size.y + 10;
}
// A simple scrollbar on the side to show how far we have red into the file
Rectangle scrollBar = {
.x = screenWidth - 5,
.x = (float)screenWidth - 5,
.y = 0,
.width = 5,
.height = screenHeight*100/(textHeight - screenHeight) // Scrollbar height is just a percentage
.height = screenHeight*100.0f/(textHeight - screenHeight) // Scrollbar height is just a percentage
};
SetTargetFPS(60);
@@ -115,10 +115,10 @@ int main(void)
// Ensuring that the camera does not scroll past all text
if (cam.target.y > textHeight - screenHeight + textTop)
cam.target.y = textHeight - screenHeight + textTop;
cam.target.y = (float)textHeight - screenHeight + textTop;
// Computing the position of the scrollBar depending on the percentage of text covered
scrollBar.y = Lerp(textTop, screenHeight - scrollBar.height, (cam.target.y - textTop)/(textHeight - screenHeight));
scrollBar.y = Lerp((float)textTop, (float)screenHeight - scrollBar.height, (float)(cam.target.y - textTop)/(textHeight - screenHeight));
//----------------------------------------------------------------------------------
// Draw
@@ -132,13 +132,13 @@ int main(void)
for (int i = 0, t = textTop; i < lineCount; i++)
{
// Each time we go through and calculate the height of the text to move the cursor appropriately
Vector2 size = MeasureTextEx(GetFontDefault(), lines[i], fontSize, 2);
Vector2 size = MeasureTextEx(GetFontDefault(), lines[i], (float)fontSize, 2);
DrawText(lines[i], 10, t, fontSize, RED);
// Inserting extra space for real newlines,
// wrapped lines are rendered closer together
t += size.y + 10;
t += (int)size.y + 10;
}
EndMode2D();

View File

@@ -14,6 +14,9 @@
* Copyright (c) 2025 JP Mortiboys (@themushroompirates)
*
********************************************************************************************/
#if defined(WIN32)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "raylib.h"