-
Notifications
You must be signed in to change notification settings - Fork 1
/
detectable.h
76 lines (53 loc) · 1.92 KB
/
detectable.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
69
70
71
72
73
74
75
76
#ifndef __DETECTABLE_H__
#define __DETECTABLE_H__
#include "point.h"
enum DetectableType
{
RECTANGLE, CIRCLE
};
enum Substance
{
EMPTY, RUBBER, SOLID
};
enum Direction
{
UP, DOWN, LEFT, RIGHT
};
class Detectable
{
protected:
Point upperLeft;
Point upperRight;
Point lowerRight;
Point lowerLeft;
Point center;
double width;
double height;
bool fixed;
bool moves;
Substance substance;
DetectableType dType;
void circleOnRectDetection(Detectable* circle, Detectable* rect);
void rectOnRectDetection(Detectable* rect1, Detectable* rect2);
void circleOnCircleDetection(Detectable* circle1, Detectable* circle2);
void circleOnRectResponce(Detectable* circle, Detectable* rect, double dx, double dy);
void circleOnCircleResponce(Detectable* c1, Detectable* c2, double distance, double angle);
public:
Detectable();
Detectable(Point upperLeft, Point lowerRight, Substance substance, DetectableType type, bool fixed, bool moves);
Detectable(Point upperLeft, double width, double height, Substance substance, DetectableType type, bool fixed, bool moves);
Detectable(Point center, double radius, Substance substance, DetectableType type, bool fixed, bool moves);
double getWidth();
double getHeight();
double getRadius();
DetectableType getDetectableType();
Substance getSubstance();
Point getCenter();
Point getUpperLeft();
Point getLowerRight();
void handleDetection(Detectable* d2);
void moveBy(double dx, double dy);
virtual void wasTouchedBy(Detectable* d, Point loc1, Point loc2, double xAmount, double yAmount);
//virtual void wasTouchedBy(Detectable* d) = 0;
};
#endif