CPrintProgressBar.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "IProgressBar.h"
5 
6 
7 namespace ion
8 {
9 
11  {
12 
13  public:
14 
15  CPrintProgressBar(int const barLength = 30)
16  : BarLength(barLength)
17  {}
18 
19  protected:
20 
21  void Start()
22  {
23  printf("Progress: \n");
24  }
25 
26  void Render()
27  {
28  int IntegerProgress = (int) (100 * Progress);
29  if (IntegerProgress != LastProgress)
30  {
31  printf("\r");
32  printf("%3d%% :[", IntegerProgress);
33  int i = 0;
34  for (; i < IntegerProgress * BarLength / 100; ++ i)
35  printf("%c", 0xB2);
36  for (; i < BarLength; ++ i)
37  printf("%c", 0xB0);
38  printf("]");
39  }
40  LastProgress = IntegerProgress;
41  }
42 
43  void Finish()
44  {
45  printf("\n");
46  }
47 
48  int LastProgress = -1;
49  int BarLength;
50 
51  };
52 
53 }
Definition: CPrintProgressBar.h:10
CPrintProgressBar(int const barLength=30)
Definition: CPrintProgressBar.h:15
void Render()
Definition: CPrintProgressBar.h:26
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
int BarLength
Definition: CPrintProgressBar.h:49
int LastProgress
Definition: CPrintProgressBar.h:48
void Finish()
Definition: CPrintProgressBar.h:43
float Progress
Definition: IProgressBar.h:49
void Start()
Definition: CPrintProgressBar.h:21
Definition: IProgressBar.h:10