Shellminator V3.0.1
Simple Terminal
|
Sometimes, a process takes longer than just a blink of an eye. In such cases, it's helpful to have a progress bar to show how things are going. Creating a progress bar is super easy with the ShellminatorProgress class. You can find it in this library:
First, create an object from the ShellminatorProgress class:
Whenever you want to update the progress bar, simply use the setPercentage method. This method takes a single argument, which should be a percentage between 0 and 100.0. For example, to set the progress to 50%, you would write:
To actually display the progress bar, just like in the previous example, use the beginScreen method:
To make the demo more interesting, the progress bar continuously counts up and down. This is achieved using a non-blocking timer inside the loop section.