New progressbar which is more smoth
This commit is contained in:
@@ -101,12 +101,31 @@ static inline void loadbar(unsigned int x, unsigned int n, unsigned int w = 50,
|
||||
|
||||
float ratio = x / (float) n;
|
||||
unsigned int c = (ratio * w);
|
||||
std::cout << std::setw(3) << round(ratio * 100) << "% [";
|
||||
float rest = (ratio * w) - c;
|
||||
std::cout << std::setw(3) << round(ratio * 100) << "% |";
|
||||
for (unsigned int x = 0; x < c; x++)
|
||||
std::cout << "=";
|
||||
for (unsigned int x = c; x < w; x++)
|
||||
std::cout << "█";
|
||||
|
||||
if(rest > 0 && rest < 0.125)
|
||||
std::cout << " ";
|
||||
std::cout << "]\r" << std::flush;
|
||||
if(rest >= 0.125 && rest < 2*0.125)
|
||||
std::cout << "▏";
|
||||
if(rest >= 2*0.125 && rest < 3*0.125)
|
||||
std::cout << "▎";
|
||||
if(rest >= 3*0.125 && rest < 4*0.125)
|
||||
std::cout << "▍";
|
||||
if(rest >= 4*0.125 && rest < 5*0.125)
|
||||
std::cout << "▌";
|
||||
if(rest >= 5*0.125 && rest < 6*0.125)
|
||||
std::cout << "▋";
|
||||
if(rest >= 6*0.125 && rest < 7*0.125)
|
||||
std::cout << "▊";
|
||||
if(rest >= 7*0.125 && rest < 8*0.125)
|
||||
std::cout << "▉";
|
||||
|
||||
for (unsigned int x = c; x < (w-1); x++)
|
||||
std::cout << " ";
|
||||
std::cout << "|\r" << std::flush;
|
||||
}
|
||||
|
||||
//TODO : Move to debug manager
|
||||
|
||||
Reference in New Issue
Block a user