5 Commits

Author SHA1 Message Date
d7a7eda959 [examples] core_directory_files fixes (#5343)
* [examples] reset on folder click

`continue` after clicking a new folder

* [examples] don't make non-directories clickable

`IsPathFile` is not enough to check if it's a directory
since it also takes in char devices.

* rlparser: update raylib_api.* by CI

* Delete tools/rlparser/rlparser

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ray <raysan5@gmail.com>
2025-11-08 11:36:42 +01:00
Ray
2a324ace27 Update parse_api.yml 2025-11-08 11:35:34 +01:00
Ray
8b3ea995f9 Update parse_api.yml 2025-11-08 11:32:58 +01:00
d8da443604 Fixed core_text_file_loading example in raylib examples, to account for blank lines in text file and text wrapping properly for the case when the last word goes out the display (#5339) 2025-11-08 11:29:45 +01:00
4ff296bf0b fix clipping issue (#5342) 2025-11-08 11:28:15 +01:00
4 changed files with 25 additions and 15 deletions

View File

@ -22,7 +22,7 @@ jobs:
- name: Diff parse files
id: diff
run: |
git add -N tools/rlparser
git add -N tools/rlparser/output
git diff --name-only --exit-code
continue-on-error: true
@ -32,6 +32,6 @@ jobs:
set -x
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add tools/rlparser
git add tools/rlparser/output
git commit -m "rlparser: update raylib_api.* by CI"
git push

View File

@ -74,13 +74,14 @@ int main(void)
{
Color color = Fade(LIGHTGRAY, 0.3f);
if (!IsPathFile(files.paths[i]))
if (!IsPathFile(files.paths[i]) && DirectoryExists(files.paths[i]))
{
if (GuiButton((Rectangle){0.0f, 85.0f + 40.0f*(float)i, screenWidth, 40}, ""))
{
strcpy(directory, files.paths[i]);
UnloadDirectoryFiles(files);
files = LoadDirectoryFiles(directory);
continue;
}
}

View File

@ -19,6 +19,8 @@
#include "raymath.h" // Required for: Lerp()
#include <string.h>
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
@ -59,10 +61,11 @@ int main(void)
int lastSpace = 0; // Keeping track of last valid space to insert '\n'
int lastWrapStart = 0; // Keeping track of the start of this wrapped line.
while (lines[i][j] != '\0')
while (j <= strlen(lines[i]))
{
if (lines[i][j] == ' ')
if (lines[i][j] == ' ' || lines[i][j] == '\0')
{
char before = lines[i][j];
// Making a C Style string by adding a '\0' at the required location so that we can use the MeasureText function
lines[i][j] = '\0';
@ -75,7 +78,7 @@ int main(void)
lastWrapStart = lastSpace + 1;
}
lines[i][j] = ' '; // Resetting the space back
if(before != '\0') lines[i][j] = ' '; // Resetting the space back
lastSpace = j; // Since we encountered a new space we update our last encountered space location
}
@ -92,7 +95,7 @@ int main(void)
textHeight += (int)size.y + 10;
}
// A simple scrollbar on the side to show how far we have red into the file
// A simple scrollbar on the side to show how far we have read into the file
Rectangle scrollBar = {
.x = (float)screenWidth - 5,
.y = 0,
@ -132,7 +135,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], (float)fontSize, 2);
Vector2 size;
if(strcmp(lines[i], "")){
// Fix for empty line in the text file
size = MeasureTextEx( GetFontDefault(), lines[i], (float)fontSize, 2);
}else{
size = MeasureTextEx( GetFontDefault(), " ", (float)fontSize, 2);
}
DrawText(lines[i], 10, t, fontSize, RED);

12
src/external/rlsw.h vendored
View File

@ -2118,12 +2118,12 @@ static inline int sw_clip_##name(
// Frustum cliping functions
//-------------------------------------------------------------------------------------------
#define IS_INSIDE_PLANE_W(h) ((h)[3] >= SW_CLIP_EPSILON)
#define IS_INSIDE_PLANE_X_POS(h) ((h)[0] <= (h)[3])
#define IS_INSIDE_PLANE_X_NEG(h) (-(h)[0] <= (h)[3])
#define IS_INSIDE_PLANE_Y_POS(h) ((h)[1] <= (h)[3])
#define IS_INSIDE_PLANE_Y_NEG(h) (-(h)[1] <= (h)[3])
#define IS_INSIDE_PLANE_Z_POS(h) ((h)[2] <= (h)[3])
#define IS_INSIDE_PLANE_Z_NEG(h) (-(h)[2] <= (h)[3])
#define IS_INSIDE_PLANE_X_POS(h) ( (h)[0] < (h)[3]) // Exclusive for +X
#define IS_INSIDE_PLANE_X_NEG(h) (-(h)[0] < (h)[3]) // Exclusive for -X
#define IS_INSIDE_PLANE_Y_POS(h) ( (h)[1] < (h)[3]) // Exclusive for +Y
#define IS_INSIDE_PLANE_Y_NEG(h) (-(h)[1] < (h)[3]) // Exclusive for -Y
#define IS_INSIDE_PLANE_Z_POS(h) ( (h)[2] <= (h)[3]) // Inclusive for +Z
#define IS_INSIDE_PLANE_Z_NEG(h) (-(h)[2] <= (h)[3]) // Inclusive for -Z
#define COMPUTE_T_PLANE_W(hPrev, hCurr) ((SW_CLIP_EPSILON - (hPrev)[3])/((hCurr)[3] - (hPrev)[3]))
#define COMPUTE_T_PLANE_X_POS(hPrev, hCurr) (((hPrev)[3] - (hPrev)[0])/(((hPrev)[3] - (hPrev)[0]) - ((hCurr)[3] - (hCurr)[0])))