-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.h
68 lines (64 loc) · 1.17 KB
/
node.h
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
#ifndef _Node_H_
#define _Node_H_
// CLASS POS
class POS{
private:
int X,Y;
public:
void SetPosition(int x, int y){ X = x; Y = y;}
void SetX(int x) { X = x;}
void SetY(int y) { Y = y;}
int GetX() { return X;}
int GetY() { return Y;}
};
// CLASS RGB
class RGB{
private:
float R,G,B;
public:
void SetColor(float r, float g, float b){ R = r; G = g; B = b;}
float GetR() { return R;}
float GetG() { return G;}
float GetB() { return B;}
int CmpColor(float r, float g, float b); // compare 2 color
};
int RGB::CmpColor(float r, float g, float b){
if(r == R && g == G && b == B)
return 1;
else
return 0;
}
// CLASS NODE
class Node : public RGB, public POS{
private:
Node *fd;
Node *bk;
public:
Node();
Node(int x, int y);
Node(float r, float g, float b);
Node(Node *fd, Node *bk);
void SetFD(Node *p){ fd = p;}
void SetBK(Node *p){ bk = p;}
Node* GetFD(){ return fd;}
Node* GetBK(){ return bk;}
};
Node::Node(){
SetFD(NULL);
SetBK(NULL);
};
Node::Node(int x, int y){
SetPosition(x,y);
SetFD(NULL);
SetBK(NULL);
}
Node::Node(float r, float g, float b){
SetColor(r,g,b);
SetFD(NULL);
SetBK(NULL);
}
Node::Node(Node *fd, Node *bk){
SetFD(fd);
SetBK(bk);
}
#endif