-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSymbol.cpp
55 lines (46 loc) · 1.13 KB
/
Symbol.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
#include "Symbol.h"
Symbol::Symbol(int x, int y, int textColor, int symbolType)
{
this->coord.X = x;
this->coord.Y = y;
this->textColor = textColor;
this->symbolType = symbolType;
}
Symbol::Symbol(const Symbol& other)
{
std::cout << "copy constructor" << std::endl;
}
void Symbol::print_symbol()
{
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);// ïîëó÷àåì äàííûå èç êîíñîëè
SetConsoleTextAttribute(hStdOut, (WORD)(0 << 4 | textColor)); //óñòàíàâëèâàåò àòðèáóòû ñèìâîëîâ
SetConsoleCursorPosition(hStdOut, coord); //ïîëîæåíèå êóðñîðà â êîíñîëè
_putch(symbolType); //âûâîäèò íà ýêðàí ñèìâîë
SetConsoleTextAttribute(hStdOut, (WORD)(0 << 4 | 15)); // óñòàíàâëèâàåò öâåò ëèíèè
}
void Symbol::clear_symbol()
{
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hStdOut, coord);
_putch(32);
}
int Symbol::get_coord_x()
{
return coord.X;
}
int Symbol::get_coord_y()
{
return coord.Y;
}
int Symbol::get_text_color()
{
return textColor;
}
int Symbol::get_symbol_type()
{
return symbolType;
}
void Symbol::set_color(int newColor)
{
this->textColor = newColor;
}