-
Notifications
You must be signed in to change notification settings - Fork 0
/
racket.h
41 lines (34 loc) · 802 Bytes
/
racket.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
#ifndef RACKET_H
#define RACKET_H
#include <QGraphicsRectItem>
#include <QKeyEvent>
#include "settings.h"
class QMediaPlayer;
class Racket: public QObject, public QGraphicsRectItem
{
Q_OBJECT
private:
int side;
bool aiMode = false;
unsigned int score;
double speed = Global::Height/410.0 * Global::playerSpeedConst ;
Dir direction = Stop;
QMediaPlayer *score_sound;
public:
Racket(int side);
void move();
void moveUp();
void moveDown();
void changeDirection(Dir dir);
bool getSide() const;
bool getAIMode() const;
unsigned int getScore() const;
void resetScore();
void resize();
void mute(int sound);
void setAIMode(bool enabled);
~Racket() = default;
public slots:
void increaseScore();
};
#endif // RACKET_H