-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbullet.h
38 lines (30 loc) · 837 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>
#include "target.h"
class Bullet: /*public QObject, public QGraphicsItem*/ public QGraphicsObject
{
Q_OBJECT
public:
explicit Bullet(QPointF start, QPointF end, QGraphicsItem *hero, QObject *parent = 0);
~Bullet();
// void setCallbackFunc(void (*func) (QGraphicsItem * item));
signals:
void shotHit(QGraphicsItem * item);
public slots:
private:
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void (*callbackFunc)(QGraphicsItem * item);
QTimer *timerBullet;
QGraphicsItem *hero;
QColor color;
private slots:
void slotTimerBullet();
};
#endif // BULLET_H