Commit Graph

130 Commits

Author SHA1 Message Date
Matthew Roush
9beca068b9 [rshapes] Fix drawing circle sectors (#6045)
* [rshapes] Fix drawing circle sectors

Functions that draw a sector of a circle would keep drawing segments past a full rotation, which looked bad.

* [rshapes] Change `DrawCircleSectorLines()` and `DrawRingLines()`

`DrawCircleSectorLines()` and `DrawRingLines()` drew the cap lines even when drawing a full circle, which seems undesirable.
2026-08-10 14:51:59 +02:00
Matthew Roush
37712a8fbe [rshapes] Fix Draw*LinesEx() functions' inconsistent handling of thick parameter. (#6035)
* [rshapes] Update `DrawRectangleLinesEx()`

Add support for negative `thick` values. When `thick` is negative, lines are drawn growing outside of the rectangle.

* [rshapes] Update `DrawPolyLinesEx()`

Add support for negative `thick` values. When `thick` is negative, lines are drawn growing outside of the polygon. Also refactored to explicitly use an `outerRadius` variable instead of using `radius` as the outer radius.

* [rshapes] Update `DrawRectangleRoundedLinesEx()`

Make the outline vertices easier to work with.

* [rshapes] Updated `DrawRectangleRoundedLinesEx()`.

Lines used to draw outside when `thick` was positive. Added support for negative `thick` values. When `thick` is negative, lines are drawn growing outside of the rectangle.

* [rshapes] Update `DrawRectangleRoundedLines()`.

Make the formatting of the points' x and y coordinates in DrawRectangleRoundedLines() match DrawRectangleRoundedLinesEx().
2026-08-04 18:04:56 +02:00
Ray
63f82f0ca8 REVIEWED: DrawRectangleLinesEx(), avoid early-return
NOTE: raylib data validation policy defines not to validate any data that does not suppose a crash in the program, letting user manage that layer... probably several functions should be carefully reviewed or the policy itself...
2026-07-29 10:10:26 +02:00
Matthew Roush
9f9c11db41 [rshapes] Fix DrawRectangleLinesEx() (#6027)
Previously DrawRectangleLinesEx() would draw lines overlapping each other when they were thick enough (which was only noticeable if the color's alpha was lower than 255.)
2026-07-29 10:03:22 +02:00
Matthew Roush
c15f3214d5 [rshapes] Correct DrawPolyLinesEx() line thickness. (#6014)
Follow up to #6004. The previous formula would produce inconsistent results for different polygons with the same `thick` parameter.
2026-07-24 21:38:50 +02:00
Matthew Roush
127e7441da [rshapes] Fix DrawPolyLinesEx() (#6004)
If `innerRadius` is less than 0, it causes the outline to overlap itself and even grow outside of the polygon's bounds when `thick` is greater than `radius`. Clamping `innerRadius` to 0 fixes these problems.
2026-07-23 09:50:11 +02:00
Matthew Roush
9fd4726c31 [rshapes] Fix DrawRectangleRoundedLines() (#5992)
In #5980 a bug was introduced for `DrawRectangleRoundedLines()`. `DrawRectangleRoundedLines()` previously assumed that `DrawRectangleRoundedLinesEx()` uses `RL_LINES` when line thickness is 1 (which is no longer true, it now uses `RL_QUADS` or `RL_TRIANGLES`.)

I copy/pasted the previous `DrawRectangleRoundedLinesEx()` implementation and trimmed it down (since now the line thickness is always 1), so now `DrawRectangleRoundedLines()` uses `RL_LINES`. This makes it consistent with all other `Draw*Lines()` functions, which use `RL_LINES`.
2026-07-21 17:46:22 +02:00
Samael Heaven
39706cccbe [rshapes] Fix DrawRectangleRoundedLinesEx not scaling with transform when thick=1 (#5980) 2026-07-15 21:20:18 +02:00
Ray
ca0ba55050 Reviewed parameter names, added comment about order 2026-06-07 21:26:32 +02:00
Ray
236618f87b Reorder functions by drawing vertex/sides 2026-06-07 21:06:53 +02:00
Ray
d3d1b0cbcc ADDED: DrawCircleLinesEx(), simpler naming than DrawRing() 2026-06-07 18:48:16 +02:00
Ray
869251e590 REVIEWED: Parameter name, shorter 2026-06-07 18:42:50 +02:00
Ray
15d25242be REVIEWED: Comments to be more descriptive 2026-06-07 18:41:44 +02:00
Ray
cef7718468 RENAMED: Some Rectangle parameters with more descriptive names 2026-06-03 20:16:12 +02:00
ghera
f65d5ad7a9 rshapes: fix auto segment rounded-corner math and rounding (#5883) 2026-05-24 08:55:08 +02:00
Anstro Pleuton
d31c10a01e Adjust segment calculation in DrawRectangleRounded to be consistent with DrawRectangleRoundedLinesEx (#5875) 2026-05-19 18:48:28 +02:00
Ray
61537200c0 Code cleaning 2026-05-07 15:18:42 +02:00
Ray
98efce4b0d WARNING: RENAMED: GetSplinePointBezierQuad() to GetSplinePointBezierQuadratic()
Consistent with similar spline functions and avoid confusion with `Quad` related functions.
2026-04-27 11:47:48 +02:00
Ray
636269f6af ADDED: DrawTriangleGradient() 2026-04-27 11:37:48 +02:00
Ray
06621eb3b7 REVIEWED: Comments for consistency and spelling 2026-04-27 11:34:58 +02:00
bielern
c2ea6a38b5 Fix: Add NULL check to CheckCollisionLines (#5802) 2026-04-25 19:53:34 +02:00
Ray
96e30549f5 Align default values on comments for config variables 2026-04-16 00:05:23 +02:00
Thomas Anderson
0decdcd497 update defines for new format etc (#5760) 2026-04-15 12:20:51 +02:00
Thomas Anderson
4628915787 Update typos/grammar (#5759) 2026-04-15 09:18:30 +02:00
Ray
05a14456ae REDESIGNED: DrawCircleGradieent() to use Vector2 as center parameter #5738 2026-04-09 11:16:31 +02:00
Ray
da93ec4a21 Remove trailing spaces 2026-03-29 01:17:25 +01:00
Ray
8c44ea5032 Code gardening
REVIEWED: Some early returns, avoid if possible
REVIEWED: Some return variable names, for consistency, rename `success` to `result`
2026-03-29 00:37:01 +01:00
Ray
faf42366ec Code gardening 2026-03-04 01:14:26 +01:00
Ray
b4746469d4 Formating review, using imperative mode in comments 2026-03-03 22:40:34 +01:00
Ray
5361265a7d WARNING: BREAKING: REDESIGNED: raylib build features config system #4411 #4554
Redesigned to support disabling features on compilation with `-DSUPPORT_FEATURE=0`
REMOVED: `SUPPORT_DEFAULT_FONT`, always supported
REMOVED: `SUPPORT_IMAGE_MANIPULATION `, always supported
REMOVED: `SUPPORT_TEXT_MANIPULATION`, always supported
REDESIGNED: `SUPPORT_FONT_ATLAS_WHITE_REC` to `FONT_ATLAS_CORNER_REC_SIZE`
REVIEWED: Config values (other than 0-1) are already defined on respective modules
Other config tweaks here and there
2026-02-26 08:19:28 +01:00
Ray
4f76b896d5 REVIEWED: CheckCollisionLines(), formating and follow raylib conventions 2026-02-06 10:55:42 +01:00
bielern
3881d2aac2 Fix: Detect collision if one line is almost vertical (#5510) (#5531) 2026-02-05 19:21:45 +01:00
Ray
29896a2403 REVIEWED: Some comments (Code Gardening) 2026-01-19 12:40:32 +01:00
Ray
0c33c603f4 REVIEWED: EXTERNAL_CONFIG_FLAGS usage, check moved to config.h
Due to `utils` module removal, `EXTERNAL_CONFIG_FLAGS` was not working, so the system was redesigned.
This change is independent of #4411
2026-01-12 13:04:38 +01:00
Ray
416af51a93 Update year to 2026 2026-01-02 13:40:15 +01:00
Ray
e1b9857b14 Some TODOs and format reviews 2025-11-23 21:40:39 +01:00
Ray
74f2a899d9 Update rshapes.c 2025-10-20 19:09:37 +02:00
Ray
7e3b7cd349 REVIEWED: DrawLineDashed() 2025-10-02 13:38:13 +02:00
Luís Almeida
f680776941 feat:Added DrawLineDashed() and a new example explaining how to use this new function. (#5222) 2025-10-01 11:43:38 +02:00
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