-
Notifications
You must be signed in to change notification settings - Fork 1
/
brick.h
78 lines (60 loc) · 1.78 KB
/
brick.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* @file brick.h
* @brief Declaration (of class and member functions) for the Brick class
* @author Bronson Schoen
* @date 3/6/2016
*/
#ifndef BRICK_H
#define BRICK_H
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QPainter>
#include <QtGlobal>
#include <QDebug>
#include <QtGlobal>
#include <QVector2D>
/**
@class Brick
@brief Dervied class of QGraphicsItem representing a Brick in the game.
*/
class Brick : public QGraphicsItem
{
public:
Brick();
Brick(int start_x_position, int start_y_position);
Brick(int start_x_position, int start_y_position,
bool shrink_powerup_brick,
bool grow_powerup_brick,
bool slower_powerup_brick,
bool faster_powerup_brick);
virtual ~Brick() {qDebug()<<"Deleted a brick";};
//Must implement as QGraphicsItem is an abstract class w/ these two pure virtual
QRectF boundingRect() const;
void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget);
//Reimplement to return shape other than bounding rectangle (circular shape)
QPainterPath shape() const;
//getters
qreal get_width();
qreal get_height();
//Get and set hit value
void set_hit(bool hit_value);
bool is_hit();
bool is_shrink_powerup();
bool is_grow_powerup();
bool is_slower_powerup();
bool is_faster_powerup();
private:
bool hit;
//powerbrick markers
bool shrink_powerup;
bool grow_powerup;
bool slower_powerup;
bool faster_powerup;
qreal pen_width;
qreal width;
qreal height;
QVector2D start_vector;
};
#endif // BRICK_H