8 Commits

Author SHA1 Message Date
Ray
a7ac5c2823 Merge branch 'master' of https://github.com/raysan5/raylib 2026-07-01 12:19:29 +02:00
Ray
44b16a548f Update rtextures.c 2026-07-01 12:18:58 +02:00
9deaae0716 rlparser: update raylib_api.* by CI 2026-07-01 10:09:45 +00:00
Ray
122e378e93 ADDED: New image drawing functions, aligned with texture/text drawing -WIP-
The new functions are direct maps of the Texture2D equivalents, they can be useful for a future mapping Texture2D --> Image; an alternative 2d software renderer...
2026-07-01 12:09:26 +02:00
Ray
2c24ca1407 Typos 2026-07-01 11:55:43 +02:00
Ray
04a269f4f8 ADDED: Support for .pep image fileformat, useful for pixl-art 2026-07-01 11:55:27 +02:00
8999d2ba44 [tools] Add S-Expression Output Type to rlparser (#5943)
* Add S-Expression output to rlparser.c

* minor whitespace fix
2026-07-01 10:05:11 +02:00
Ray
7ac798cef9 REVIEWED: Shader attribute/uniform default names can not be overriden #5925 2026-07-01 10:04:24 +02:00
14 changed files with 8682 additions and 327 deletions

View File

@ -173,20 +173,22 @@
//#define RL_CULL_DISTANCE_FAR 4000.0 // Default projection matrix far cull distance
// Default shader vertex attribute locations
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES 7
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
// NOTE: Locations can be redefined by user if required
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES 7
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM 9
// Default shader vertex attribute/uniform names to set location points
// NOTE: When a new shader is loaded, locations are tried to be set for convenience, looking for the names defined here
// In case custom shader names are used, it's up to the user to set locations with GetShaderLocation*() functions
// WARNING: Location pre-defined names can not be changed, they are used by default shaders and all raylib examples shaders, they are just listed here for reference
// WARNING: In case custom shader names are used, it's up to the user to set locations with GetShaderLocation*() functions
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
@ -196,6 +198,7 @@
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES "vertexBoneIndices" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCETRANSFORM "instanceTransform" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
@ -203,6 +206,7 @@
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (tint color, multiplied by texture color)
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_BONEMATRICES "boneMatrices" // bone matrices
//#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
//#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
//#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
@ -240,6 +244,9 @@
#ifndef SUPPORT_FILEFORMAT_QOI
#define SUPPORT_FILEFORMAT_QOI 1
#endif
#ifndef SUPPORT_FILEFORMAT_PEP
#define SUPPORT_FILEFORMAT_PEP 0
#endif
#ifndef SUPPORT_FILEFORMAT_PSD
#define SUPPORT_FILEFORMAT_PSD 0 // Disabled by default
#endif

1328
src/external/pep.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -863,7 +863,7 @@ void SetWindowMonitor(int monitor)
// ending up positioned partly outside the target display
// NOTE 2: The workaround for that is, previously to moving the window,
// setting the window size to the target display size, so they match
// NOTE 3: It wasn't done here because it can not bee assumed that changing
// NOTE 3: It wasn't done here because it can not be assumed that changing
// the window size automatically is acceptable behavior by the user
SDL_SetWindowPosition(platform.window, usableBounds.x, usableBounds.y);
CORE.Window.position.x = usableBounds.x;

View File

@ -2213,7 +2213,7 @@ static unsigned SanitizeFlags(int mode, unsigned flags)
//
// This design takes care of many odd corner cases. For example, in case of restoring
// a window that was previously maximized AND minimized and those two flags need to be removed,
// ShowWindow with SW_RESTORE twice need to bee actually calleed. Another example is
// ShowWindow with SW_RESTORE twice need to be actually calleed. Another example is
// wheen having a maximized window, if the undecorated flag is modified then the window style
// needs to be updated, but updating the style would mean the window size would change
// causing the window to lose its Maximized state which would mean the window size

View File

@ -1431,8 +1431,10 @@ RLAPI void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCo
RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image
RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version)
RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
RLAPI void ImageDrawRectanglePro(Image *dst, Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters within and image
RLAPI void ImageDrawRectangleLines(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle lines within an image
RLAPI void ImageDrawRectangleLinesEx(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image with line thickness
RLAPI void ImageDrawRectangleGradientEx(Image *dst, Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw rectangle with gradient colors within an image, counter-clockwise color order
RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image
RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version)
RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
@ -1440,10 +1442,12 @@ RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color c
RLAPI void ImageDrawCircleGradient(Image *dst, Vector2 center, float radius, Color inner, Color outer); // Draw a gradient-filled circle within an image
RLAPI void ImageDrawImage(Image *dst, Image src, int posX, int posY, Color tint); // Draw an image within an image
RLAPI void ImageDrawImageEx(Image *dst, Image src, Vector2 position, float rotation, float scale, Color tint); // Draw an image with scaling and rotation within an image
RLAPI void ImageDrawImageRec(Image *dst, Image src, Rectangle srcRec, Vector2 position, Color tint); // Draw a part of an image defined by a rectangle within an image
RLAPI void ImageDrawImagePro(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Vector2 origin, float rotation, Color tint); // Draw a part of an image defined by a rectangle into destination rectangle, with scaling and rotation, within an image
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
RLAPI void ImageDrawTextPro(Image *dst, Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); // Draw text using Font and pro parameters (rotation)
// Texture loading functions
// NOTE: These functions require GPU access

View File

@ -56,8 +56,8 @@
* #define RL_CULL_DISTANCE_NEAR 0.05 // Default projection matrix near cull distance
* #define RL_CULL_DISTANCE_FAR 4000.0 // Default projection matrix far cull distance
*
* When loading a shader, the following vertex attributes and uniform
* location names are tried to be set automatically:
* When loading a shader, the following vertex attributes and uniform location names are tried to be set automatically:
* WARNING: Pre-defined names can not be changed, they are used by default shaders and all raylib examples shaders, they are just listed here for reference
*
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
@ -67,6 +67,8 @@
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES "vertexBoneIndices" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCETRANSFORM "instanceTransform" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM
*
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
@ -74,6 +76,7 @@
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView)))
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_BONEMATRICES "boneMatrices" // bone matrices
*
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
@ -324,6 +327,7 @@
#define RL_DRAW_FRAMEBUFFER 0x8CA9 // GL_DRAW_FRAMEBUFFER
// Default shader vertex attribute locations
// NOTE: Locations can be redefined by user if required
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
#endif
@ -993,65 +997,28 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
#endif
// Default shader vertex attribute names to set location points
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION
#define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL
#define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR
#define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES
#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES "vertexBoneIndices" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES
#endif
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS
#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS
#endif
// WARNING: Pre-defined names can not be changed, they are used by default shaders and all raylib examples shaders, they are just listed here for reference
#define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
#define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
#define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES "vertexBoneIndices" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES
#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS
#define RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCETRANSFORM "instanceTransform" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCETRANSFORM
#define RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCETRANSFORM "instanceTransform" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM
#endif
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
#define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
#define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
#define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
#define RL_DEFAULT_SHADER_UNIFORM_NAME_BONEMATRICES "boneMatrices" // bone matrices (required for GPU skinning)
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MVP
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
#endif
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW
#define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
#endif
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION
#define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
#endif
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
#endif
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL
#define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
#endif
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR
#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
#endif
#ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
#endif
#ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
#endif
#ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
#endif
#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_BONEMATRICES
#define RL_DEFAULT_SHADER_UNIFORM_NAME_BONEMATRICES "boneMatrices" // bone matrices (required for GPU skinning)
#endif
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
//----------------------------------------------------------------------------------
// Module Types and Structures Definition
@ -3022,7 +2989,7 @@ void rlDrawRenderBatch(rlRenderBatch *batch)
// NOTE: glMapBuffer() causes sync issue
// If GPU is working with this buffer, glMapBuffer() will wait(stall) until GPU to finish its job
// To avoid waiting (idle), glBufferData() can bee called first with NULL pointer before glMapBuffer()
// To avoid waiting (idle), glBufferData() can be called first with NULL pointer before glMapBuffer()
// Doing that, the previous data in PBO will be discarded and glMapBuffer() returns a new
// allocated pointer immediately even if GPU is still working with the previous data

View File

@ -12,6 +12,7 @@
* #define SUPPORT_FILEFORMAT_JPG 0
* #define SUPPORT_FILEFORMAT_GIF 1
* #define SUPPORT_FILEFORMAT_QOI 1
* #define SUPPORT_FILEFORMAT_PEP 1
* #define SUPPORT_FILEFORMAT_PSD 0
* #define SUPPORT_FILEFORMAT_HDR 0
* #define SUPPORT_FILEFORMAT_PIC 0
@ -188,7 +189,15 @@
#if defined(_MSC_VER)
#pragma warning(pop) // Disable MSVC warning suppression
#endif
#endif
#if SUPPORT_FILEFORMAT_PEP
#define PEP_MALLOC RL_MALLOC
#define PEP_REALLOC RL_REALLOC
#define PEP_FREE RL_FREE
#define PEP_IMPLEMENTATION
#include "external/pep.h"
#endif
#if SUPPORT_IMAGE_EXPORT
@ -510,6 +519,31 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
}
}
#endif
#if SUPPORT_FILEFORMAT_PEP
else if ((strcmp(fileType, ".pep") == 0) || (strcmp(fileType, ".PEP") == 0))
{
if (fileData != NULL)
{
// Deserialize file data into pep structure
pep p = pep_deserialize(fileData, dataSize);
// Decompress pep data for image struct
// Decompression options:
// - First color transparent, 3rd parameter: 1
// - Premultiply alpha on loading, 4th parameter: 1
unsigned int *pepData = pep_decompress(&p, pep_rgba, 1, 1);
image.data = pepData;
image.width = p.width;
image.height = p.height;
image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
image.mipmaps = 1;
PEP_FREE(pepData);
pep_free(&p);
}
}
#endif
#if SUPPORT_FILEFORMAT_DDS
else if ((strcmp(fileType, ".dds") == 0) || (strcmp(fileType, ".DDS") == 0))
{
@ -681,6 +715,25 @@ bool ExportImage(Image image, const char *fileName)
}
}
#endif
#if SUPPORT_FILEFORMAT_PEP
else if (IsFileExtension(fileName, ".pep"))
{
if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)
{
// NOTE: Only RGBA 32bit (8bit per channel) image format supported
pep p = pep_compress(image.data, image.width, image.height, pep_rgba, pep_8bit);
unsigned int pepDataSize = 0;
unsigned char *pepData = pep_serialize(&p, &pepDataSize);
result = SaveFileData(fileName, pepData, pepDataSize);
PEP_FREE(pepData);
pep_free(&p);
}
else TRACELOG(LOG_WARNING, "IMAGE: Image can not be exported, .pep requires RGBA 32bit input");
}
#endif
#if SUPPORT_FILEFORMAT_KTX
else if (IsFileExtension(fileName, ".ktx"))
{
@ -3865,6 +3918,12 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color)
}
}
// Draw a color-filled rectangle with pro parameters within and image
void ImageDrawRectanglePro(Image *dst, Rectangle rec, Vector2 origin, float rotation, Color color)
{
// TODO: NEW: Implement ImageDrawRectanglePro()
}
// Draw rectangle lines within an image
void ImageDrawRectangleLines(Image *dst, int posX, int posY, int width, int height, Color color)
{
@ -3881,6 +3940,12 @@ void ImageDrawRectangleLinesEx(Image *dst, Rectangle rec, int thick, Color color
ImageDrawRectangle(dst, (int)rec.x, (int)(rec.y + rec.height - thick), (int)rec.width, thick, color);
}
// Draw rectangle with gradient colors within an image, counter-clockwise color order
void ImageDrawRectangleGradientEx(Image *dst, Rectangle rec, Color col1, Color col2, Color col3, Color col4)
{
// TODO: NEW: Implement ImageDrawRectangleGradientEx()
}
// Draw circle within an image
void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color)
{
@ -3948,7 +4013,7 @@ void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color)
// Draw a gradient-filled circle within an image
void ImageDrawCircleGradient(Image *dst, Vector2 center, float radius, Color inner, Color outer)
{
// TODO: Implement gradient circle drawing
// TODO: NEW: Implement ImageDrawCircleGradient()
}
// Draw an image within an image
@ -3959,6 +4024,12 @@ void ImageDrawImage(Image *dst, Image src, int posX, int posY, Color tint)
ImageDrawImagePro(dst, src, srcRec, dstRec, (Vector2){ 0 }, 0.0f, tint);
}
// Draw an image with scaling and rotation within an image
void ImageDrawImageEx(Image *dst, Image src, Vector2 position, float rotation, float scale, Color tint)
{
// TODO: NEW: Implement ImageDrawImageEx()
}
// Draw a part of an image defined by a rectangle within an image
void ImageDrawImageRec(Image *dst, Image src, Rectangle srcRec, Vector2 position, Color tint)
{
@ -3967,8 +4038,7 @@ void ImageDrawImageRec(Image *dst, Image src, Rectangle srcRec, Vector2 position
}
// Draw a part of an image defined by a rectangle into destination rectangle, with scaling and rotation, within an image
// NOTE: Color tint is applied to source image
// TODO: WARNING: origin and rotation are not implemented
// TODO: REVIEW: ImageDrawImagePro(), implement origin and rotation for image drawing
void ImageDrawImagePro(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Vector2 origin, float rotation, Color tint)
{
// Security check to avoid program crash
@ -4146,6 +4216,12 @@ void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position,
UnloadImage(imText);
}
// Draw text using Font and pro parameters (rotation)
void ImageDrawTextPro(Image *dst, Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint)
{
// TODO: NEW: Implement ImageDrawTextPro()
}
//------------------------------------------------------------------------------------
// Texture loading functions
//------------------------------------------------------------------------------------

View File

@ -79,6 +79,7 @@ raylib_api: ../../src/raylib.h rlparser
FORMAT=JSON EXTENSION=json $(MAKE) raylib_api.json
FORMAT=XML EXTENSION=xml $(MAKE) raylib_api.xml
FORMAT=LUA EXTENSION=lua $(MAKE) raylib_api.lua
FORMAT=SEXPR EXTENSION=sexpr $(MAKE) raylib_api.sexpr
# rlparser execution: [raylib.h] parse, generating some output files
raylib_api.$(EXTENSION): ../../src/raylib.h rlparser
@ -112,7 +113,8 @@ all: rlparser
FORMAT=JSON EXTENSION=json $(MAKE) parse
FORMAT=XML EXTENSION=xml $(MAKE) parse
FORMAT=LUA EXTENSION=lua $(MAKE) parse
FORMAT=SEXPR EXTENSION=sexpr $(MAKE) parse
# Clean rlparser and generated output files
clean:
rm -f rlparser *.json *.txt *.xml *.lua
rm -f rlparser *.json *.txt *.xml *.lua *.sexpr

View File

@ -8455,6 +8455,33 @@
}
]
},
{
"name": "ImageDrawRectanglePro",
"description": "Draw a color-filled rectangle with pro parameters within and image",
"returnType": "void",
"params": [
{
"type": "Image *",
"name": "dst"
},
{
"type": "Rectangle",
"name": "rec"
},
{
"type": "Vector2",
"name": "origin"
},
{
"type": "float",
"name": "rotation"
},
{
"type": "Color",
"name": "color"
}
]
},
{
"name": "ImageDrawRectangleLines",
"description": "Draw rectangle lines within an image",
@ -8509,6 +8536,37 @@
}
]
},
{
"name": "ImageDrawRectangleGradientEx",
"description": "Draw rectangle with gradient colors within an image, counter-clockwise color order",
"returnType": "void",
"params": [
{
"type": "Image *",
"name": "dst"
},
{
"type": "Rectangle",
"name": "rec"
},
{
"type": "Color",
"name": "col1"
},
{
"type": "Color",
"name": "col2"
},
{
"type": "Color",
"name": "col3"
},
{
"type": "Color",
"name": "col4"
}
]
},
{
"name": "ImageDrawCircle",
"description": "Draw a filled circle within an image",
@ -8663,6 +8721,37 @@
}
]
},
{
"name": "ImageDrawImageEx",
"description": "Draw an image with scaling and rotation within an image",
"returnType": "void",
"params": [
{
"type": "Image *",
"name": "dst"
},
{
"type": "Image",
"name": "src"
},
{
"type": "Vector2",
"name": "position"
},
{
"type": "float",
"name": "rotation"
},
{
"type": "float",
"name": "scale"
},
{
"type": "Color",
"name": "tint"
}
]
},
{
"name": "ImageDrawImageRec",
"description": "Draw a part of an image defined by a rectangle within an image",
@ -8791,6 +8880,49 @@
}
]
},
{
"name": "ImageDrawTextPro",
"description": "Draw text using Font and pro parameters (rotation)",
"returnType": "void",
"params": [
{
"type": "Image *",
"name": "dst"
},
{
"type": "Font",
"name": "font"
},
{
"type": "const char *",
"name": "text"
},
{
"type": "Vector2",
"name": "position"
},
{
"type": "Vector2",
"name": "origin"
},
{
"type": "float",
"name": "rotation"
},
{
"type": "float",
"name": "fontSize"
},
{
"type": "float",
"name": "spacing"
},
{
"type": "Color",
"name": "tint"
}
]
},
{
"name": "LoadTexture",
"description": "Load texture from file into GPU memory (VRAM)",

View File

@ -6232,6 +6232,18 @@ return {
{type = "Color", name = "color"}
}
},
{
name = "ImageDrawRectanglePro",
description = "Draw a color-filled rectangle with pro parameters within and image",
returnType = "void",
params = {
{type = "Image *", name = "dst"},
{type = "Rectangle", name = "rec"},
{type = "Vector2", name = "origin"},
{type = "float", name = "rotation"},
{type = "Color", name = "color"}
}
},
{
name = "ImageDrawRectangleLines",
description = "Draw rectangle lines within an image",
@ -6256,6 +6268,19 @@ return {
{type = "Color", name = "color"}
}
},
{
name = "ImageDrawRectangleGradientEx",
description = "Draw rectangle with gradient colors within an image, counter-clockwise color order",
returnType = "void",
params = {
{type = "Image *", name = "dst"},
{type = "Rectangle", name = "rec"},
{type = "Color", name = "col1"},
{type = "Color", name = "col2"},
{type = "Color", name = "col3"},
{type = "Color", name = "col4"}
}
},
{
name = "ImageDrawCircle",
description = "Draw a filled circle within an image",
@ -6326,6 +6351,19 @@ return {
{type = "Color", name = "tint"}
}
},
{
name = "ImageDrawImageEx",
description = "Draw an image with scaling and rotation within an image",
returnType = "void",
params = {
{type = "Image *", name = "dst"},
{type = "Image", name = "src"},
{type = "Vector2", name = "position"},
{type = "float", name = "rotation"},
{type = "float", name = "scale"},
{type = "Color", name = "tint"}
}
},
{
name = "ImageDrawImageRec",
description = "Draw a part of an image defined by a rectangle within an image",
@ -6379,6 +6417,22 @@ return {
{type = "Color", name = "tint"}
}
},
{
name = "ImageDrawTextPro",
description = "Draw text using Font and pro parameters (rotation)",
returnType = "void",
params = {
{type = "Image *", name = "dst"},
{type = "Font", name = "font"},
{type = "const char *", name = "text"},
{type = "Vector2", name = "position"},
{type = "Vector2", name = "origin"},
{type = "float", name = "rotation"},
{type = "float", name = "fontSize"},
{type = "float", name = "spacing"},
{type = "Color", name = "tint"}
}
},
{
name = "LoadTexture",
description = "Load texture from file into GPU memory (VRAM)",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -681,7 +681,7 @@
<Param type="unsigned int" name="frames" desc="" />
</Callback>
</Callbacks>
<Functions count="607">
<Functions count="611">
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
<Param type="int" name="width" desc="" />
<Param type="int" name="height" desc="" />
@ -2132,6 +2132,13 @@
<Param type="Rectangle" name="rec" desc="" />
<Param type="Color" name="color" desc="" />
</Function>
<Function name="ImageDrawRectanglePro" retType="void" paramCount="5" desc="Draw a color-filled rectangle with pro parameters within and image">
<Param type="Image *" name="dst" desc="" />
<Param type="Rectangle" name="rec" desc="" />
<Param type="Vector2" name="origin" desc="" />
<Param type="float" name="rotation" desc="" />
<Param type="Color" name="color" desc="" />
</Function>
<Function name="ImageDrawRectangleLines" retType="void" paramCount="6" desc="Draw rectangle lines within an image">
<Param type="Image *" name="dst" desc="" />
<Param type="int" name="posX" desc="" />
@ -2146,6 +2153,14 @@
<Param type="int" name="thick" desc="" />
<Param type="Color" name="color" desc="" />
</Function>
<Function name="ImageDrawRectangleGradientEx" retType="void" paramCount="6" desc="Draw rectangle with gradient colors within an image, counter-clockwise color order">
<Param type="Image *" name="dst" desc="" />
<Param type="Rectangle" name="rec" desc="" />
<Param type="Color" name="col1" desc="" />
<Param type="Color" name="col2" desc="" />
<Param type="Color" name="col3" desc="" />
<Param type="Color" name="col4" desc="" />
</Function>
<Function name="ImageDrawCircle" retType="void" paramCount="5" desc="Draw a filled circle within an image">
<Param type="Image *" name="dst" desc="" />
<Param type="int" name="centerX" desc="" />
@ -2186,6 +2201,14 @@
<Param type="int" name="posY" desc="" />
<Param type="Color" name="tint" desc="" />
</Function>
<Function name="ImageDrawImageEx" retType="void" paramCount="6" desc="Draw an image with scaling and rotation within an image">
<Param type="Image *" name="dst" desc="" />
<Param type="Image" name="src" desc="" />
<Param type="Vector2" name="position" desc="" />
<Param type="float" name="rotation" desc="" />
<Param type="float" name="scale" desc="" />
<Param type="Color" name="tint" desc="" />
</Function>
<Function name="ImageDrawImageRec" retType="void" paramCount="5" desc="Draw a part of an image defined by a rectangle within an image">
<Param type="Image *" name="dst" desc="" />
<Param type="Image" name="src" desc="" />
@ -2219,6 +2242,17 @@
<Param type="float" name="spacing" desc="" />
<Param type="Color" name="tint" desc="" />
</Function>
<Function name="ImageDrawTextPro" retType="void" paramCount="9" desc="Draw text using Font and pro parameters (rotation)">
<Param type="Image *" name="dst" desc="" />
<Param type="Font" name="font" desc="" />
<Param type="const char *" name="text" desc="" />
<Param type="Vector2" name="position" desc="" />
<Param type="Vector2" name="origin" desc="" />
<Param type="float" name="rotation" desc="" />
<Param type="float" name="fontSize" desc="" />
<Param type="float" name="spacing" desc="" />
<Param type="Color" name="tint" desc="" />
</Function>
<Function name="LoadTexture" retType="Texture2D" paramCount="1" desc="Load texture from file into GPU memory (VRAM)">
<Param type="const char *" name="fileName" desc="" />
</Function>

View File

@ -146,7 +146,7 @@ typedef struct FunctionInfo {
} FunctionInfo;
// Output format for parsed data
typedef enum { DEFAULT = 0, JSON, XML, LUA, CODE } OutputFormat;
typedef enum { DEFAULT = 0, JSON, XML, LUA, SEXPR, CODE } OutputFormat;
//----------------------------------------------------------------------------------
// Global Variables Definition
@ -1062,6 +1062,7 @@ int main(int argc, char *argv[])
else if (outputFormat == JSON) printf("\nOutput format: JSON\n\n");
else if (outputFormat == XML) printf("\nOutput format: XML\n\n");
else if (outputFormat == LUA) printf("\nOutput format: LUA\n\n");
else if (outputFormat == SEXPR) printf("\nOutput format: SEXPR\n\n");
else if (outputFormat == CODE) printf("\nOutput format: CODE\n\n");
ExportParsedData(outFileName, outputFormat);
@ -1098,10 +1099,10 @@ static void ShowCommandLineInfo(void)
printf(" -i, --input <filename.h> : Define input header file to parse.\n");
printf(" NOTE: If not specified, defaults to: raylib.h\n\n");
printf(" -o, --output <filename.ext> : Define output file and format.\n");
printf(" Supported extensions: .txt, .json, .xml, .lua, .h\n");
printf(" Supported extensions: .txt, .json, .xml, .lua, .sexpr, .h\n");
printf(" NOTE: If not specified, defaults to: raylib_api.txt\n\n");
printf(" -f, --format <type> : Define output format for parser data.\n");
printf(" Supported types: DEFAULT, JSON, XML, LUA, CODE\n\n");
printf(" Supported types: DEFAULT, JSON, XML, LUA, SEXPR, CODE\n\n");
printf(" -d, --define <DEF> : Define functions specifiers (i.e. RLAPI for raylib.h, RMAPI for raymath.h, etc.)\n");
printf(" NOTE: If no specifier defined, defaults to: RLAPI\n\n");
printf(" -t, --truncate <after> : Define string to truncate input after (i.e. \"RLGL IMPLEMENTATION\" for rlgl.h)\n");
@ -1154,6 +1155,7 @@ static void ProcessCommandLine(int argc, char *argv[])
else if (IsTextEqual(argv[i + 1], "JSON\0", 5)) outputFormat = JSON;
else if (IsTextEqual(argv[i + 1], "XML\0", 4)) outputFormat = XML;
else if (IsTextEqual(argv[i + 1], "LUA\0", 4)) outputFormat = LUA;
else if (IsTextEqual(argv[i + 1], "SEXPR\0", 4)) outputFormat = SEXPR;
else if (IsTextEqual(argv[i + 1], "CODE\0", 5)) outputFormat = CODE;
}
else printf("WARNING: No format parameters provided\n");
@ -2007,6 +2009,131 @@ static void ExportParsedData(const char *fileName, int format)
fprintf(outFile, " }\n");
fprintf(outFile, "}\n");
} break;
case SEXPR:
{
fprintf(outFile, "(");
// Print defines info
fprintf(outFile, "(defines\n");
for (int i = 0; i < defineCount; i++)
{
if(i != 0) fprintf(outFile, "\n");
fprintf(outFile, " ((name \"%s\")\n", defines[i].name);
fprintf(outFile, " (type \"%s\")\n", StrDefineType(defines[i].type));
if ((defines[i].type == INT) ||
(defines[i].type == LONG) ||
(defines[i].type == FLOAT) ||
(defines[i].type == DOUBLE) ||
(defines[i].type == STRING))
{
fprintf(outFile, " (value %s)\n", defines[i].value);
}
else
{
fprintf(outFile, " (value \"%s\")\n", defines[i].value);
}
fprintf(outFile, " (description \"%s\"))", defines[i].desc);
}
fprintf(outFile, ")\n\n");
// Print structs info
fprintf(outFile, " (structs\n");
for (int i = 0; i < structCount; i++)
{
if(i != 0) fprintf(outFile, "\n\n");
fprintf(outFile, " ((name \"%s\")\n", structs[i].name);
fprintf(outFile, " (description \"%s\")\n", EscapeBackslashes(structs[i].desc));
fprintf(outFile, " (fields ");
for (int f = 0; f < structs[i].fieldCount; f++)
{
fprintf(outFile, "\n ((type \"%s\")\n", structs[i].fieldType[f]);
fprintf(outFile, " (name \"%s\")\n", structs[i].fieldName[f]);
fprintf(outFile, " (description \"%s\"))", EscapeBackslashes(structs[i].fieldDesc[f]));
}
fprintf(outFile, "))");
}
fprintf(outFile, ")\n\n");
// Print aliases info
fprintf(outFile, " (aliases\n");
for (int i = 0; i < aliasCount; i++)
{
if(i != 0) fprintf(outFile, "\n\n");
fprintf(outFile, " ((type \"%s\")\n", aliases[i].type);
fprintf(outFile, " (name \"%s\")\n", aliases[i].name);
fprintf(outFile, " (description \"%s\"))", aliases[i].desc);
}
fprintf(outFile, ")\n\n");
// Print enums info
fprintf(outFile, " (enums\n");
for (int i = 0; i < enumCount; i++)
{
if(i != 0) fprintf(outFile, "\n\n");
fprintf(outFile, " ((name \"%s\")\n", enums[i].name);
fprintf(outFile, " (description \"%s\")\n", EscapeBackslashes(enums[i].desc));
fprintf(outFile, " (values\n");
for (int e = 0; e < enums[i].valueCount; e++)
{
if(e != 0) fprintf(outFile, "\n\n");
fprintf(outFile, " ((name \"%s\")\n", enums[i].valueName[e]);
fprintf(outFile, " (value %i)\n", enums[i].valueInteger[e]);
fprintf(outFile, " (description \"%s\"))", EscapeBackslashes(enums[i].valueDesc[e]));
}
fprintf(outFile, "))");
}
fprintf(outFile, ")\n\n");
// Print callbacks info
fprintf(outFile, " (callbacks\n");
for (int i = 0; i < callbackCount; i++)
{
if(i != 0) fprintf(outFile, "\n\n");
fprintf(outFile, " ((name \"%s\")\n", callbacks[i].name);
fprintf(outFile, " (description \"%s\")\n", EscapeBackslashes(callbacks[i].desc));
fprintf(outFile, " (return-type \"%s\")", callbacks[i].retType);
if (callbacks[i].paramCount == 0) fprintf(outFile, "\n");
else
{
fprintf(outFile, "\n (params\n");
for (int p = 0; p < callbacks[i].paramCount; p++)
{
if(p != 0) fprintf(outFile, "\n");
fprintf(outFile, " ((type \"%s\") (name \"%s\"))", callbacks[i].paramType[p], callbacks[i].paramName[p]);
}
fprintf(outFile, ")");
}
fprintf(outFile, ")");
}
fprintf(outFile, ")\n\n");
// Print functions info
fprintf(outFile, " (functions\n");
for (int i = 0; i < funcCount; i++)
{
if(i != 0) fprintf(outFile, "\n\n");
fprintf(outFile, " ((name \"%s\")\n", funcs[i].name);
fprintf(outFile, " (description \"%s\")\n", EscapeBackslashes(funcs[i].desc));
fprintf(outFile, " (return-type \"%s\")", funcs[i].retType);
if (funcs[i].paramCount == 0) fprintf(outFile, "");
else
{
fprintf(outFile, "\n (params\n");
for (int p = 0; p < funcs[i].paramCount; p++)
{
if(p != 0) fprintf(outFile, "\n");
fprintf(outFile, " ((type \"%s\") (name \"%s\"))", funcs[i].paramType[p], funcs[i].paramName[p]);
}
fprintf(outFile, ")");
}
fprintf(outFile, ")");
}
fprintf(outFile, ")");
fprintf(outFile, ")\n");
} break;
case CODE:
default: break;
}