Skip to content

Conversation

Jopestpe
Copy link
Contributor

@Jopestpe Jopestpe commented Oct 2, 2025

Description

  • Adds a basic recursive tree example with GUI controls, showing:
  • Recursive branching with adjustable angle, thickness, and decay
  • Optional Bezier-style branches
  • Real-time modification via GUI sliders and checkbox

Changelog

  • Added examples/shapes/shapes_recursive_tree.c - example code
  • Added examples/shapes/shapes_recursive_tree.png - screenshot
  • Updated Makefile, README.md, and examples_list.txt

Tested and compiles successfully on Linux
shapes_recursive_tree

@raysan5 raysan5 changed the title ADDED: example: shapes_recursive_tree [examples] Add shapes_recursive_tree Oct 2, 2025
@raysan5 raysan5 changed the title [examples] Add shapes_recursive_tree [examples] Added shapes_recursive_tree Oct 5, 2025
Vector2 initialEnd = CalculateBranchEnd(start, 0.0f, length);
branches[count++] = (Branch){start, initialEnd, 0.0f, length};

for (int i = 0; i < count; i++) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, could you review it to follow raylib code conventions with aligned brackets?


float nextLength = branch.length * branchDecay;

if (count < maxBranches && nextLength >= 2) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, could you review it to follow raylib code conventions with aligned brackets?


ClearBackground(RAYWHITE);

for (int i = 0; i < count; i++) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, could you review it to follow raylib code conventions with aligned brackets?

return 0;
}

static Vector2 CalculateBranchEnd(Vector2 start, float angle, float length) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, could you review it to follow raylib code conventions with aligned brackets?


InitWindow(screenWidth, screenHeight, "raylib [shapes] example - shapes recursive tree");

Vector2 start = { (screenWidth / 2.0f) - 125, screenHeight };
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, could you review to follow raylib code conventions?

{
// Update
//----------------------------------------------------------------------------------
float theta = angle * DEG2RAD;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, could you review to follow raylib code conventions?


static Vector2 CalculateBranchEnd(Vector2 start, float angle, float length) {
return (Vector2){
start.x + length * sinf(angle),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, could you review to follow raylib code conventions?

@raysan5
Copy link
Owner

raysan5 commented Oct 6, 2025

@Jopestpe Looks very good, just reviewed some minor format tweaks, to follow raylib code conventions. Thanks!

@Jopestpe
Copy link
Contributor Author

Jopestpe commented Oct 6, 2025

I think nothing will escape the conventions now 😅

@raysan5 raysan5 merged commit b99a6cc into raysan5:master Oct 6, 2025
16 checks passed
@raysan5
Copy link
Owner

raysan5 commented Oct 6, 2025

@Jopestpe great! thanks! 👍😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants