-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaddle.h
57 lines (42 loc) · 934 Bytes
/
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
#pragma once
#include <SFML/Graphics.hpp>
using namespace sf;
class Paddle
{
private:
RenderWindow *window;
RectangleShape rectangle;
Text scoreText;
Font* scoreFont;
int y;
int x;
int height;
int width;
int player;
int score;
float speed;
public:
// Constructor
// window - pointer to window, there we could draw paddle
// player - number of player ->
// [1 - player 1
// 2 - player 2 ]
// speed - speed of player on Y axis
Paddle(RenderWindow *window, int height, int width, int player, float speed);
// I don't think that this must be explained
void draw();
// Update state of paddle
// Controls:
// 1 player: W, A, S, D
// 2 player: arrows (left, top, right, bottom)
void update(float time);
// Setters
void setY(int y);
int getX();
int getY();
// Increment score;
void updateScore();
void setScoreFont(Font* scoreFont);
void setScorePosition(int x, int y);
void drawScore();
};