Tempo
Tempo is an app that allows users to create and manage timers, stopwatches, and alarms.
Display.cpp
Go to the documentation of this file.
1 #include <windows.h>
2 
3 #include "../include/Display.hpp"
4 
5 
6 
7 using namespace std;
8 
9 const string Display::SELECTED = "\033[1;30;46m";
10 
11 const string Display::BOLD = "\033[1m";
12 
13 const string Display::BLACK = "\033[30m";
14 const string Display::RED = "\033[31m";
15 const string Display::GREEN = "\033[32m";
16 const string Display::YELLOW = "\033[33m";
17 const string Display::BLUE = "\033[34m";
18 const string Display::MAGENTA = "\033[35m";
19 const string Display::CYAN = "\033[36m";
20 const string Display::WHITE = "\033[37m";
21 
22 const string Display::BOLD_BLACK = "\033[1;30m";
23 const string Display::BOLD_RED = "\033[1;31m";
24 const string Display::BOLD_GREEN = "\033[1;32m";
25 const string Display::BOLD_YELLOW = "\033[1;33m";
26 const string Display::BOLD_BLUE = "\033[1;34m";
27 const string Display::BOLD_MAGENTA = "\033[1;35m";
28 const string Display::BOLD_CYAN = "\033[1;36m";
29 const string Display::BOLD_WHITE = "\033[1;37m";
30 
31 /* =========================================================
32 CONSTRUCTOR
33 ========================================================= */
34 
40 {
41  _splash = "";
42  _asciiBuffer = "";
43  _barBuffer = "";
44  _controlBuffer = "";
45  _splitBuffer = "";
46 
47  _oldAscii = "";
48  _oldControls = "";
49  _oldSplash = "";
50  _oldSplits = "";
51 
52  _fonts = {f1_ascii, f2_ascii, f3_ascii, f4_ascii};
53  _fontHeights = {f1_height, f2_height, f3_height, f4_height};
54 
55  setFont(1);
56 
57  _asciiWidth = 0;
58 }
59 
60 /* =========================================================
61 TERMINAL INTERACTION HELPERS
62 ========================================================= */
63 
68 {
69  string clearscreen = "\033[2J\033[H";
70 
71  _oldAscii = "";
72  _oldControls = "";
73  _oldSplash = "";
74  _oldBar = "";
75 
76  fast_print(clearscreen);
77 }
78 
79 void Display::setFont(int num)
80 {
81  _currFont = _fonts.at(num-1);
82 
83  ASCII_HEIGHT = _fontHeights.at(num-1);
84 
85  if(ASCII_HEIGHT >= 8){
86  PADDING = "";
87  for(int i=0; i< ASCII_HEIGHT/4; i++){
88  PADDING += " ";
89  }
90  }
91  else{
92  PADDING = "";
93  }
94 }
95 
101 void Display::setCursor(int row, int col)
102 {
103  string setcursor = "\033[" + to_string(row) + ";" + to_string(col) + "H";
104  fast_print(setcursor);
105 }
106 
111 void Display::clearLine(int row)
112 {
113  string clearline = "\033[K";
114  setCursor(row, 1);
115  fast_print(clearline);
116 }
117 
123 template <typename char_type>
124 auto Display::fast_print(const std::basic_string<char_type> &sss) -> void
125 {
126  HANDLE const output_handle = GetStdHandle(STD_OUTPUT_HANDLE);
127  const auto char_count = static_cast<DWORD>(sss.length());
128  if constexpr (std::is_same_v<char_type, char>)
129  WriteConsoleA(output_handle, sss.c_str(), char_count, nullptr, nullptr);
130  else
131  WriteConsoleW(output_handle, sss.c_str(), char_count, nullptr, nullptr);
132 }
133 
138 void Display::setFormat(const string& code) {
139  _oldFormatting = _formatting;
140  _formatting = code;
141  fast_print(_formatting);
142 }
143 
148  _oldFormatting = _formatting;
149  _formatting = "\033[0m";
150 
151  fast_print(_formatting);
152 }
153 
154 /* =========================================================
155 SPLASH TEXT HELPERS
156 ========================================================= */
157 
162 void Display::setSplash(string str)
163 {
164  _splash = "<< " + str + " >>";
165 }
166 
171 {
172  _splash = "";
173 }
174 
175 /* =========================================================
176 STAGE TIMER IN ASCII
177 ========================================================= */
178 
186 void Display::stageTimerDisplay(int hours, int minutes, int seconds, int tenths)
187 {
188  string to_print = "";
189 
190  // Only display hours if there is at least 1 hour left
191  if (hours != 0)
192  {
193  to_print += to_string(hours) + ":";
194  }
195 
196  // Add leading zero to minutes if needed
197  if (int(minutes / 10) != 0)
198  {
199  to_print += to_string(minutes) + ":";
200  }
201  else
202  {
203  to_print += "0" + to_string(minutes) + ":";
204  }
205 
206  // Add leading zero to seconds if needed
207  if (int(seconds / 10) != 0)
208  {
209  to_print += to_string(seconds);
210  }
211  else
212  {
213  to_print += "0" + to_string(seconds);
214  }
215 
216  // Build the ASCII art for the timer display
217  for (int i = 0; i < ASCII_HEIGHT; i++)
218  {
219  string line;
220  for (char ch : to_print)
221  {
222  if (ch == ':')
223  {
224  line += _currFont.at(10)[i]; // Colon character
225  line += PADDING;
226  }
227  else if (ch == '.')
228  {
229  line += _currFont.at(11)[i]; // Period character
230  line += PADDING;
231  }
232  else
233  {
234  line += _currFont.at(ch - '0')[i]; // Numeric character
235  line += PADDING;
236  }
237  }
238  _asciiWidth = line.length(); // Update ASCII width
239  _asciiBuffer += (line + "\n");
240  }
241 }
242 
247 void Display::stageAlarmDisplay(string time){
248 
249  string to_print = "";
250 
251  int hours = stoi(time.substr(0,2));
252  int minutes = stoi(time.substr(3,2));
253 
254  // Determine AM/PM and convert 24-hour format to 12-hour format
255  string period = (hours >= 12) ? "pm" : "am";
256  hours = hours % 12; // Convert 24-hour to 12-hour format
257  if (hours == 0) { hours = 12; } // Handle the case where hour is 0 (midnight or noon)
258 
259  to_print += to_string(hours) + ":";
260 
261  // Add leading zero to minutes if needed
262  if (int(minutes / 10) != 0)
263  {
264  to_print += to_string(minutes);
265  }
266  else
267  {
268  to_print += "0" + to_string(minutes);
269  }
270 
271  // Add " am" or " pm"
272  to_print += period;
273 
274 
275  // Build the ASCII art for the alarm display
276  for (int i = 0; i < ASCII_HEIGHT; i++)
277  {
278  string line;
279  for (char ch : to_print)
280  {
281  if (ch == ':')
282  {
283  line += _currFont.at(10)[i];
284  line += PADDING;
285  }
286  else if (ch == 'a')
287  {
288  line += _currFont.at(12)[i];
289  line += PADDING;
290  }
291  else if (ch == 'p')
292  {
293  line += _currFont.at(13)[i];
294  line += PADDING;
295  }
296  else if (ch == 'm')
297  {
298  line += _currFont.at(14)[i];
299  line += PADDING;
300  }
301  else
302  {
303  line += _currFont.at(ch - '0')[i];
304  line += PADDING;
305  }
306  }
307  _asciiWidth = line.length();
308  _asciiBuffer += (line + "\n");
309  }
310 }
311 
316 void Display::stageTimerBar(double percentage)
317 {
318  int width = _asciiWidth - 2;
319  int filled = (int)((percentage / 100) * width);
320 
321  string border = "";
322 
323  // Build the top and bottom borders of the bar
324  border += "+";
325  for (int i = 0; i < width; ++i)
326  {
327  border += "-";
328  }
329  border += "+\n";
330 
331  _barBuffer += border;
332 
333  _barBuffer += "|";
334 
335  // Fill the bar with '#' characters based on the percentage completed
336  for (int i = 0; i < width; ++i)
337  {
338  if (i < filled)
339  {
340  _barBuffer += "#";
341  }
342  else
343  {
344  _barBuffer += " ";
345  }
346  }
347 
348  _barBuffer += "|\n";
349  _barBuffer += border;
350 }
351 
356 void Display::stageAlarmBar(double percentage)
357 {
358  int width = _asciiWidth - 2;
359  int filled = (int)((percentage / 100) * width);
360 
361  string border = "";
362 
363  // Build the top and bottom borders of the bar
364  border += "+";
365  for (int i = 0; i < width; ++i)
366  {
367  border += "-";
368  }
369  border += "+\n";
370 
371  _barBuffer += border;
372 
373  _barBuffer += "|";
374 
375  // Fill the bar with '#' characters based on the percentage completed
376  for (int i = 0; i < width; ++i)
377  {
378  if (i < filled)
379  {
380  _barBuffer += "#";
381  }
382  else
383  {
384  _barBuffer += " ";
385  }
386  }
387 
388  _barBuffer += "|\n";
389  _barBuffer += border;
390 
391 }
392 
396 void Display::stageArt(vector<string> art)
397 {
398  for(int i=0; i<art.size(); ++i){
399  _controlBuffer += (art.at(i) + "\n");
400  }
401 }
402 
403 /* =========================================================
404 STAGE STOPWATCH IN ASCII
405 ========================================================= */
406 
414 void Display::stageStopwatchDisplay(int hours, int minutes, int seconds, int hundredths)
415 {
416  string to_print = "";
417 
418  // Only show hours if there are more than 0
419  if (hours != 0)
420  {
421  to_print += to_string(hours) + ":";
422  }
423 
424  // Show minutes with a leading zero if needed
425  if (hours)
426  {
427  if (int(minutes / 10) != 0)
428  {
429  to_print += to_string(minutes) + ":";
430  }
431  else
432  {
433  to_print += "0" + to_string(minutes) + ":";
434  }
435  }
436  else if (minutes)
437  {
438  to_print += to_string(minutes) + ":";
439  }
440 
441  // Show seconds with a leading zero if needed
442  if (hours || minutes)
443  {
444  if (int(seconds / 10) != 0)
445  {
446  to_print += to_string(seconds);
447  }
448  else
449  {
450  to_print += "0" + to_string(seconds);
451  }
452  }
453  else
454  {
455  to_print += to_string(seconds);
456  }
457 
458  // Show hundredths of a second if there are no hours
459  if (hours == 0)
460  {
461  to_print += ".";
462  if (int(hundredths / 10) != 0)
463  {
464  to_print += to_string(hundredths);
465  }
466  else
467  {
468  to_print += "0" + to_string(hundredths);
469  }
470  }
471 
472  // Build the ASCII art for the stopwatch display
473  for (int i = 0; i < ASCII_HEIGHT; i++)
474  {
475  string line;
476  for (char ch : to_print)
477  {
478  if (ch == ':')
479  {
480  line += _currFont.at(10)[i]; // Colon character
481  line += PADDING;
482  }
483  else if (ch == '.')
484  {
485  line += _currFont.at(11)[i]; // Period character
486  line += PADDING;
487  }
488  else
489  {
490  line += _currFont.at(ch - '0')[i]; // Numeric character
491  line += PADDING;
492  }
493  }
494  _asciiBuffer += (line + "\n");
495  }
496 }
497 
501 void Display::stageStopwatchSplits(vector<int> splits){
502  if (!splits.empty()) {
503  _splitBuffer += " SPLITS:\n\n";
504  int startIdx = (splits.size() > 10) ? splits.size() - 10 : 0;
505  for (int i = startIdx; i < splits.size(); ++i) {
506 
507  int milliseconds = splits.at(i);
508  int hours = milliseconds / 3600000;
509  milliseconds %= 3600000;
510  int minutes = milliseconds / 60000;
511  milliseconds %= 60000;
512  int seconds = milliseconds / 1000;
513  milliseconds %= 1000;
514  int hundredths = milliseconds / 10;
515  string to_print = "";
516 
517  // Only show hours if there are more than 0
518  if (hours != 0) {
519  to_print += to_string(hours) + ":";
520  }
521 
522  // Show minutes with a leading zero if needed
523  if (hours) {
524  if (int(minutes / 10) != 0) {
525  to_print += to_string(minutes) + ":";
526  } else {
527  to_print += "0" + to_string(minutes) + ":";
528  }
529  } else if (minutes) {
530  to_print += to_string(minutes) + ":";
531  }
532 
533  // Show seconds with a leading zero if needed
534  if (hours || minutes) {
535  if (int(seconds / 10) != 0) {
536  to_print += to_string(seconds);
537  } else {
538  to_print += "0" + to_string(seconds);
539  }
540  } else {
541  to_print += to_string(seconds);
542  }
543 
544  // Show hundredths of a second if there are no hours
545  if (hours == 0) {
546  to_print += ".";
547  if (int(hundredths / 10) != 0) {
548  to_print += to_string(hundredths);
549  } else {
550  to_print += "0" + to_string(hundredths);
551  }
552  }
553  string fullprint = "Split " + to_string(i + 1) + ": " + to_print + "\n";
554  _splitBuffer += fullprint;
555  }
556  } else {
557  _splitBuffer = "";
558  }
559 }
560 
561 /* =========================================================
562 PRINTING TO TERMINAL
563 ========================================================= */
564 
569 void Display::printAscii(int row, string formatting)
570 {
571  setFormat(formatting);
572 
573  if (_asciiBuffer != _oldAscii || _formatting != _oldFormatting)
574  {
575  setCursor(row, 1);
576  fast_print(_asciiBuffer);
577  _oldAscii = _asciiBuffer;
578  }
579  _asciiBuffer = "";
580 
581  clearFormat();
582 }
583 
588 void Display::printArt(int row, string formatting)
589 {
590  setFormat(formatting);
591 
592  if (_controlBuffer != _oldControls || _formatting != _oldFormatting)
593  {
594  setCursor(row, 1);
595  fast_print(_controlBuffer);
596  _oldControls = _controlBuffer;
597  }
598  _controlBuffer = "";
599 
600  clearFormat();
601 }
602 
607 void Display::printBar(int row, string formatting)
608 {
609  setFormat(formatting);
610 
611  if (_barBuffer != _oldBar || _formatting != _oldFormatting)
612  {
613  setCursor(row, 1);
614  fast_print(_barBuffer);
615  _oldBar = _barBuffer;
616  }
617  _barBuffer = "";
618 
619  clearFormat();
620 }
621 
626 void Display::printSplash(int row, string formatting)
627 {
628  setFormat(formatting);
629 
630  if (_splash != _oldSplash || _formatting != _oldFormatting)
631  {
632  clearLine(row);
633  setCursor(row, 1);
634  fast_print(_splash);
635  _oldSplash = _splash;
636  }
637 
638  clearFormat();
639 }
640 
645 void Display::printSplits(int row, string formatting)
646 {
647  setFormat(formatting);
648  if (_splitBuffer != _oldSplits || _formatting != _oldFormatting)
649  {
650  setCursor(row, 1);
651  fast_print(_splitBuffer);
652  _oldSplits = _splitBuffer;
653  }
654  _splitBuffer = "";
655 
656  clearFormat();
657 }
658 
663 void Display::tickTimerSetup(string to_print)
664 {
665  auto now = std::chrono::steady_clock::now();
666  auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
667 
668  bool showBar = ((millis / 500) % 2 == 0);
669 
670  _asciiBuffer.clear(); // Clear buffer before filling it with new content
671 
672  for (int i = 0; i < ASCII_HEIGHT; ++i)
673  {
674  string line;
675  for (char ch : to_print)
676  {
677  if (ch == ':')
678  {
679  line += _currFont.at(10)[i]; // Colon character
680  }
681  else
682  {
683  line += _currFont.at(ch - '0')[i]; // Numeric character
684  }
685  line += PADDING;
686  }
687  line += showBar ? " |" : " "; // Append progress bar indicator
688  _asciiWidth = line.length();
689  _asciiBuffer += (line + "\n");
690  }
691  stageArt(_timerSetupControls);
692 
693  printArt(1, BOLD_CYAN);
694  printAscii(5, BOLD_WHITE);
695 
696 
697  setCursor(1,1);
698 
699 }
700 
705 void Display::tickAlarmSetup(string to_print, bool isAM)
706 {
707  auto now = std::chrono::steady_clock::now();
708  auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
709 
710  int tempHeight;
711 
712  bool showBar = ((millis / 500) % 2 == 0);
713  if(ASCII_HEIGHT < 4){
714  tempHeight = 4;
715  }
716  else{
717  tempHeight = ASCII_HEIGHT;
718  }
719  for (int i = 0; i < tempHeight; i++)
720  {
721  string line;
722  line += BOLD_WHITE;
723  for (char ch : to_print)
724  {
725  if (ch == ':')
726  {
727  line += _currFont.at(10)[i]; // Colon character
728  line += PADDING;
729  }
730  else
731  {
732  line += _currFont.at(ch - '0')[i]; // Numeric character
733  line += PADDING;
734  }
735  }
736 
737  if(showBar){
738  line += " | ";
739  }
740 
741  else{
742  line += " ";
743  }
744 
745  int linesLeft = tempHeight - i;
746 
747  if(linesLeft <= 4){
748 
749  line += " ";
750  if(isAM){
751  line += SELECTED;
752  }
753  else{
754  line += BOLD_WHITE;
755  }
756 
757  line += _alarmSetupAM[4-linesLeft];
758 
759  line += "\033[0m";
760 
761  line += " ";
762 
763  if(!isAM){
764  line += SELECTED;
765  }
766  else{
767  line += BOLD_WHITE;
768  }
769 
770  line += _alarmSetupPM[4-linesLeft];
771 
772  line += "\033[0m";
773 
774 
775  }
776 
777  _asciiWidth = line.length(); // Update ASCII width
778  _asciiBuffer += (line + "\n");
779 
780  }
781 
782  stageArt(_alarmSetupControls);
783 
784  printArt(1, BOLD_CYAN);
785 
786  printAscii(5,BOLD_WHITE);
787 
788  /*
789  stageArt(_alarmSetupAM);
790 
791 
792  if(isAM){
793  printArt(ASCII_HEIGHT + 6, SELECTED);
794  stageArt(_alarmSetupPM);
795  printArt(ASCII_HEIGHT + 10, BOLD_WHITE);
796  }
797  else{
798  printArt(ASCII_HEIGHT + 6, BOLD_WHITE);
799  stageArt(_alarmSetupPM);
800  printArt(ASCII_HEIGHT + 10, SELECTED);
801  }
802  */
803 
804  setCursor(1,1);
805 
806 }
807 
813 {
814  auto now = std::chrono::steady_clock::now();
815  auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
816  bool flash = ((millis / 500) % 2 == 0);
817 
818  int remaining = timer.remainingMilliseconds();
819  int hours = remaining / 3600000;
820  remaining %= 3600000;
821  int minutes = remaining / 60000;
822  remaining %= 60000;
823  int seconds = remaining / 1000;
824  remaining %= 1000;
825  int tenths = remaining / 100;
826 
827  stageTimerDisplay(hours, minutes, seconds, tenths);
828  stageTimerBar(timer.percentElapsed());
829  stageArt(_timerControls);
830 
831  string temp;
832  if(!timer.isRunning()){
833  if(timer.isDone() && flash){
834  temp = BOLD_WHITE;
835  }
836  else{
837  temp = BOLD_RED;
838  }
839  }
840  else{
841  temp = BOLD_WHITE;
842  }
843 
844  printAscii(1, temp);
845  printBar(ASCII_HEIGHT+2, temp);
846  printArt(ASCII_HEIGHT+5, BOLD_CYAN);
847  printSplash(ASCII_HEIGHT+8, WHITE);
848 
849  setCursor(1,1);
850 }
851 
857 
858  int milliseconds = stopwatch.currentMilliseconds();
859 
860  int hours = milliseconds / 3600000;
861  milliseconds %= 3600000;
862  int minutes = milliseconds / 60000;
863  milliseconds %= 60000;
864  int seconds = milliseconds / 1000;
865  milliseconds %= 1000;
866  int hundredths = milliseconds / 10;
867 
868  stageStopwatchDisplay(hours, minutes, seconds, hundredths);
869  stageArt(_stopwatchControls);
870  stageStopwatchSplits(stopwatch.getSplits());
871 
872  string temp;
873  if(!stopwatch.isRunning()){
874  if ((stopwatch.currentMilliseconds() / 10) % 100 == 0 && stopwatch.currentMilliseconds() != 0){
875  temp = BOLD_GREEN;
876  }
877  else{
878  temp = BOLD_RED;
879  }
880  }
881  else{
882  temp = BOLD_WHITE;
883  }
884  printAscii(1, temp);
885 
886  printArt(ASCII_HEIGHT+1, BOLD_CYAN);
887  printSplash(ASCII_HEIGHT+4, WHITE);
888  printSplits(ASCII_HEIGHT+6, WHITE);
889 
890  clearFormat();
891  setCursor(1,1);
892 
893 }
894 
900 
901  auto now = std::chrono::steady_clock::now();
902  auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
903  bool flash = ((millis / 500) % 2 == 0);
904 
905  string time = alarm.timeToString(alarm.getEndTime()).substr(0,5);
906 
907  stageAlarmDisplay(time);
908  stageAlarmBar(alarm.percentElapsed());
909  stageArt(_alarmControls);
910 
911  string temp;
912  if(alarm.isDone() && flash){
913  temp = BOLD_RED;
914  }
915  else{
916  temp = BOLD_WHITE;
917  }
918  printAscii(1, temp);
919  printBar(ASCII_HEIGHT+2, temp);
920 
921  printArt(ASCII_HEIGHT+5, BOLD_CYAN);
922  printSplash(ASCII_HEIGHT+8, WHITE);
923 
924  clearFormat();
925  setCursor(1,1);
926 
927  return;
928 
929 }
930 
bool isDone()
Definition: Timer.cpp:147
double percentElapsed()
Returns the percentage of time that has elapsed since the timer started.
Definition: Timer.cpp:160
A class to manage alarms with time-based triggers.
Definition: Alarm.hpp:13
int f2_height
Definition: font2.cpp:117
string timeToString(chrono::time_point< chrono::system_clock > t)
Converts a given time point to a string format (HH:MM).
Definition: Alarm.cpp:59
The Timer class provides a countdown timer with start, pause, resume, reset, and time adjustment func...
Definition: Timer.hpp:12
static const string BOLD
Definition: Display.hpp:29
void clearSplash()
Clears the splash screen.
Definition: Display.cpp:170
The Stopwatch class provides a simple timer with start, pause, resume, and reset functionalities.
Definition: Stopwatch.hpp:13
int remainingMilliseconds()
Returns the remaining time in milliseconds.
Definition: Timer.cpp:118
static const string RED
Definition: Display.hpp:32
void tickTimerSetup(string to_print)
Updates the timer setup display, showing the current input with a blinking cursor.
Definition: Display.cpp:663
chrono::time_point< chrono::system_clock > getEndTime()
Returns the alarm&#39;s end time.
Definition: Alarm.cpp:123
double percentElapsed()
Calculates the percentage of time that has elapsed from start to end.
Definition: Alarm.cpp:78
bool isDone()
Checks if the alarm has finished.
Definition: Alarm.cpp:134
static const string BOLD_YELLOW
Definition: Display.hpp:43
static const string BLACK
Definition: Display.hpp:31
static const string BLUE
Definition: Display.hpp:35
static const string BOLD_WHITE
Definition: Display.hpp:47
STL namespace.
void setCursor(int x, int y)
Sets the cursor position in the terminal.
Definition: Display.cpp:101
void setFont(int num)
Sets the font style for the terminal.
Definition: Display.cpp:79
vector< vector< string > > f3_ascii
Definition: font3.cpp:199
void stageAlarmDisplay()
Stages the display for the alarm.
void setFormat(const string &code)
Sets the terminal text color.
Definition: Display.cpp:138
void clearFormat()
Clears the terminal text color.
Definition: Display.cpp:147
static const string BOLD_BLACK
Definition: Display.hpp:40
static const string SELECTED
Definition: Display.hpp:27
static const string BOLD_RED
Definition: Display.hpp:41
static auto fast_print(const basic_string< char_type > &sss) -> void
Efficiently prints a string to the terminal.
Definition: Display.cpp:124
static const string WHITE
Definition: Display.hpp:38
void printSplits(int splitsIndex, string formatting)
Prints the stopwatch splits to the terminal.
Definition: Display.cpp:645
void stageStopwatchSplits(vector< int > splits)
Stages the splits block to be displayed.
Definition: Display.cpp:501
static const string YELLOW
Definition: Display.hpp:34
static const string BOLD_GREEN
Definition: Display.hpp:42
void printBar(int barIndex, string formatting)
Prints the progress bar to the terminal.
Definition: Display.cpp:607
void stageTimerDisplay(int hours, int minutes, int seconds, int tenths)
Stages the timer display with provided time values.
Definition: Display.cpp:186
int f1_height
Definition: font1.cpp:161
void stageArt(vector< string > art)
Stages the controls for the timer.
Definition: Display.cpp:396
static const string CYAN
Definition: Display.hpp:37
void printSplash(int splashIndex, string formatting)
Prints the splash screen to the terminal.
Definition: Display.cpp:626
static const string MAGENTA
Definition: Display.hpp:36
void tickTimer(Timer &timer)
Updates the display based on the state of the provided Timer object.
Definition: Display.cpp:812
void clearScreen()
Clears the terminal screen.
Definition: Display.cpp:67
static const string BOLD_CYAN
Definition: Display.hpp:46
bool isRunning()
Checks if the timer is currently running.
Definition: Timer.cpp:143
void tickStopwatch(Stopwatch &stopwatch)
Updates the display based on the state of the provided Stopwatch object.
Definition: Display.cpp:856
int currentMilliseconds()
Returns the current elapsed time in milliseconds.
Definition: Stopwatch.cpp:44
vector< int > getSplits()
Returns the splits vector.
Definition: Stopwatch.cpp:90
int f4_height
Definition: font4.cpp:185
void stageAlarmBar(double percentage)
Creates a visual progress bar for the alarm based on the percentage completed.
Definition: Display.cpp:356
void tickAlarm(Alarm &alarm)
Updates the display based on the state of the provided Alarm object.
Definition: Display.cpp:899
int f3_height
Definition: font3.cpp:200
static const string BOLD_BLUE
Definition: Display.hpp:44
Display()
Constructs a new Display object.
Definition: Display.cpp:39
static const string BOLD_MAGENTA
Definition: Display.hpp:45
vector< vector< string > > f4_ascii
Definition: font4.cpp:184
void printArt(int controlIndex, string formatting)
Prints controls to the terminal.
Definition: Display.cpp:588
void stageStopwatchDisplay(int hours, int minutes, int seconds, int hundredths)
Stages the stopwatch display with provided time values.
Definition: Display.cpp:414
void tickAlarmSetup(string to_print, bool isAM)
Updates the alarm setup display, showing the current input with a blinking cursor.
Definition: Display.cpp:705
vector< vector< string > > f2_ascii
Definition: font2.cpp:116
static const string GREEN
Definition: Display.hpp:33
void printAscii(int asciiIndex, string formatting)
Prints ASCII art to the terminal.
Definition: Display.cpp:569
bool isRunning()
Checks if the stopwatch is currently running.
Definition: Stopwatch.cpp:163
void clearLine(int lineIndex)
Clears a specific line in the terminal.
Definition: Display.cpp:111
void stageTimerBar(double percentage)
Stages the progress bar for the timer.
Definition: Display.cpp:316
vector< vector< string > > f1_ascii
Definition: font1.cpp:160
void setSplash(string str)
Sets the splash screen text.
Definition: Display.cpp:162