Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use math.log10() to find digits in note counts
In 5316b92, I added support for the StepStats side pane in Gameplay to accommodate more than 4 digits of notes. If the total note count for a song is >= 9999, 4 digits will be used (and leftpadded with 0s as needed), and the display will grow to accommodate extra digits as needed. For example: • "Last Trip" has 22897 notes and needs 5 digits • "140 BPM Stamina Killer" has over 100k notes and needs 6 digits • "1 week of 100 BPM Stream" has over 4M notes and needs 7 digits The previous implementation used a while loop, division, and math.pow() to count digits. This was probably fine since this calculation would only be performed once, prior to Init, but I'd also failed to remember that I needed the same calculation elsewhere in the same file, and was using a very sloppy (number -> string -> number) cast there. This commit changes both of those to use the more standard math.log10() approach of determining digits in base-10. It is currently unclear what performance impact this might have, or how I might even assess that. I still need to handle positioning and zooming of the BitmapText when Center1Player is in effect, but that is a different matter.
- Loading branch information
4a65329
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.
The commit message here contains a misleading typo.
If the total note count for a song is >= 9999
should have readIf the total note count for a song is <= 9999
. Apologies for the confusion.