Merge branch 'raysan5:master' into master

This commit is contained in:
Jon Daniel 2025-06-01 11:39:21 +02:00 committed by GitHub
commit 2e2d0cbd2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 11329 additions and 10693 deletions

View File

@ -52,6 +52,8 @@ int main(void)
DrawCircle(screenWidth/5, 120, 35, DARKBLUE); DrawCircle(screenWidth/5, 120, 35, DARKBLUE);
DrawCircleGradient(screenWidth/5, 220, 60, GREEN, SKYBLUE); DrawCircleGradient(screenWidth/5, 220, 60, GREEN, SKYBLUE);
DrawCircleLines(screenWidth/5, 340, 80, DARKBLUE); DrawCircleLines(screenWidth/5, 340, 80, DARKBLUE);
DrawEllipse(screenWidth/5, 120, 25, 20, YELLOW);
DrawEllipseLines(screenWidth/5, 120, 30, 25, YELLOW);
// Rectangle shapes and lines // Rectangle shapes and lines
DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED); DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED);

View File

@ -5702,6 +5702,29 @@
} }
] ]
}, },
{
"name": "DrawEllipseV",
"description": "Draw ellipse (Vector version)",
"returnType": "void",
"params": [
{
"type": "Vector2",
"name": "center"
},
{
"type": "float",
"name": "radiusH"
},
{
"type": "float",
"name": "radiusV"
},
{
"type": "Color",
"name": "color"
}
]
},
{ {
"name": "DrawEllipseLines", "name": "DrawEllipseLines",
"description": "Draw ellipse outline", "description": "Draw ellipse outline",
@ -5729,6 +5752,29 @@
} }
] ]
}, },
{
"name": "DrawEllipseLinesV",
"description": "Draw ellipse outline (Vector version)",
"returnType": "void",
"params": [
{
"type": "Vector2",
"name": "center"
},
{
"type": "float",
"name": "radiusH"
},
{
"type": "float",
"name": "radiusV"
},
{
"type": "Color",
"name": "color"
}
]
},
{ {
"name": "DrawRing", "name": "DrawRing",
"description": "Draw ring", "description": "Draw ring",

View File

@ -4838,6 +4838,17 @@ return {
{type = "Color", name = "color"} {type = "Color", name = "color"}
} }
}, },
{
name = "DrawEllipseV",
description = "Draw ellipse (Vector version)",
returnType = "void",
params = {
{type = "Vector2", name = "center"},
{type = "float", name = "radiusH"},
{type = "float", name = "radiusV"},
{type = "Color", name = "color"}
}
},
{ {
name = "DrawEllipseLines", name = "DrawEllipseLines",
description = "Draw ellipse outline", description = "Draw ellipse outline",
@ -4850,6 +4861,17 @@ return {
{type = "Color", name = "color"} {type = "Color", name = "color"}
} }
}, },
{
name = "DrawEllipseLinesV",
description = "Draw ellipse outline (Vector version)",
returnType = "void",
params = {
{type = "Vector2", name = "center"},
{type = "float", name = "radiusH"},
{type = "float", name = "radiusV"},
{type = "Color", name = "color"}
}
},
{ {
name = "DrawRing", name = "DrawRing",
description = "Draw ring", description = "Draw ring",

File diff suppressed because it is too large Load Diff

View File

@ -679,7 +679,7 @@
<Param type="unsigned int" name="frames" desc="" /> <Param type="unsigned int" name="frames" desc="" />
</Callback> </Callback>
</Callbacks> </Callbacks>
<Functions count="582"> <Functions count="584">
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context"> <Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
<Param type="int" name="width" desc="" /> <Param type="int" name="width" desc="" />
<Param type="int" name="height" desc="" /> <Param type="int" name="height" desc="" />
@ -1409,6 +1409,12 @@
<Param type="float" name="radiusV" desc="" /> <Param type="float" name="radiusV" desc="" />
<Param type="Color" name="color" desc="" /> <Param type="Color" name="color" desc="" />
</Function> </Function>
<Function name="DrawEllipseV" retType="void" paramCount="4" desc="Draw ellipse (Vector version)">
<Param type="Vector2" name="center" desc="" />
<Param type="float" name="radiusH" desc="" />
<Param type="float" name="radiusV" desc="" />
<Param type="Color" name="color" desc="" />
</Function>
<Function name="DrawEllipseLines" retType="void" paramCount="5" desc="Draw ellipse outline"> <Function name="DrawEllipseLines" retType="void" paramCount="5" desc="Draw ellipse outline">
<Param type="int" name="centerX" desc="" /> <Param type="int" name="centerX" desc="" />
<Param type="int" name="centerY" desc="" /> <Param type="int" name="centerY" desc="" />
@ -1416,6 +1422,12 @@
<Param type="float" name="radiusV" desc="" /> <Param type="float" name="radiusV" desc="" />
<Param type="Color" name="color" desc="" /> <Param type="Color" name="color" desc="" />
</Function> </Function>
<Function name="DrawEllipseLinesV" retType="void" paramCount="4" desc="Draw ellipse outline (Vector version)">
<Param type="Vector2" name="center" desc="" />
<Param type="float" name="radiusH" desc="" />
<Param type="float" name="radiusV" desc="" />
<Param type="Color" name="color" desc="" />
</Function>
<Function name="DrawRing" retType="void" paramCount="7" desc="Draw ring"> <Function name="DrawRing" retType="void" paramCount="7" desc="Draw ring">
<Param type="Vector2" name="center" desc="" /> <Param type="Vector2" name="center" desc="" />
<Param type="float" name="innerRadius" desc="" /> <Param type="float" name="innerRadius" desc="" />

21158
src/external/RGFW.h vendored

File diff suppressed because it is too large Load Diff

View File

@ -177,6 +177,7 @@ static const unsigned short keyMappingRGFW[] = {
[RGFW_shiftR] = KEY_RIGHT_SHIFT, [RGFW_shiftR] = KEY_RIGHT_SHIFT,
[RGFW_controlR] = KEY_RIGHT_CONTROL, [RGFW_controlR] = KEY_RIGHT_CONTROL,
[RGFW_altR] = KEY_RIGHT_ALT, [RGFW_altR] = KEY_RIGHT_ALT,
[RGFW_superR] = KEY_RIGHT_SUPER,
#endif #endif
[RGFW_space] = KEY_SPACE, [RGFW_space] = KEY_SPACE,
@ -584,7 +585,7 @@ void SetWindowPosition(int x, int y)
// Set monitor for the current window // Set monitor for the current window
void SetWindowMonitor(int monitor) void SetWindowMonitor(int monitor)
{ {
RGFW_window_moveToMonitor(platform.window, RGFW_getMonitors()[monitor]); RGFW_window_moveToMonitor(platform.window, RGFW_getMonitors(NULL)[monitor]);
} }
// Set window minimum dimensions (FLAG_WINDOW_RESIZABLE) // Set window minimum dimensions (FLAG_WINDOW_RESIZABLE)
@ -641,7 +642,7 @@ int GetMonitorCount(void)
#define MAX_MONITORS_SUPPORTED 6 #define MAX_MONITORS_SUPPORTED 6
int count = MAX_MONITORS_SUPPORTED; int count = MAX_MONITORS_SUPPORTED;
RGFW_monitor *mons = RGFW_getMonitors(); RGFW_monitor *mons = RGFW_getMonitors(NULL);
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
@ -658,7 +659,7 @@ int GetMonitorCount(void)
// Get current monitor where window is placed // Get current monitor where window is placed
int GetCurrentMonitor(void) int GetCurrentMonitor(void)
{ {
RGFW_monitor *mons = RGFW_getMonitors(); RGFW_monitor *mons = RGFW_getMonitors(NULL);
RGFW_monitor mon = { 0 }; RGFW_monitor mon = { 0 };
if (platform.window) mon = RGFW_window_getMonitor(platform.window); if (platform.window) mon = RGFW_window_getMonitor(platform.window);
@ -675,7 +676,7 @@ int GetCurrentMonitor(void)
// Get selected monitor position // Get selected monitor position
Vector2 GetMonitorPosition(int monitor) Vector2 GetMonitorPosition(int monitor)
{ {
RGFW_monitor *mons = RGFW_getMonitors(); RGFW_monitor *mons = RGFW_getMonitors(NULL);
return (Vector2){ (float)mons[monitor].x, (float)mons[monitor].y }; return (Vector2){ (float)mons[monitor].x, (float)mons[monitor].y };
} }
@ -683,7 +684,7 @@ Vector2 GetMonitorPosition(int monitor)
// Get selected monitor width (currently used by monitor) // Get selected monitor width (currently used by monitor)
int GetMonitorWidth(int monitor) int GetMonitorWidth(int monitor)
{ {
RGFW_monitor *mons = RGFW_getMonitors(); RGFW_monitor *mons = RGFW_getMonitors(NULL);
return mons[monitor].mode.area.w; return mons[monitor].mode.area.w;
} }
@ -691,7 +692,7 @@ int GetMonitorWidth(int monitor)
// Get selected monitor height (currently used by monitor) // Get selected monitor height (currently used by monitor)
int GetMonitorHeight(int monitor) int GetMonitorHeight(int monitor)
{ {
RGFW_monitor *mons = RGFW_getMonitors(); RGFW_monitor *mons = RGFW_getMonitors(NULL);
return mons[monitor].mode.area.h; return mons[monitor].mode.area.h;
} }
@ -699,7 +700,7 @@ int GetMonitorHeight(int monitor)
// Get selected monitor physical width in millimetres // Get selected monitor physical width in millimetres
int GetMonitorPhysicalWidth(int monitor) int GetMonitorPhysicalWidth(int monitor)
{ {
RGFW_monitor *mons = RGFW_getMonitors(); RGFW_monitor *mons = RGFW_getMonitors(NULL);
return mons[monitor].physW; return mons[monitor].physW;
} }
@ -707,7 +708,7 @@ int GetMonitorPhysicalWidth(int monitor)
// Get selected monitor physical height in millimetres // Get selected monitor physical height in millimetres
int GetMonitorPhysicalHeight(int monitor) int GetMonitorPhysicalHeight(int monitor)
{ {
RGFW_monitor *mons = RGFW_getMonitors(); RGFW_monitor *mons = RGFW_getMonitors(NULL);
return (int)mons[monitor].physH; return (int)mons[monitor].physH;
} }
@ -715,7 +716,7 @@ int GetMonitorPhysicalHeight(int monitor)
// Get selected monitor refresh rate // Get selected monitor refresh rate
int GetMonitorRefreshRate(int monitor) int GetMonitorRefreshRate(int monitor)
{ {
RGFW_monitor *mons = RGFW_getMonitors(); RGFW_monitor *mons = RGFW_getMonitors(NULL);
return (int)mons[monitor].mode.refreshRate; return (int)mons[monitor].mode.refreshRate;
} }
@ -723,7 +724,7 @@ int GetMonitorRefreshRate(int monitor)
// Get the human-readable, UTF-8 encoded name of the selected monitor // Get the human-readable, UTF-8 encoded name of the selected monitor
const char *GetMonitorName(int monitor) const char *GetMonitorName(int monitor)
{ {
RGFW_monitor *mons = RGFW_getMonitors(); RGFW_monitor *mons = RGFW_getMonitors(NULL);
return mons[monitor].name; return mons[monitor].name;
} }
@ -1320,6 +1321,13 @@ int InitPlatform(void)
platform.window = RGFW_createWindow(CORE.Window.title, RGFW_RECT(0, 0, CORE.Window.screen.width, CORE.Window.screen.height), flags); platform.window = RGFW_createWindow(CORE.Window.title, RGFW_RECT(0, 0, CORE.Window.screen.width, CORE.Window.screen.height), flags);
platform.mon.mode.area.w = 0; platform.mon.mode.area.w = 0;
if (platform.window != NULL)
{
// NOTE: RGFW's exit key is distinct from raylib's exit key (which can
// be set with SetExitKey()) and defaults to Escape
platform.window->exitKey = RGFW_keyNULL;
}
#ifndef PLATFORM_WEB_RGFW #ifndef PLATFORM_WEB_RGFW
RGFW_area screenSize = RGFW_getScreenSize(); RGFW_area screenSize = RGFW_getScreenSize();
CORE.Window.display.width = screenSize.w; CORE.Window.display.width = screenSize.w;

View File

@ -1264,7 +1264,9 @@ RLAPI void DrawCircleV(Vector2 center, float radius, Color color);
RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version) RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
RLAPI void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse RLAPI void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse
RLAPI void DrawEllipseV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse (Vector version)
RLAPI void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline RLAPI void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline
RLAPI void DrawEllipseLinesV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse outline (Vector version)
RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring
RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle

View File

@ -470,27 +470,39 @@ void DrawCircleLinesV(Vector2 center, float radius, Color color)
// Draw ellipse // Draw ellipse
void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color) void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color)
{
DrawEllipseV((Vector2){ (float)centerX, (float)centerY }, radiusH, radiusV, color);
}
// Draw ellipse (Vector version)
void DrawEllipseV(Vector2 center, float radiusH, float radiusV, Color color)
{ {
rlBegin(RL_TRIANGLES); rlBegin(RL_TRIANGLES);
for (int i = 0; i < 360; i += 10) for (int i = 0; i < 360; i += 10)
{ {
rlColor4ub(color.r, color.g, color.b, color.a); rlColor4ub(color.r, color.g, color.b, color.a);
rlVertex2f((float)centerX, (float)centerY); rlVertex2f(center.x, center.y);
rlVertex2f((float)centerX + cosf(DEG2RAD*(i + 10))*radiusH, (float)centerY + sinf(DEG2RAD*(i + 10))*radiusV); rlVertex2f(center.x + cosf(DEG2RAD*(i + 10))*radiusH, center.y + sinf(DEG2RAD*(i + 10))*radiusV);
rlVertex2f((float)centerX + cosf(DEG2RAD*i)*radiusH, (float)centerY + sinf(DEG2RAD*i)*radiusV); rlVertex2f(center.x + cosf(DEG2RAD*i)*radiusH, center.y + sinf(DEG2RAD*i)*radiusV);
} }
rlEnd(); rlEnd();
} }
// Draw ellipse outline // Draw ellipse outline
void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color) void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color)
{
DrawEllipseLinesV((Vector2){ (float)centerX, (float)centerY }, radiusH, radiusV, color);
}
// Draw ellipse outline
void DrawEllipseLinesV(Vector2 center, float radiusH, float radiusV, Color color)
{ {
rlBegin(RL_LINES); rlBegin(RL_LINES);
for (int i = 0; i < 360; i += 10) for (int i = 0; i < 360; i += 10)
{ {
rlColor4ub(color.r, color.g, color.b, color.a); rlColor4ub(color.r, color.g, color.b, color.a);
rlVertex2f(centerX + cosf(DEG2RAD*(i + 10))*radiusH, centerY + sinf(DEG2RAD*(i + 10))*radiusV); rlVertex2f(center.x + cosf(DEG2RAD*(i + 10))*radiusH, center.y + sinf(DEG2RAD*(i + 10))*radiusV);
rlVertex2f(centerX + cosf(DEG2RAD*i)*radiusH, centerY + sinf(DEG2RAD*i)*radiusV); rlVertex2f(center.x + cosf(DEG2RAD*i)*radiusH, center.y + sinf(DEG2RAD*i)*radiusV);
} }
rlEnd(); rlEnd();
} }