Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions examples/core/core_text_file_loading.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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();

Expand Down
3 changes: 3 additions & 0 deletions examples/shapes/shapes_clock_of_clocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* Copyright (c) 2025 JP Mortiboys (@themushroompirates)
*
********************************************************************************************/
#if defined(WIN32)
#define _CRT_SECURE_NO_WARNINGS
Comment thread
raysan5 marked this conversation as resolved.
#endif

#include "raylib.h"

Expand Down
Loading