-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
64 lines (59 loc) · 1.3 KB
/
main.cpp
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <ncurses.h>
#include <ctime>
#include <unistd.h>
#include <thread>
#include <chrono>
#include <mutex>
#include <condition_variable>
#include "./lib/includes/clock.hpp"
#include "./lib/includes/draw.hpp"
#include "./lib/includes/winrel.hpp"
int keyboardInput;
int currentMenu = 0;
int exitFlag = 0;
int pressFlag = 0;
int stwCounter = 0;
int timCounter = 0;
//cv for terminating each thread
std::condition_variable cv;
//menu for rotating menu
std::condition_variable menu;
//buttons for stopwatch
std::condition_variable stop;
std::condition_variable reset;
int main(int argc, char * const * argv){
int velocity = 1;
int op;
while((op=getopt(argc,argv,"v:"))!=-1){
switch(op){
case 'v':
velocity = std::stoi(optarg);
if(velocity < 1 || velocity >1000){
std::cout<<"invalid option"<<std::endl;
return -1;
}
break;
case '?':
std::cout<<"Unknown flag : "<<optopt<<std::endl;
break;
}
}
initscr();
noecho();
start_color();
cbreak();
curs_set(0);
//configuration
int yMax, xMax;
getmaxyx(stdscr, yMax, xMax);
WINDOW* bg = newwin(yMax,xMax,0,0);
refresh();
box(bg, 0, 0);
wrefresh(bg);
//clock start
Clock clock1(velocity);
clock1.tickCurrentTime();
endwin();
return 0;
}