-
Notifications
You must be signed in to change notification settings - Fork 0
/
GamePlay.h
66 lines (51 loc) · 1.13 KB
/
GamePlay.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
#pragma once
#include "GameState.h"
#include "Game.h"
#include "Player.h"
#include "Ball.h"
#include "Scoreboard.h"
#include "Tiles.h"
class Game;
class GamePlay;
class GameEvents {
public:
GameEvents();
~GameEvents();
virtual void Collisions(GamePlay* g);
virtual bool CheckCollision(Ball* b, Player* p);
virtual void IncrementScore(
std::map<std::string, Player*> _players,
Player* player);
private:
};
class GamePlay : public GameState, public GameEvents {
public:
GamePlay(Game* g);
~GamePlay();
std::map<std::string, Player*> _playerList;
std::vector<Ball*> _ballList;
Scoreboard _score;
Tiles _background;
sf::Vector2f _gameArea;
sf::Texture ballTexture;
sf::Texture playerTexture;
sf::View _camera;
bool slowMode;
sf::Time _updateT;
sf::Time _dt;
sf::Clock tick;
void Show();
void Load();
void Draw(sf::RenderWindow& window);
void Update();
void UpdateObjects(float timeDelta);
void UpdateCamera();
void BallSpawner(int time);
void HandleEvents(sf::RenderWindow& window);
void HandleClicks(int x, int y);
void Restart();
void ResetScores();
void ResetPositions(Player* sender);
Game* _game;
private:
};