Skip to content
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

Added new typewriter effect #264

Closed
wants to merge 2 commits into from

Conversation

mjip
Copy link

@mjip mjip commented Jul 14, 2020

Issues fixed by this PR

Closes #263

What does this implement/fix?

Any other comments?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 97.329% when pulling 651134b on mjip:left-to-right-effect into 476159c on peterbrittain:master.

@peterbrittain
Copy link
Owner

Thanks. I just tried running it live and it didn't do what I expected... I think there are a couple of bugs and some possible improvements we could make here. I'll try to add some comments to the code to explain.

@peterbrittain
Copy link
Owner

Hope that all makes sense... Do you think you can make those changes?

@mjip
Copy link
Author

mjip commented Jul 14, 2020

For sure. Document the issues you see here, and I'll try writing up some more extensive examples to look at on my end (I was using a SpeechBubble static renderer)

@peterbrittain
Copy link
Owner

Thanks. Detailed comments are in the review. Main bug I saw was that the first column of text was offset from the rest on my test. Hope that helps!

@mjip
Copy link
Author

mjip commented Jul 15, 2020

Thanks for taking the time to review! Only, I can't seem to find it- have you published it yet? This could also perhaps be one of the Github redesign's quirks

Copy link
Owner

@peterbrittain peterbrittain left a comment

Choose a reason for hiding this comment

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

Maybe this review needs submitting... Let's see if this works.

"""

def __init__(self, screen, renderer, y, colour, **kwargs):
"""
Copy link
Owner

Choose a reason for hiding this comment

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

It might also be good to offer a couple more options in here.

  1. Speed - people have their own feelings on how fast these effects should run, so we should probably take a speed option that simply affects how often we run the update. Simply remember here and update line 435 to use the speed instead of "2".
  2. Line by line - some poeple might use this effect to draw standard text one character at a time. It would be good if we could offer that as an option too.

return

y = self._y
j = self._rendered_y
Copy link
Owner

Choose a reason for hiding this comment

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

This isn't right. You use it to access line[j], which means it is the X offset within the text you want to display, not anything to do with the Y coordinates. I suspect that you want to maintain a counter of where you are in the text instead.

Comment on lines +443 to +446
if self._rendered_x == 0:
x = (self._screen.width - len(line)) // 2
else:
x = self._rendered_x
Copy link
Owner

Choose a reason for hiding this comment

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

Right now you don't have to do this for every iteration in the loop. You could do it once outside. This would change if we implement the line, by line typewriter option, though.

colours[i][j][1])
else:
self._screen.print_at(line[j], x, y, self._colour)
x += 1
Copy link
Owner

Choose a reason for hiding this comment

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

You shouldn't be incrementing x inside the loop that is displaying a single vertical line of the text. This only works because you current recalculate x earlier in the loop.

@peterbrittain
Copy link
Owner

@mjip Any luck with those changes?

@mjip
Copy link
Author

mjip commented Jul 29, 2020

I haven't had the time to take a look lately, but I'm hoping to revisit it next week. Thanks for the review though!

@stale
Copy link

stale bot commented Nov 21, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 21, 2020
@stale stale bot closed this Nov 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Left to right rendering effect
3 participants