-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame_engine.h
More file actions
51 lines (41 loc) · 1020 Bytes
/
game_engine.h
File metadata and controls
51 lines (41 loc) · 1020 Bytes
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
#ifndef GAME_ENGINE_H
#define GAME_ENGINE_H
#include <QWidget>
#include <QThread>
#include "pongview.h"
#include "ball.h"
#include <mutex>
class game_engine: public QObject
{
Q_OBJECT
public:
game_engine();
game_engine(std::mutex &x);
void get_object(ball* ball_me, pongview* view_me);
void right_bounce(int x, int y, QPoint r_point);
void left_bounce(int x, int y, QPoint l_point);
void border_height_check(int dir);
void border_width_check(int dir);
void just_move();
void new_update(int dir);
void reset();
void pick_rand();
void set_start();
public slots:
void update_me();
void delay();
private:
ball* use_ball;
pongview *use_pong;
bool bounced_r, bounced_l;
QPoint ball_point;
QPoint left_racket, right_racket;
QTimer *timer;
int cur_r_score, cur_l_score;
int px, py;
int ball_speed;
bool move_left, move_right, move_down, move_up;
bool start;
std::mutex &game_safety;
};
#endif // GAME_ENGINE_H