-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draw dashed line #2337
base: main
Are you sure you want to change the base?
Draw dashed line #2337
Conversation
2c66700
to
8644b82
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is progressing nicely. Still needs tests as the To do list indicates.
I've also noticed that the segments in a line can be drawn with different top/bottom angles to one another. Like so:
Which is not a particularly terrible problem.
I guess you could extend it to take a list of lengths which would make up a repeating pattern of segment lengths (counting the spaces as segments). See:
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash
for inspiration.
Will revive this soon, I promise |
…into draw_dotted_line
I think this is a problem with |
I will leave a comment so the discussion in #general isn't lost.
|
const double total_length = sqrt(dx * dx + dy * dy); | ||
if (total_length == 0) { | ||
return pgRect_New4(start_x, start_y, 0, 0); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About my latest comment, to add the second approach of the first problem, this snipped seems to do the trick:
if (delay_gap > total_length) {
delay_gap = delay_gap % (int)total_length;
}
TODO: