-
Notifications
You must be signed in to change notification settings - Fork 1
/
paddle.h
75 lines (56 loc) · 1.5 KB
/
paddle.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
/**
* @file paddle.h
* @brief Declaration (of class and member functions) for the Paddle class
* @author Bronson Schoen
* @date 3/6/2016
*/
#ifndef PADDLE_H
#define PADDLE_H
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QPainter>
#include <QtGlobal>
#include <QDebug>
#include <QtGlobal>
#include <QVector2D>
#include <QBrush>
#include <QColor>
/**
@class Paddle
@brief Dervied class of QGraphicsItem representing a Paddle in the game.
*/
class Paddle : public QGraphicsItem
{
public:
Paddle();
Paddle(int start_x_position, int start_y_position);
virtual ~Paddle() {qDebug()<<"Deleting Paddle";};
QRectF boundingRect() const;
void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget);
QPainterPath shape() const;
void move_left();
void move_right();
qreal get_width();
qreal get_height();
void set_width(qreal new_width);
void set_height(qreal new_height);
void shrink();
void grow();
void slower();
void faster();
void reset_powerups();
private:
qreal pen_width;
qreal starting_width;
qreal starting_height;
qreal width;
qreal height;
qreal starting_movement_distance;
qreal default_movement_distance;
qreal size_change_amount;
qreal speed_change_amount;
QVector2D start_vector;
};
#endif // PADDLE_H