-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
54 lines (47 loc) · 944 Bytes
/
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
#include <iostream>
#include <conio.h>
#include "paintb.h"
int main(void) {
int rows, cols;
std::cout << "Enter the number of rows: " << "\n";
std::cin >> rows;
std::cout << "Enter the number of columnss: " << "\n";
std::cin >> cols;
canvasCRS cnv(rows, cols);
cnv.setFocusedMode(true);
cnv.setMouseInput(true);
unsigned char key = 'r';
cnv.maximize();
cnv.printFull();
while(key != 'q') {
switch(key) {
case 'i':
cnv.zoomIn();
break;
case 'o':
cnv.zoomOut();
break;
case 'c':
cnv.cls();
cnv.zoomIn();
cnv.zoomIn();
std::cout << "HELLO! please wait for 1 second";
Sleep(1000);
cnv.printFull();
break;
case 's':
cnv.saveCanvas("save1.pb");
break;
case 'l':
cnv.loadCanvas("save1.pb");
cnv.printFull();
break;
default:
if('1' <= key && key <= '7') {
cnv.changeColor(key - 48);
}
break;
}
key = cnv.inputLoop();
}
}