-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtyping_statistics.cpp
41 lines (36 loc) · 1.09 KB
/
typing_statistics.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
#include <iostream>
#include <iomanip>
#include <fstream>
#include "keyboard_listen.h"
#include "heatmap.h"
Fingers fingers;
Names names;
//-----------------------------------------------------------------------------
bool onStart(int argc, char** argv) {
std::ifstream fin("layout_fingers.txt");
fingers.load(fin);
fin.close();
fin.open("layout_names.txt");
names.load(fin);
fin.close();
return true;
}
//-----------------------------------------------------------------------------
void onTap(Tap tap, long time_duration, long time_offset) {
using namespace std;
cout << "col=" << tap.col << ", "
<< "row=" << tap.row << ", "
<< "layer=" << tap.layer << ", "
<< "offset=" << time_offset << "ms, "
<< "duration=" << time_duration << "ms, "
<< "finger=" << fingers.getFinger(tap) << ", "
<< "row=" << fingers.getRow(tap) << ", "
<< "name=\"" << names.getName(tap) << "\""
<< endl;
}
//-----------------------------------------------------------------------------
void onExit(void) {
using namespace std;
cerr << endl;
cerr << "Terminating..." << endl;
}