Blame view

ui/progressbar.h 705 Bytes
a47a23a9   dmayerich   added ENVI functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  #ifndef RTS_PROGRESSBAR_H
  #define RTS_PROGRESSBAR_H
  
  #include <iostream>

  #include <sstream>

  using namespace std;

  

  static void rtsProgressBar(int percent)

  {

  	stringstream bar;

  	static int x = 0;

  	string slash[4];

  	slash[0] = "\\";

  	slash[1] = "-";

  	slash[2] = "/";

  	slash[3] = "|";

  	bar<<"[";

  	for(int i=0; i<40; i++)

  	{

  		if(percent > (float)i/(float)40 *100)

  			bar << "*";

  		else

  			bar << " ";

  	}

  	bar<<"]";

  	cout << "\r"; // carriage return back to beginning of line

  	cout << bar.str() << " " << slash[x] << " " << percent << " %"; // print the bars and percentage

  	x++; // increment to make the slash appear to rotate

  	if(x == 4)

  	x = 0; // reset slash animation

  }
  
  #endif