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.
Hi!
This fixes #3 :-)
This is the commit that changes the game logic:
4bc8fc4
The rest of the commits are mainly from running Clippy and Rustformatter on the project and finding some places to improve readability. These changes might be more preference based and might not match what you've intended. Let me know if that's the case, and I can remove the changes that don't match with the project vision. 😄
For the game logic itself, there's a limitation in ncurses, in so that it is not able to detect when the user keeps the key down by themselves. In order to do a reliable speed-up on keypress, another library for interacting with the terminal would be needed. For example
tui-rs
orcrossterm
, but that's a major refactor.So what I ended up doing was effectively setting the speed to be 25 instead of 100 when the user presses down a key for longer, and when it stops pressing it, the getch function will match on Err() and set the speed back to 1. This is sort of a "hack", and it doesn't look incredibly pretty in my terminal, but it works! 😄