-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtarget.h
47 lines (38 loc) · 982 Bytes
/
target.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
#ifndef TARGET_H
#define TARGET_H
#include <QObject>
#include <QGraphicsItem>
#include <QPainter>
#include <QTimer>
#include <windows.h>
#include "bullet.h"
typedef enum{SHOOTER, TARGET} ObjectType;
class Target: /*public QObject,*/ public QGraphicsObject
{
Q_OBJECT
public:
explicit Target(QObject *parent = 0);
~Target();
virtual void hit(int damage);
virtual ObjectType getType();
int health;
int maxHealth;
bool shot;
QTimer *bulletTimer;
signals:
void signalBullet(QPointF start, QPointF end, Target * shooter);
void signalScore();
public slots:
virtual void slotGameTimer();
virtual void slotTarget(QPointF point);
virtual void slotShot(bool shot);
void stopSlot();
private slots:
virtual void slotBulletTimer();
protected:
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private:
QPointF targetHSE;
};
#endif // TARGET_H