Blame view

stim/ui/progressbar.h 771 Bytes
cbce396e   David Mayerich   added support for...
1
2
3
  #ifndef RTS_PROGRESSBAR_H

  #define RTS_PROGRESSBAR_H

  

a47a23a9   dmayerich   added ENVI functions
4
5
6
7
  #include <iostream>

  #include <sstream>

  using namespace std;

  

cbce396e   David Mayerich   added support for...
8
  static void rtsProgressBar(unsigned int percent)

a47a23a9   dmayerich   added ENVI functions
9
  {

cbce396e   David Mayerich   added support for...
10
  	//std::cout<<percent<<std::endl;

a47a23a9   dmayerich   added ENVI functions
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  	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

cbce396e   David Mayerich   added support for...
29
  	cout.flush();

a47a23a9   dmayerich   added ENVI functions
30
31
32
  	x++; // increment to make the slash appear to rotate

  	if(x == 4)

  	x = 0; // reset slash animation

cbce396e   David Mayerich   added support for...
33
34
35
  }

  

  #endif