-
Notifications
You must be signed in to change notification settings - Fork 0
/
Point.cpp
68 lines (58 loc) · 846 Bytes
/
Point.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
65
66
67
68
#include <iostream>
#include "Gotoxy.h"
#include "Point.h"
using namespace std;
Point :: Point(int x1, int y1)
{
x = x1;
y = y1;
};
void Point :: draw(char c) const
{
gotoxy(x, y);
cout << c << endl;
}
void Point::setX(int x)
{
this->x = x;
}
void Point::setY(int y)
{
this->y = y;
}
int Point::getX() const
{
return this->x;
}
int Point::getY() const
{
return this->y;
}
void Point::setSymbol(char symbol)
{
this->symbol = symbol;
}
char Point::getSymbol() const
{
return this->symbol;
}
void Point :: move(eKEYS newDirection)
{
switch (newDirection)
{
case eKEYS::LEFT:
dir_x = -1;
dir_y = 0;
break;
case eKEYS::RIGHT:
dir_x = 1;
dir_y = 0;
break;
case eKEYS::DOWN:
dir_x = 0;
dir_y = 1;
break;
}
x = x + dir_x;
y = y + dir_y;
}