Skip to content

Commit

Permalink
update to master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
GuvaCode committed Jan 12, 2025
1 parent 07ba0be commit 9e3b785
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 25 deletions.
16 changes: 8 additions & 8 deletions headers/raylib.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software:
*
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
*
* This software is provided "as-is", without any express or implied warranty. In no event
* will the authors be held liable for any damages arising from the use of this software.
Expand Down Expand Up @@ -1510,15 +1510,15 @@ RLAPI const char *TextFormat(const char *text, ...);
RLAPI const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
RLAPI char *TextReplace(const char *text, const char *replace, const char *by); // Replace text string (WARNING: memory must be freed!)
RLAPI char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (WARNING: memory must be freed!)
RLAPI const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
RLAPI const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
RLAPI char *TextJoin(char **textList, int count, const char *delimiter); // Join text strings with delimiter
RLAPI char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
RLAPI int TextFindIndex(const char *text, const char *find); // Find first text occurrence within a string
RLAPI const char *TextToUpper(const char *text); // Get upper case version of provided string
RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
RLAPI const char *TextToSnake(const char *text); // Get Snake case notation version of provided string
RLAPI const char *TextToCamel(const char *text); // Get Camel case notation version of provided string
RLAPI char *TextToUpper(const char *text); // Get upper case version of provided string
RLAPI char *TextToLower(const char *text); // Get lower case version of provided string
RLAPI char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
RLAPI char *TextToSnake(const char *text); // Get Snake case notation version of provided string
RLAPI char *TextToCamel(const char *text); // Get Camel case notation version of provided string

RLAPI int TextToInteger(const char *text); // Get integer value from text
RLAPI float TextToFloat(const char *text); // Get float value from text
Expand Down
2 changes: 1 addition & 1 deletion headers/raymath.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
* LICENSE: zlib/libpng
*
* Copyright (c) 2015-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
*
* This software is provided "as-is", without any express or implied warranty. In no event
* will the authors be held liable for any damages arising from the use of this software.
Expand Down
38 changes: 23 additions & 15 deletions headers/rlgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are
* initialized on rlglInit() to accumulate vertex data
*
* When an internal state change is required all the stored vertex data is renderer in batch,
* When an internal state change is required all the stored vertex data is rendered in batch,
* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch
*
* Some resources are also loaded for convenience, here the complete list:
Expand Down Expand Up @@ -88,7 +88,7 @@
*
* LICENSE: zlib/libpng
*
* Copyright (c) 2014-2024 Ramon Santamaria (@raysan5)
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
*
* This software is provided "as-is", without any express or implied warranty. In no event
* will the authors be held liable for any damages arising from the use of this software.
Expand Down Expand Up @@ -3666,29 +3666,37 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format)
// Read screen pixel data (color buffer)
unsigned char *rlReadScreenPixels(int width, int height)
{
unsigned char *screenData = (unsigned char *)RL_CALLOC(width*height*4, sizeof(unsigned char));
unsigned char *imgData = (unsigned char *)RL_CALLOC(width*height*4, sizeof(unsigned char));

// NOTE 1: glReadPixels returns image flipped vertically -> (0,0) is the bottom left corner of the framebuffer
// NOTE 2: We are getting alpha channel! Be careful, it can be transparent if not cleared properly!
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, screenData);
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, imgData);

// Flip image vertically!
unsigned char *imgData = (unsigned char *)RL_MALLOC(width*height*4*sizeof(unsigned char));

for (int y = height - 1; y >= 0; y--)
// NOTE: Alpha value has already been applied to RGB in framebuffer, we don't need it!
for (int y = height - 1; y >= height / 2; y--)
{
for (int x = 0; x < (width*4); x++)
for (int x = 0; x < (width*4); x += 4)
{
imgData[((height - 1) - y)*width*4 + x] = screenData[(y*width*4) + x]; // Flip line

// Set alpha component value to 255 (no trasparent image retrieval)
// NOTE: Alpha value has already been applied to RGB in framebuffer, we don't need it!
if (((x + 1)%4) == 0) imgData[((height - 1) - y)*width*4 + x] = 255;
size_t s = ((height - 1) - y)*width*4 + x;
size_t e = y*width*4 + x;

unsigned char r = imgData[s];
unsigned char g = imgData[s+1];
unsigned char b = imgData[s+2];

imgData[s] = imgData[e];
imgData[s+1] = imgData[e+1];
imgData[s+2] = imgData[e+2];
imgData[s+3] = 255; // Set alpha component value to 255 (no trasparent image retrieval)

imgData[e] = r;
imgData[e+1] = g;
imgData[e+2] = b;
imgData[e+3] = 255; // Ditto
}
}

RL_FREE(screenData);

return imgData; // NOTE: image data should be freed
}

Expand Down
Binary file modified libs/i386-win32/raylib.dll
Binary file not shown.
Binary file modified libs/x86_32-linux/libraylib.a
Binary file not shown.
Binary file modified libs/x86_32-linux/libraylib.so
Binary file not shown.
Binary file modified libs/x86_64-linux/libraylib.a
Binary file not shown.
Binary file modified libs/x86_64-linux/libraylib.so
Binary file not shown.
Binary file modified libs/x86_64-win64/raylib.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion source/raylib.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@ function TextReplace(const text: PChar; const replace, by: PChar): PChar; cdecl;
{Insert text in a position (WARNING: memory must be freed!)}
function TextInsert(const text, insert: PChar; position: Integer): PChar; cdecl; external {$IFNDEF RAY_STATIC}cDllName{$ENDIF} name 'TextInsert';
{Join text strings with delimiter}
function TextJoin(const textList: PPChar; count: Integer; const delimiter: PChar): PChar; cdecl; external {$IFNDEF RAY_STATIC}cDllName{$ENDIF} name 'TextJoin';
function TextJoin(textList: PPChar; count: Integer; const delimiter: PChar): PChar; cdecl; external {$IFNDEF RAY_STATIC}cDllName{$ENDIF} name 'TextJoin';
{Split text into multiple strings}
function TextSplit(const text: PChar; delimiter: Char; count: PInteger): PPChar; cdecl; external {$IFNDEF RAY_STATIC}cDllName{$ENDIF} name 'TextSplit';
{Append text at specific position and move cursor!}
Expand Down

0 comments on commit 9e3b785

Please sign in to comment.