Skip to content

feat: add setshape to change the cursor to a turtle shape - #244

Merged
jrincayc merged 3 commits into
jrincayc:masterfrom
benjaminpjones:turtle-shape
Aug 30, 2026
Merged

feat: add setshape to change the cursor to a turtle shape#244
jrincayc merged 3 commits into
jrincayc:masterfrom
benjaminpjones:turtle-shape

Conversation

@benjaminpjones

Copy link
Copy Markdown
Contributor

As discussed in #238, I wanted to add a turtle-shaped cursor to UCB logo.

The API follows the setter/getter pattern followed by other commands. The only shapes available are the existing triangle (default) and the turtle.

A small refactor in here: I deduplicate some code between graphics.c and wxTurtleGraphics - the turtle-drawing code was defined in both places because the XOR drawing is not well supported with wx.

Screenshot 2026-08-16 at 11 05 16 AM Screenshot 2026-08-16 at 11 05 45 AM

I'm not attached to the exact shape - I just wanted something that looks like a turtle and aimed for relatively few points.

The logic is duplicated between graphics.c and wxTurtleGraphics.cpp.
This is because the graphics.c path relies on XOR drawing, but this is
not well supported in wx.

This commit relocates the logic to turtleshape.c, where we will eventually
support more shapes such as a real turtle.

Additionally, we remove a couple turtle-related macros in the other graphics
backend files.
Many modern Logo implementations make the turtle look like a turtle
instead of a triangle.  This commit adds the ability to change the
shape of the cursor dynamically.

Follows the setter and getter pattern (setshape/shape) and adds
docs.

We also remove turtle_height macro now that turtle_shape_extent()
is used.

@jrincayc jrincayc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed code, tested code, approve.

@jrincayc
jrincayc merged commit ebb9c42 into jrincayc:master Aug 30, 2026
1 check passed
@benjaminpjones
benjaminpjones deleted the turtle-shape branch August 30, 2026 15:36
@benjaminpjones

Copy link
Copy Markdown
Contributor Author

Thanks for the review!

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