Commit Graph

91 Commits

Author SHA1 Message Date
Ray
8f32c502a7 REVIEWED: Code sections definition 2025-09-02 12:10:40 +02:00
Ray
570082deba WARNING: **NEW** raylib code CONVENTION: Comments do not end with '.' 2025-08-07 18:23:20 +02:00
Ray
714de02a88 Merge pull request #4980 from williewillus/pr4980
[rshapes] Fix incorrect parameter names in DrawRectangleGradientEx
2025-06-02 18:37:34 +02:00
Vincent Lee
19ae6f2c2d [rshapes] Fix incorrect parameter names in DrawRectangleGradientEx
Examining the code shows that the rectangle is drawn winding counterclockwise, starting
with the top left. Therefore the colors used should be in the order: topLeft, bottomLeft,
bottomRight, topRight.

However, the variables actually being used are topLeft, bottomLeft, topRight,
bottomRight. I was confused by this as I was getting striping where I didn't expect any.
Put another way, the last two parameters are misnamed.

This diff swaps the parameter names and their usages. The result is that no runtime
behaviour changes: the same parameter order yields the same visual result both before and
after this change, but the parameter names now correctly reflect what they are actually
used for.

You can actually see this in the implementation of DrawRectangleGradientV, which
(correctly) passes top, bottom, bottom, top to DrawRectangleGradientEx.
2025-05-31 23:00:40 -07:00
Meowster
6d5aedbd38 Add DrawEllipseV and DrawEllipseLinesV 2025-05-29 07:10:52 -04:00
Ray
266fba1111 Minor tweaks 2025-03-21 17:07:55 +01:00
Myrddin Krustowski
589ad0a33d Add early return to circle sector functions when angles are equal.
Prevents unnecessary work and division by zero (when segments=0) in DrawCircleSector/DrawCircleSectorLines when startAngle equals endAngle, matching existing behavior in DrawRing/DrawRingLines.
2025-03-18 11:51:58 +02:00
vict-Yang
b49c079b1d Fix typo in rshapes.c (#4772) 2025-02-16 15:43:32 +01:00
tea☆
1cdf3bb791 [rshapes] Allow DrawRectangleRounded() to draw rectangles with a size < 1 (#4683)
Closes #4673
2025-01-12 18:46:49 +01:00
Ray
49b905077d remove trailing spaces 2025-01-11 19:36:26 +01:00
Le Juez Victor
b554b53ede fix pixel offset issue with DrawRectangleLines (#4669) 2025-01-10 17:36:52 +01:00
Le Juez Victor
ddd86a3387 [rshapes] Fix pixel offset issue with line drawing (#4666)
* fix pixel offset issue with `DrawRectangleRoundedLinesEx`

* improve fix - (pixel offset issue with `DrawRectangleRoundedLinesEx`)

* revert radius tweak (`DrawRectangleRoundedLines`)
2025-01-09 00:07:59 +01:00
Ray
fa0eada61a Update year to 2025 2025-01-01 00:02:52 +01:00
Ray
16368cd353 REVIEWED: DrawRectangleLines(), considering view matrix for lines "alignment" 2024-10-24 13:11:39 +02:00
RadsammyT
385187f795 [rshapes] Review DrawRectangleLines() pixel offset (#4261)
* [rshapes] Remove `DrawRectangleLines()`'s + 1 offset

* ... and replace it with a -/+ 0.5 offset divided by current cam's zoom.
2024-10-24 13:08:12 +02:00
Franz
6f4407cb15 Fix typo in rshapes.c (#4421) 2024-10-23 17:04:15 +02:00
Jojaby
c9c830cb97 Fix rectangle width and height check to account for squares (#4382) 2024-10-15 19:04:30 +02:00
Paperdomo101
fa3f73d881 [rshapes] Review DrawGradient color parameter names (#4270)
void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2);
void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2);
void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);
void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4);

Have been changed to:

void DrawCircleGradient(int centerX, int centerY, float radius, Color inner, Color outer);
void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom);
void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right);
void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color topRight, Color bottomRight);
2024-08-21 14:07:52 +02:00
Lázaro Albuquerque
6e644a27fc Change some global variables to have internal linkage (#4252)
* Change some global variables to have internal linkage

* Update rcore.c

* Update rcore.c
2024-08-13 19:16:07 +02:00
Ray
a8240722c6 REVIEWED: CheckCollisionPointRec() 2024-07-07 09:09:34 +02:00
kai-z99
1039e3c1bd [rshapes] Give CheckCollisionPointCircle() its own implementation (#4135)
* remove function call

* fix
2024-07-07 09:05:25 +02:00
Ray
61cfd1afcb Minor tweaks 2024-07-01 13:05:20 +02:00
Ray
1e1061d5c7 REVIEWED: Formatting, follow raylib coding conventions 2024-06-30 11:37:58 +02:00
Ray
17cbc75aa7 REVIEWED: Formatting, follow raylib coding conventions 2024-06-30 11:07:38 +02:00
Ray
4239e66c55 Update rshapes.c 2024-06-25 21:39:43 +02:00
Ray
3e441ae98b REVIEWED: DrawLine() #4075 2024-06-25 16:37:20 +02:00
Ray
385e60dd41 Minor tweaks 2024-06-24 18:41:33 +02:00
Ray
715633e0de REVIEWED: Spline cubic bezier example 2024-06-16 10:41:47 +02:00
Santiago Pelufo
640eaca8bf [rshapes] Fix multisegment Bezier splines. (#3744)
* [rshapes] Fix multisegment Bezier splines.

It seems to me that these functions are wrong, if you step the index by 1 you move to a control point instead of the next segment.

* Fix example shapes/shapes_splines_drawing for bezier splines.

* Draw circles to fill gaps between bezier segments.
2024-06-16 10:21:54 +02:00
kai-z99
fca53c7799 optimize (#4065) 2024-06-14 08:19:17 +02:00
Jeffery Myers
2609211207 [SHAPES] Make functions that draw point arrays take them as const (#4051)
* Update raylib_api.* by CI

* make functions that take a pointer to an array take them as const pointers

* Update raylib_api.* by CI

* fix comment alignment.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-11 11:51:49 +02:00
kai-z99
606cc1d897 [rshapes]Circle line collision function (#4018)
* inital function

* working 1

* optimize

* optimized dot product

* simplify

* cleanup

* cleanup

* cleanup

* comment

* var name change

* epsilon
2024-05-30 08:24:44 +02:00
Ray
763129e96b Reviewed some warnings 2024-05-01 18:12:57 +02:00
Ray
e0027eb767 REVIEWED: DrawLine() to avoid pixel rounding issues #3931 2024-04-28 22:59:35 +02:00
Ray
3caa424ad4 Review formatting 2024-04-21 12:29:09 +02:00
Ray
41b0c5c4f9 REVIEWED: DrawRectangleLines() pixel offset
This could be actually very tricky and GPU/drivers dependant...
2024-04-20 19:58:10 +02:00
Ray
b51f4db8c2 REVIEWED: DrawRectangleLines() #3884
For consistency, now _almost_ all `Draw*Lines()` functions use `RL_LINES` mode for drawing. It solves the linked issue but it can have other implications, as mentioned in the WARNING comment in `DrawRectangleLines()`.

Side note: `DrawRectangleRoundedLines()` now should be reviewed for consistency.
2024-04-20 19:53:59 +02:00
Ray
29ce13b777 Code gardening
- Review formatting
 - Improve readability for some functions result return
 - Minimize early returns
 - Align LoadFileData() to UnloadFileData()
2024-04-20 13:53:13 +02:00
Ray
fea3395fc1 Review formatting 2024-02-29 18:50:44 +01:00
Ray
e42e3188f5 Remove some unneeded line breaks 2024-02-18 11:59:40 +01:00
Ray
dd8b5613ca REVIEWED: DrawPixel() not drawing 2024-02-08 08:45:59 +01:00
Antonio Raúl
ef92ced370 fix CheckCollisionPointPoly (#3750) 2024-01-22 11:35:55 +01:00
Ray
3f1e59a7cf Update copyright to 2024 2024-01-02 20:58:12 +01:00
Jeffery Myers
ad64a43b34 [rshapes] Expose shapes drawing texture and rectangle (#3677)
* provide access to the shape texture so that shapes can be extended outside of raylib with the same optimizations as internal raylib functions.

* PR feedback, comply with C standards

* oops
2023-12-28 15:40:03 +01:00
Ray
f3adde8bbd REVIEWED: DrawSplineLinear() to SUPPORT_SPLINE_MITERS 2023-12-15 18:40:19 +01:00
Toctave
0fc1765ff3 Implement miters in DrawSplineLinear (#3585)
* Implement miters in DrawSplineLinear

* Follow raylib style
2023-12-15 18:34:34 +01:00
ubkp
e84099bfd4 Fix CheckCollisionCircleRec() (#3584) 2023-11-30 10:11:45 +01:00
Ray
bd3ffa7db3 REDESIGNED: Spline drawing functionality
This change allows more versatile and consistent splines drawing. It also gives more control to advance users to draw splines as individual segments.
2023-11-08 17:42:35 +01:00
Ray
f01d3db739 ADDED: GetSplinePoint*() functions for spline evaluation
RENAMED: `DrawLine<spline_type>()` to `DrawSpline<spline_type>()` for more consistent and clear naming
REVIEWED: Bezier drawing parameters order, more consistent
REVIEWED: Spline-based examples -WIP-
2023-11-07 19:25:49 +01:00
Ray
e4547eb422 Remove trail spaces 2023-10-26 23:56:03 +02:00