]> git.localhorst.tv Git - sdl-test7.git/blob - src/pong/Match.h
ce7c0e1a96f5250d42bed4fadd5b21472f0e1532
[sdl-test7.git] / src / pong / Match.h
1 /*
2  * Match.h
3  *
4  *  Created on: Apr 9, 2012
5  *      Author: holy
6  */
7
8 #ifndef PONG_MATCH_H_
9 #define PONG_MATCH_H_
10
11 #include "Ball.h"
12 #include "CountingWall.h"
13 #include "Paddle.h"
14 #include "../app/State.h"
15 #include "../game/Collision.h"
16 #include "../game/Entity.h"
17
18 #include <utility>
19 #include <vector>
20 #include <SDL/SDL_ttf.h>
21
22
23 namespace pong {
24
25 class Match
26 : public app::State {
27
28         public:
29                 Match(void);
30                 virtual ~Match(void);
31
32         public:
33                 virtual void EnterState(app::Control *ctrl, SDL_Surface *screen);
34                 virtual void ExitState(void);
35
36                 virtual void HandleEvent(const SDL_Event &);
37                 virtual void UpdateWorld(float deltaT);
38                 virtual void Render(SDL_Surface *);
39
40         private:
41                 void UpdateEntities(float deltaT);
42                 void CheckCollisions(float deltaT);
43                 void CheckWorldCollisions(float deltaT);
44                 void HandleCollisions(float deltaT);
45                 void UpdateScore(SDL_Surface *);
46                 void RenderHUD(SDL_Surface *);
47                 void RenderScore(SDL_Surface *);
48
49         private:
50                 app::Control *ctrl;
51                 TTF_Font *scoreFont;
52                 SDL_Surface *leftScoreText, *rightScoreText;
53                 Sint32 paddleSpeed;
54                 Uint32 worldWidth, worldHeight;
55                 Ball ball, secondBall;
56                 Paddle leftPaddle, rightPaddle;
57                 CountingWall topWall, bottomWall, leftWall, rightWall;
58                 std::vector<game::Entity *> entities;
59                 std::vector<game::Collision> collisions;
60                 bool updateScore;
61
62 };
63
64 }
65
66 #endif /* PONG_MATCH_H_ */