-
Notifications
You must be signed in to change notification settings - Fork 1
/
h_Item.h
executable file
·53 lines (36 loc) · 1.06 KB
/
h_Item.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
#ifndef H_ITEM_H
#define H_ITEM_H
typedef double qreal;
class Settings;
class h_Simulation;
#include <QObject>
class h_Item : public QObject
{
Q_OBJECT
public:
h_Item(Settings *settings, h_Simulation *aSimulation, qreal aRadius);
h_Simulation* getSimulation() const {return simulation;}
qreal getX() const {return x;}
qreal getY() const {return y;}
int getAngle() const {return angle;}
void setX(qreal _x) {x =_x;}
void setY(qreal _y) {y =_y;}
void setAngle(int _angle) {angle =_angle;}
virtual bool isRobot() const {return false;}
virtual bool isFood() const {return false;}
virtual bool isPoison() const {return false;}
virtual void initPos(qreal _x, qreal _y, int _angle);
virtual void reset(qreal _x, qreal _y, int _angle);
signals:
void positionChanged(h_Item *item);
protected:
qreal dist(const h_Item *item1, const h_Item *item2) const;
protected:
Settings* s;
h_Simulation* simulation;
qreal radius; // For collision
qreal x;
qreal y;
int angle;
};
#endif // H_ITEM_H