feat: add setshape to change the cursor to a turtle shape - #244
Merged
Conversation
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
approved these changes
Aug 30, 2026
jrincayc
left a comment
Owner
There was a problem hiding this comment.
Reviewed code, tested code, approve.
Contributor
Author
|
Thanks for the review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
I'm not attached to the exact shape - I just wanted something that looks like a turtle and aimed for relatively few points.