-
Notifications
You must be signed in to change notification settings - Fork 2
/
game.h
64 lines (56 loc) · 1.22 KB
/
game.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
#ifndef GAME_HEADER
#define GAME_HEADER
#define WIN_X SDL_WINDOWPOS_UNDEFINED
#define WIN_Y SDL_WINDOWPOS_UNDEFINED
#define WIN_W 640
#define WIN_H 480
#define TITLE_X (WIN_W/2 - 70)
#define TITLE_Y 100
#define TITLE_W 200
#define TITLE_H 100
#define SUBT_X (WIN_W/2 - 200)
#define SUBT_Y 200
#define SUBT_W 400
#define SUBT_H 50
#define LEFT_RES_X 10
#define LEFT_RES_Y WIN_H/2
#define LEFT_RES_W 100
#define LEFT_RES_H 70
#define RIGHT_RES_X (WIN_W/2) + 100
#define RIGHT_RES_Y WIN_H/2
#define RIGHT_RES_W 100
#define RIGHT_RES_H 70
#define GAME_TITLE "My Window"
#define MESSAGE_DISPLAY_FRAMES 150
#define GAME_MAX_SCORE 5
#include <string>
#include "paddle.h"
#include "ball.h"
#include <SDL2/SDL_ttf.h>
#include <SDL2/SDL.h>
class Game
{
private:
TTF_Font *TitleFont,*SubtitleFont,*ScoreFont,*ResultFont;
SDL_Window *window;
SDL_Surface *surface;
SDL_Renderer *renderer;
Paddle *left_paddle,*right_paddle;
Ball *ball;
bool isComplete;
public:
int frames_rendered;
class InitFailed
{
public:
InitFailed()
{
}
};
Game(std::string s);
void displayMessage(TTF_Font *,SDL_Color,std::string ,int ,int ,int , int );
void startGame();
void renderNextFrame();
void displayScore();
};
#endif