diff options
| author | Ray <[email protected]> | 2023-11-07 19:25:49 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2023-11-07 19:25:49 +0100 |
| commit | f01d3db7398037ce4a60da4d4ea9582b07834f96 (patch) | |
| tree | dfca5ae5fdae061f7551aaff5daa3cd5d9992943 /examples/shapes/shapes_lines_bezier.c | |
| parent | c69e1c379b09f02902b7b4a2ee8e5a0683670345 (diff) | |
| download | raylib-f01d3db7398037ce4a60da4d4ea9582b07834f96.tar.gz raylib-f01d3db7398037ce4a60da4d4ea9582b07834f96.zip | |
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-
Diffstat (limited to 'examples/shapes/shapes_lines_bezier.c')
| -rw-r--r-- | examples/shapes/shapes_lines_bezier.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/shapes/shapes_lines_bezier.c b/examples/shapes/shapes_lines_bezier.c index 7d7bdb0c..5bd916ee 100644 --- a/examples/shapes/shapes_lines_bezier.c +++ b/examples/shapes/shapes_lines_bezier.c @@ -30,7 +30,7 @@ int main(void) Vector2 end = { (float)screenWidth, (float)screenHeight }; Vector2 startControl = { 100, 0 }; - Vector2 endControl = { (float)GetScreenWidth() - 100, (float)GetScreenHeight() }; + Vector2 endControl = { GetScreenWidth() - 100, GetScreenHeight() }; SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -60,9 +60,11 @@ int main(void) DrawText("USE MOUSE LEFT-RIGHT CLICK to DEFINE LINE START and END POINTS", 15, 20, 20, GRAY); - //DrawLineBezier(start, end, 2.0f, RED); + // Draw line cubic-bezier, in-out interpolation (easing), no control points + DrawLineBezier(start, end, 3.0f, BLUE); - DrawLineBezierCubic(start, end, startControl, endControl, 2.0f, RED); + // Draw spline cubic-bezier with control points + DrawSplineBezierCubic(start, startControl, endControl, end, 2.0f, RED); DrawLineEx(start, startControl, 1.0, LIGHTGRAY); DrawLineEx(end, endControl, 1.0, LIGHTGRAY); |
