-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRacket.hpp
54 lines (49 loc) · 942 Bytes
/
Racket.hpp
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
#ifndef RACKET_HPP___
#define RACKET_HPP___
#ifdef _WIN32
#include <SDL.h>
#endif
#ifdef _WIN64
#include <SDL.h>
#endif
#ifdef __unix__
#include <SDL2/SDL.h>
#endif
#include <iostream>
#include "GameWindow.hpp"
#include "Ball.hpp"
class Ball;
class GameWindow;
class Racket
{
friend class Ball;
friend class GameWindow;
private:
SDL_Scancode key_up, key_down;
SDL_Rect rect;
GameWindow* game_window;
int& x;
int& y;
int& w;
int& h;
int step;
public:
enum side{LEFT, RIGHT};
private:
side racket_side;
public:
explicit Racket(GameWindow* gw, const side& racket_side, const SDL_Scancode& up, const SDL_Scancode& down);
~Racket() = default;
Racket(const Racket&) = delete;
Racket(Racket&&) = delete;
Racket& operator=(const Racket&) = delete;
Racket& operator=(Racket&&) = delete;
void control(const Uint8* key_state);
public:
// object control methods
void up();
void down();
void render();
void reset();
};
#endif