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