forked from hBuzzy/Task2_Spider
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspider.h
More file actions
42 lines (33 loc) · 824 Bytes
/
Copy pathspider.h
File metadata and controls
42 lines (33 loc) · 824 Bytes
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
// spider.h
#ifndef SPIDER_H
#define SPIDER_H
#include <QObject>
#include <QPixmap>
#include <QTimer>
#include <QPoint>
#include <QVector>
class Spider : public QObject {
Q_OBJECT
public:
explicit Spider(QObject *parent = nullptr);
void setSpeed(int speed);
void setStartPosition(const QPoint &position);
void startMoving();
void stopMoving();
QPoint getPosition() const;
QPixmap getSpiderImage() const;
signals:
void positionChanged(const QPoint &position);
public slots:
void moveSpider(const QPoint &target); // Изменим сигнатуру метода
private:
QTimer *timer_;
QPixmap spiderImage_;
QPoint position_;
int speed_;
QVector<QPoint> web_;
QVector<QPoint> path_;
public:
QVector<QPoint> getPath() const;
};
#endif // SPIDER_H