-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
37 lines (33 loc) · 1.04 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
#include <iostream>
#include "MonitorController.h"
int main(int argc, char *argv[]) {
MonitorController mon;
std::map<int, std::vector<int>> res = mon.getSupportedResolutions();
if (argc < 3) {
std::cout << "Supported Resolutions:" << std::endl;
for (auto const& [xKey, yVector] : res) {
for (int i : yVector) {
std::cout << xKey << "x" << i << std::endl;
}
}
std::cout << "Usage: ./exe [x] [y]" << std::endl;
return 0;
}
int x = std::stoi(argv[1]);
int y = std::stoi(argv[2]);
long changeCode = mon.setResolution(x, y);
if (changeCode != 0) {
if (mon.codes.count(changeCode) == 0) {
std::cout << "Error code " << changeCode << " not recognized" << std::endl;
return 0;
}
std::cout << mon.codes[changeCode] << std::endl;
return 0;
}
std::cout << "Keep resolution?" << std::endl;
int key;
std::cin >> key;
if ((int)key == 1) return 0;
mon.resetChanges();
return 0;
}