-
Notifications
You must be signed in to change notification settings - Fork 0
/
bullet.h
38 lines (28 loc) · 867 Bytes
/
bullet.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
#ifndef BULLET_H
#define BULLET_H
#include <QObject>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QTimer>
#include <QPainter>
#include <QDebug>
class Bullet: public QObject, public QGraphicsItem
{
Q_OBJECT
public:
explicit Bullet(QPointF start, QPointF end, QGraphicsItem *hero, QObject *parent = 0);
~Bullet();
void setCallbackFunc(void (*func) (QGraphicsItem * item));
signals:
public slots:
private:
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void (*callbackFunc)(QGraphicsItem * item);
private:
QTimer *timerBullet; // Слот для обработки таймера пули
QGraphicsItem *hero;
private slots:
void slotTimerBullet(); // Слот для обработки полёта пули
};
#endif // BULLET_H